Posted on

Creating a Report with Visual Report Designer

Creating a Report with Visual Report Designer

Visual Report Designer allows you to create most any report or table using a simple drag-and-drop process. Before you can create a report, you must first understand the structure of a report template and how it interacts with AutoCAD Civil 3D.

Report template documents are organized by ‘bands’ which are bound to classifications (or ‘types’) of drawing/model entities (e.g. points, corridors, surfaces, etc.), and queries are used to determine which entities will be used to populate the report. Reports may also have bands which represent page/group headers and footers, and which may contain summation data for groups of entities.

run/execute report process

When a report document is executed against the active drawing, the reporting engine first determines which types of entities the report is bound to. It then retrieves all entities of these types and filters the result using the queries defined for the report. The resulting data is then used to generate a report document using the structure and formatting defined in the report template. When a report is generated, the bands will be repeated for each entity returned by the query operation – bands can therefore be thought of like a ‘row’ in a table.

The final generated report document may be previewed, printed, exported to various document file formats, or inserted directly into the DWG.

Creating a Report Template

To create a report template, you must first open Visual Report Designer from within AutoCAD Civil 3D. To do so, click on the Visual Report Designer icon in the civil+plus ribbon bar:

Visual Report Designer Ribbon Panel in AutoCAD Civil 3D

This will open the main Visual Report Designer window, generally referred to as the ‘report designer.’

Visual Report Designer - no document open

Next, we’ll create a new report using the left-most icon in the report designer toolbar:

New report icon in Visual Report Designer

At this point, we have an empty report template, and the Field List is populated with entity types and fields to add to your report. The report is also divided into header, ‘detail’, and footer bands:

Visual Report Designer - new document open

The initial ‘detail’ band is automatically bound to your drawing. To add bands which are bound to specific entity types, you need to add ‘child’ detail report bands by right-clicking on the existing detail band header bar and selecting the proper entity under the ‘Insert Detail Report’ menu option:

add polyline detail report band

For this tutorial, let’s create a report to show information about specific polylines in the drawing. After adding the child detail report band for ‘Polylines’, our report template now looks like this:

polyline detail report band added

We now have the proper containers in place and are ready to add some fields. To do so, we look to the Field List window pane (typically docked on the right side of the report designer window):

Visual Report Designer field list - expanded to show Polylines entity

Inserting a field into the report template is simple – you just click and drag the field from the list into the appropriate band in the report template. When the field is dropped into the report template, it will automatically create the proper type of control to display the information returned by the selected field, and will automatically bind that control to that field. For example, let’s say we want to see the ‘Object Id’ value for the polyline (this is the ID which AutoCAD uses to identify the entity). To do this, we select the ‘ObjectId’ field and drag it into the report template. This operation creates a new label in the report which is bound to the ObjectId field of the polyline associated with the current instance of the band we placed the field label in.

drag/dropthe ObjectId field into the report

Let’s add a few more fields, and some static labels. We will repeat the above process to add references to the ‘Length’, NumVerts’, and ‘Closed’ fields. We will then drag/drop three labels from the Tool Box window pane (typically found on the left side of the report designer window) and set the label text by clicking on the label control in the report template and typing the text we want it to display:

add additional fields; add labels from the toolbox

Note that if we want, we can change fonts, colors, etc for all labels in the report template.

For this report, we may also want to show an image of each of the polyline entities returned by the report query. To do this, we simply drag the ‘Image’ field from the Field List into the report template, and resize as desired:

add image field and control

The image control will show up as an empty box in the report template – when we run the report, it will show an image of the polyline entity associated with the current instance of the row it is placed in.

Now that we have our report template defined, only one step remains before we can test our work and run the report against the current drawing: we need to save first.

Running the Report

Now that we have defined and saved a report template, we can run it against the current DWG in AutoCAD Civil 3D. There are several ways the report may be run (Insert Report, Insert Report to Layouts, Batch Export Reports, etc). For our current purposes, we will simply preview the report within the report designer. To do this we select the Print Preview tab in the report designer window:

print preview tab location

When you select the Print Preview tab, the reporting engine will switch from designer mode and will run or execute the report. This will cause the Edit Queries dialog window to appear:

edit queries dialog

In this window, you can define a query that will be used to select entities from the drawing for inclusion in the final report document. You can filter by layer, color, linetype, etc, and can define a selection set. It is also possible to select all entities within a specific boundary (defined by a polyline, layout viewport, etc.) – we’ll save this last item as a subject for a future post. For now, let’s just leave the query with the default settings (which will automatically return ALL entities of the specified type). Note that if no items are selected for a ‘selection set’, the selection set will return all appropriate entities from the current drawing. Once the queries are configured as desired, we click the ‘OK’ button to proceed to generate the report document from our drawing entities:

DWG data - 3 distinct polylines (1 closed)

print preview showing generated report document

The report document generated includes three copies of the detail report band bound to the Polylines entity collection – one for each polyline returned by the query. Each band contains all of the fields we defined in the report template, including an image of the polyline. From here, we can print the report, export it as a document file (PDF, XLSX, HTML, etc.), or insert it directly to the DWG.

Variations/Next Steps

Now that know how to create and execute a basic report, you can delve deeper into the Visual Report Designer reporting engine and feature set to explore the virtually limitless possibilities for creating reports and tables. Some variations of this report include:

  • Formatting the labels: size, color, font, etc.
  • Adding mode child detail report bands for things such as polyline vertices, etc. (many entities, including polylines, are hierarchical in nature and contain child collections of data)
  • Adding document information such as the DWG filename, thumbnail image, etc. to the header and/or footer
  • Adding the current username and date to the footer
  • Adding summation and sorting features
  • Setting up the report to work with the Insert To Layouts command

We’ll continue to add additional posts showing examples some of these and other features of Visual Report Designer. You can also refer to the Visual Report Designer documentation for more information.

Posted on

Hiding Subassembly Target Parameters in the Corridor Properties

Hiding Subassembly Target Parameters in the Corridor Properties

sample subassembly created in Subassembly Studio

Not too long ago, a community member on the Autodesk AutoCAD Civil 3D Wishlist forum posted a request to be able to ‘hide’ target parameters for subassemblies in the corridor properties when no targets were needed. For example, let’s say you have a lane subassembly that supports a width and an elevation target. If the lane will always use a constant width and the cross slope is to be determined solely by default and/or superelevation slopes, then support for the targets (and therefore the target parameters) are superfluous, yet the parameters are still shown in the Target Mapping dialog, accessed via the Corridor Properties:

corridor target mapping dialog in AutoCAD Civil 3D

Wouldn’t it be nice if these unused target parameters could just be hidden?

If a subassembly was created using Subassembly Studio, a new feature allows you to do precisely this with only a minor modification to your existing design. In Subassembly Studio V8.0.16, we introduced a new component called Hide Target Parameters. This component accepts a boolean parameter reference that allows the end user to choose (through the subassembly properties) whether the targets should be hidden. Depending on the value of this parameter, the logic can suppress or hide the target parameters defined for that subassembly from the Corridor Properties dialog in AutoCAD Civil 3D.

To demonstrate how this new feature works, we can create a new subassembly, add some geometry, and then add the new Hide Target Parameters component. The subassembly will just be a single pavement layer in this example, but there is no limitation to the types of subassemblies this applies to – it will work with ANY Subassembly Studio generated subassembly of any complexity, provided there are target parameters to be hidden.

Subassembly Studio - subassembly geometric component list

In this example, we will set up two parameters: one to control target parameter visibility, and the other is of course a target parameter:

Subassembly Studio - subassembly parameters (input and target)

In the Hide Target Parameters component properties, we need to reference our Boolean parameter that we intend to have control target parameter visibility:

Subassembly Studio - add/edit geometry

From here we can tweak any of the geometry, etc. as desired. Once the subassembly is ready to export, we do so and then import the resulting PKT file into AutoCAD Civil 3D. The sample subassembly looks like this in Subassembly Studio:

Sample subassembly in Subassembly Studio

Once the subassembly is imported to AutoCAD Civil 3D, we create an assembly and insert our new subassembly (in this case twice: once on the right, and once on the left), and then create a sample corridor to use this assembly:

assembly in AutoCAD Civil 3D showing one left and one right instance of our custom subassembly

If we initially set both subassembly instances to show the target parameters (set the value of the HideTargetParams parameter to No) as shown below, the target parameters will show up normally in the Corridor Properties:

Assembly Properties in AutoCAD Civil 3D

Corridor target mapping in AutoCAD Civil 3D - all targets shown

If we then modify the value of this parameter on the ‘left’ side only, and then revisit the corridor properties, we can very clearly see the result:

Assembly Properties in AutoCAD Civil 3D

Corridor target mapping in AutoCAD Civil 3D - filtered targets (left side is hidden)

…the left side target parameter has been omitted from the Target Mapping dialog!

If we now repeat this setting for the ‘right’ side as well, we see the following when we try to access the Target Mapping dialog:

no targets found dialog (both subassembly instances have targets hidden)

Changing the settings back will of course result in the target parameters once again being available.

Posted on

Analyzing Pond Volumes using Terra Power Tools

Analyzing Pond Volumes using Terra Power Tools

Terra Power Tools for AutoCAD Civil 3D: Surface and Pond

Estimating pond volumes and water surface elevations in AutoCAD Civil 3D® can be a tedious process.

If the water surface elevation is known, the volume can be obtained using the surface volume tools by modeling the water surface elevation as a ‘flat’ surface which is compared to the existing ground surface in a cut/fill analysis. It works, but it requires quite a few steps, and results in extraneous surfaces in your drawing.

If the runoff volume is known and the water surface elevation must be calculated, the problem gets a whole lot more complicated. The solution here is to use an iterative technique wherein you ‘guess’ a starting elevation and analyze surface volumes to determine the actual volume at that elevation; you then adjust the elevation up or down by a reasonable amount and repeat until you close in on the target volume. This is time consuming as a manual process and is therefore best left to automation…the only problem is that AutoCAD Civil 3D doesn’t provide a mechanism for this.

Thankfully, there is now a much easier way to perform both of these tasks – the solution is found in the Floodplain Analysis feature in Terra Power Tools.

Terra Power Tools - partial ribbon bar

Let’s see how this works.

First, let’s look at the analysis process when the elevation is known. For this, we first select the surface we want to compare against. If a boundary is needed (and available), we select the option to do a ‘bounded’ volume computation and select our previously imported boundary. We then set the target elevation using the Floodplain Elevation controls and press the ‘Compute’ button. The results are shown graphically in the viewport and as tabulated values in the Results pane of the Floodplain Volume Result dialog:

Terra Power Tools: Floodplain analysis and 3d viewer

Note that we did not have to create extra surfaces or any of the other extra steps required to reach a similar result using the tools available in AutoCAD Civil 3D.

Now, let’s turn the problem around and assume that we know the volume that must be stored in the pond basin, but not the final water surface elevation. To calculate this value, we use the Targeted Volumes control in the Floodplain Elevation pane. We set the Target Volume and the tolerance, and then click ‘Compute Elevation’. The elevation controls are adjusted to reflect the result of the calculation, and the graphics in the viewport (and the tabulated results) are updated accordingly:

Terra Power Tools - Floodplain Volume Result: use of the Targeted Volumes feature

For a more detailed discussion of this topic, please check out our previous post on calculating storage basin volumes.

Posted on

Feature Table for Displaying Shapes in Subassembly Studio

Feature Table for Displaying Shapes in Subassembly Studio

We have recently released a new version of Subassembly Studio which contains an early version of a ‘Feature Table’. This new feature enables you to control the color of your subassembly shapes within Subassembly Studio based on the shape codes. For example, let’s say we have shapes coded ‘cut’ and ‘fill’, and would like these displayed in red and blue, respectively:

Cut and Fill shapes with colors determined from shape codes via a Feature Table

By default, Subassembly Studio will cycle through a fixed list of shape colors, with each shape assigned a color based on its draw order. If we had four shapes coded cut, fill, cut, and cut, we would see four different colors on the display. While this does let us know that the shapes formed correctly, it does not correlate in any way whatsoever with the shape codes. It would be far better to have all shapes coded cut drawn in the same color, and so forth.

To accomplish this, we create a Feature Table. First, enter the command \editftb at the Subassembly Studio command line (the backslash character is required). This will bring up the prototype version of the Feature Table Editor:

Feature Table Editor - editing a Feature Table in XML form

This is a simple text editor and does not contain any syntax validation, etc. It does, however, include a color selection tool (see below). It is intended as a temporary user interface and will be replaced with a more user friendly dialog in the future.

To add a code to the Feature Table, simply copy an existing line, create a new empty line, paste, and edit…

Codes may use an asterisk character as a wildcard – for example, if you wanted all codes beginning with ‘A’ to use a specific color, you could use the code ‘A*’, which would then match codes such as ‘ABC’, ‘A123’, etc.

Codes are searched in the order listed. The process for choosing which color to use is as follows:

Code matching algorithm

If no match is found, the ‘DefaultARGB’ value is used to draw the shape:

Cut, Fill, and Pave shapes with colors determined from codes using a Feature Table.

Colors are represented in text as ARGB hexadecimal values. The values begin with the ‘#’ symbol, which is followed by four 2-character values (no spaces) representing the Alpha, Red, Green and Blue channels. These values are hexadecimal values ranging from ‘00’ to ‘FF’. To edit a color, first highlight the entire color value (including the ‘#’ character, but NOT the quotes), and then click on the color wheel icon in the lower left corner of the window. This will bring up a color selection dialog:

Color Selection Dialog

If the selected text represents a valid color, the color will be pre-selected in the dialog; if not, a default value will be used instead.

In this dialog, you simply select the color you want to use by moving the white dot on the color wheel and adjusting the Luminance and Opacity sliders, or by using the ‘…’ button as shown above. Once the desired color is selected, click the OK button…the selected color will replace the highlighted text in the Feature Table. If no text was highlighted when you opened this dialog, the color value will be placed on the clipboard as plain text. If you cancel the selection, no changes will be made to the text, nor will anything be copied to the clipboard.

When editing the color value directly in the Feature Table XML, you can use a named color in place of the hex ARGB value – anything from the above list will be accepted (do not include the ‘#’ character for named colors). The value will be converted into ARGB when you commit your changes and will be shown in ARGB form the next time you edit the table.

We currently have plans to extend this new functionality to work with Points and Links as well, and to significantly improve the Feature Table Editor dialog.

Posted on

Calculating Cut/Fill Shapes in Subassemblies

Calculating Cut/Fill Shapes in Subassemblies

Recently there was a conversation posted on the AutoCAD Civil 3D Community Forum in which a member requested assistance with creating a custom subassembly that would intersect a collection of ‘Datum’ links against a sampled surface and then automatically apply the correct code (i.e. ‘cut’ and ‘fill’) to each of the calculated shapes:

Sketch of cross section showing cut/fill shape geometry

Such shapes might be necessary if your cut and fill materials must be combined with structural (shape based) materials in a quantity report for calculating mass haul. Other times it might be necessary to know the area of cut (or fill) in order to determine how to construct the remainder of the subassembly, etc.

From a subassembly design perspective, this is an interesting problem: the profile of the sampled surface is unknown at the time the subassembly is designed, thus statically calculated and coded shapes won’t work. I’ve seen proposed solutions based on looping techniques, and this may well work, but IMHO this is more complex than is necessary. A much simpler solution exists.

We had encountered this exact problem some time ago when helping a customer with a custom subassembly. Our solution was to add some special components to Subassembly Studio which makes this operation almost trivial to accomplish. At the same time, we also implemented a generic solution which allows the end user to go beyond simple cut and fill classifications to assign unlimited codes to calculated shapes based on a material table (this generic solution may likely be the subject of future posts).

To illustrate the solution I’ve created a sample subassembly which simulates the sampled surface links using a random link generation routine (based on the Complex Curve component). This allows us to see what happens as the sampled surface changes relative to the subassembly design, thus simulating what a real sampled surface might do as the subassembly is modeled at different stations on a corridor. The final product looks something like this:

Sample cut/fill shapes vs random surface - 001

Subassembly construction is relatively straightforward. First, we need to create some geometry which can be used to construct the shapes:

  • We first create the ‘random’ simulated surface links (coded ‘eg’) using the Complex Curve component.
  • Next, we add the ‘design’ links (coded ‘datum’) – our design for this subassembly consists of a flat bottomed ditch and a berm. The actual geometry is completely arbitrary.

Once the geometry is constructed, we can add the cut/fill shapes component:

CutFillShapesFromLinks subassembly component properties

This component samples the links based on codes and/or Ids, and then intersects the selected items to calculate a collection of polygons. These polygons are then classified based on the relationship of each to the link collections (i.e. ‘above’ and ‘below’). Based on the classification, the appropriate shape code is then applied. This allows us to effectively perform this entire complex operation in one simple, easily configured step without the need for loops, etc.

If we ‘regen’ the subassembly graphics a few times, we will see the shape configurations changing (the simulated ‘eg’ surface links are recreated randomly each time we regen), including both the actual shape geometry and the number of shapes found:

Sample cut/fill shapes vs random surface - 002

Sample cut/fill shapes vs random surface - 003

Sample cut/fill shapes vs random surface - 004

Posted on

Using the Complex Curve Component in Subassembly Studio

Using the Complex Curve Component in Subassembly Studio

The Complex Curve component is a powerful but little known component in Subassembly Studio which allows you to model virtually any parametric curve with ease. The ‘curve’ doesn’t even need to actually be a curve – it could also be a randomized multi-segment link that can be used to simulate a sampled surface.

Let’s first take a look at what is required in order to model a parametric curve.

At its core, the Complex Curve component is a conditional iteration over a parametric RPN Expression. Each iteration produces another point on the curve, and at the end of each iteration a condition is checked to determine whether to continue (a ‘do-while’ loop). The result of the calculation is stored in the Calculation Result Variable (the ‘T’ variable in a parametric equation), and separate X and Y variables are also maintained (and set by the RPN calculation).

Complex Curve Calculation Process

In each iteration, the RPN stack is evaluated and then the last value on the RPN stack is assigned to the Calculation Result Variable. A point is also added to the link being created at the coordinates described by the X and Y variable references; if these are configured as ‘delta’ values, the variable value is added to the corresponding coordinate of the reference point for the component, else the variables describe the distance relative to the subassembly origin at (0,0). The X (or ‘Offset’) values can also have the subassembly ‘Side’ applied automatically (multiplied by -1 for left side; 1 for right side).

Let’s look at a simple example – suppose we want to model a parabolic curve:


Y(T) = (T^2) / 25
X(T) = T
dT = 0.1

For these equations, we configure the RPN expression as follows (for a detailed discussion of how RPN calculations work, click here):

RPN Calculator

Here’s what is happening so far:

  • We place the value of T onto the stack. It is initialized with a value of 0 but will change in subsequent iterations.
  • We square this value, then divide by 25 and store the result in the variable Y.
  • Next we reference T again and place the value onto the stack ahead of Y (which will not be used again in the calculation but is nonetheless left on the stack)
  • We write the top item on the stack (equal to T) to the variable X.
  • We then reference the variable dT, which is set to a value of 0.1.
  • We add the top two items on the stack (T and dT) and leave the sum as the top item on the stack.

Upon finishing this calculation, the top item from the stack (equal to T + dT) is written to T, thus incrementing T for the next iteration. We also at this point append a new point onto the point list which will be used to create the curve link. The variables X and Y are used as the coordinates of this point. To enable this to occur, we configure our Complex Curve component as follows:

Complex Curve component settings

The result is a curved link that looks like this:

Parabola with DELTA option enabled for X and Y

Note that we have the options for X and Y to be interpreted as ‘delta’ values enabled. We also used a reference point of ‘2’ for the curve component. Point ‘2’ is conveniently located away from the origin, thus allowing us to demonstrate the effect of changing the ‘delta’ options; if we instruct the component to treat the X and Y variables as absolutes instead of delta values, the result looks like this:

Parabola with DELTA option disabled for X and Y

Notice that the curve is now located relative to the subassembly origin.

The options for interpreting each coordinate value as a ‘delta’ are independent of one another, thus allowing one coordinate value to be a ‘delta’ while the other is ‘absolute’.

The current implementation is using a maximum number of iterations to control the stopping point (the default configuration).  You can also set minimum/maximum coordinates or a custom ‘test case’.  All such conditions are evaluated on each iteration and if any fails, the process is stopped and the curve is considered completed.

Most any curve can be modeled using this method – you simply need to create the proper RPN Expression.

The web store has been temporarily placed in demo/test mode while we update and test some new features. If you see this message and wish to make a purchase please contact Thank you.