Customizing with Subassembly Composer
Whether you have been using AutoCAD® for one year or 15, you can attest to its power as a drafting and design platform for many industries. AutoCAD has some verticals with specialized tools to design and draft elements pertaining to different industries. One of those verticals is AutoCAD® Civil 3D, which has specialized tools to create road corridors, ditches, river beds, and more. Those tools are great the way they are, but we can make them even better through customization and by using Autodesk Subassembly Composer.
In this article we will see how to use the Subassembly Composer; we will look at its components and create two subassemblies to see how it works.
Customize It and Make It Yours
When we customize a program or a graphical user interface it usually is because we want to modify the way things look and behave. In AutoCAD we have been doing this for years by using workspaces containing specific combinations of tools, user profiles with specific configurations for system variables, and templates with pre-existing objects and styles. When we customize a program we enhance our productivity because we adapt it to our specific needs. With this in mind let’s take a look at Subassembly Composer.
Subassembly Composer and its Applications
Subassemblies are the building blocks for assemblies in Civil 3D, and we can look at assemblies as cross sections for roads, rivers, embankments, etc. Out of the box, Civil 3D has many great subassemblies for multiple applications; however, in some cases those subassemblies are limited because they either don’t work the way we would like them to or don’t do the things we would like them to.
Subassembly Composer is a program where you can create subassemblies from scratch and then use them in Civil 3D just like you would with any other subassembly.
Subassembly Composer has five sections: Toolbox, Flowchart, Properties, Preview, and Packet Settings. Toolbox is where you find all the elements that make up the subassembly such as its geometry, operators that determine geometry, tools to organize these elements, etc. Flowchart is where you lay out the workflow: what comes first, what comes after, what decisions are made, calculations performed, and so on. Properties is where you set the properties for each of the elements you bring in from the toolbox; properties include geometry, calculations, and overall behavior. Preview is where you see how the subassembly looks as you are putting things together. Packet Settings is where you create and set up the subassembly parameters, targets, and so on.
To understand what Subassembly Composer does, we need to review how subassemblies work, what their components are, and what they do; specifically, we need to understand codes, points, links, and shapes. The codes used when creating a subassembly will work with the codes in the Code Set Styles, point codes will create feature lines, and links can be used for surface creation
Figure 1: Subassembly parts
Figure 1 shows the basic anatomy of a subassembly with codes, points, links, and shape. The information found in the help menu for each subassembly gives you more information about each subassembly, shows you its anatomy, the components for which you can override dimensions by using targets, etc. All of this information can help you to reverse engineer these subassemblies, have a better grasp of how they work, and create parametric subassemblies in Subassembly Composer.
As an AutoCAD user, you are accustomed to drawing lines in a very visual way. This makes the way Subassembly Composer works seem a little weird, so when you design a subassembly it is always a good idea to start by drafting an outline by hand.
Subassembly Composer also requires communicating with the program using its own language, almost like coding; in this case it uses .NET framework. All of this will make more sense once we start working with Subassembly Composer in the following exercises.
Slanted Curb Subassembly
Let’s say that you are working on a project that calls for slanted curbs. You open the Tool Palettes and realize that there is nothing there that looks like what you want, so you can’t use any of the existing subassemblies. You can solve this in Civil 3D if you create a closed polyline, turn it into a subassembly, then assign codes, links, and shape and it probably would be fine. The problem is that if you want to use different dimensions, you would have to create a new one. Instead of doing that, let’s create a parametric subassembly in Subassembly Composer.
The steps below outline the process to create a simple slanted subassembly.
- Open Subassembly Composer.
- In the Packet Settings section go to the Packet Settings tab, then in the Subassembly Name field type SlantedCurb. This is the name that this subassembly will use in Civil 3D.
- Switch to the Input/Output tab; by default the only parameter shown is side, but no default side. Set the side to Right.
- Click Create Parameter to create a new parameter. The direction is input because it is an input parameter, meaning that the user will input the value.
- Make sure the type is set to double, which is the type of parameter that will let you input values with decimal figures.
- Name this parameter TopWidth with no spaces. For display name, type Top Width. The display name can have spaces and that is how it is going to display in Civil 3D.
- Set a default value for this parameter of 0.5. At this point this value is unitless—the units will depend on the units you use in your drawing.
- Repeat the previous steps for the other parameters and make sure your parameters match what is shown in Figure 2.
- From the toolbox under the Geometry category, drag a Point component and drop it into the Flowchart window. This point will be used as the origin and as a reference for positioning the next point. For this point there is no need to modify anything else.
- Drag and drop another point component. This point will use a point code so a feature line can be created when connecting multiple sections using this subassembly. For point code type “BottomCurb”; make sure you use quotation marks or Subassembly Composer will assume that you are trying to enter a variable.
- For Point Geometry Type select Delta X and Delta Y. Set From Point to P1, enter 0 for Delta X, and type -Depth for Delta Y. The location of this point will be measured in terms of deltas in the X and Y direction with respect to the origin point. It will be directly below the origin at a distance of negative Depth, which is a parameter previously defined, and no displacement in the X direction. Make sure “Add Link to From Point” is checked and this will create the first link, which will be automatically named L1. For this link there is no need to modify anything else.
- Add another point element, which will be the bottom right corner of the subassembly. For point codes type “BottomBackCurb.” For Point Geometry Type select Delta X and Delta Y. Under Point Geometry Properties set From Point to P2 which is the previous point. For Delta X type BottomWidth—in this case it is going to go to the right from P2 so the value would be positive. For Delta Y enter 0. Make sure Add Link to From Point is checked and for codes type “Datum” and “SubBase” divided by a comma.
- Add another point element, which will be the top right corner of the subassembly. For point codes type “BackCurb.” For Point Geometry Type set Delta X and Delta Y. For Point Geometry Properties set From Point to P3. For Delta X type 0 since there is no horizontal displacement and for Delta Y type Depth+Height. Make sure “Add Link to From Point” is checked and for codes type “Datum.”
- Add another point element, which will be the top left corner of the subassembly. The point code will be “TopCurb.” Point Geometry Type will be Delta X and Delta Y; it will go from P4, Delta X will be –TopWidth and Delta Y will be 0, in this case it is going to the left from P4 so the X value is. Add Link to From Point is checked and codes are “Top” and “Datum.”
- The curb subassembly is almost ready—we just need to close it. Add a link component to the flowchart; no need for points here because the link will connect to existing points. For link codes type “Top,””Curb.” For position, set Start Point to P5 and End Point P1.
- At this point the subassembly is closed, but it is empty. Drag and drop a Shape component and for Shape Codes type “Curb.” To assign a shape click the green cube with a white arrow in the Links field and then click somewhere inside the subassembly in the preview window.
Figure 2: Input/Output parameters for slanted curb
Figure 3: Slanted curb in Subassembly Composer
At this point the subassembly is ready and it should look like Figure 3. You can now save the file and close Subassembly Composer.
17. In Civil 3D press Ctrl+3 to open the Tool Palettes.
18. Hover over one of the tabs in the tool palette, right-click and select New Palette.
19. Name the new Palette Custom Subassemblies.
20. Switch to the Insert tab and from the Import panel select Import Subassemblies.
21. In the Import Subassemblies dialog, browse to where you saved your subassembly and open it. Toggle on Import to and select the Custom Subassemblies palette you just created and then click OK.
Figure 4: Import into Civil 3D
Now you can use the slanted curb subassembly like a regular curb subassembly.
Constant Length and Varying Slope Subassembly
This subassembly works similar to the LinkWidthAndSlope generic subassembly, but this one keeps the length constant regardless of the slope. Figure 5 shows the schematics of what we want to do and how it will look.
Figure 5: Hand-drawn schematics
Figure 6: GradeLength parameters
- In Subassembly Composer go to Packet Settings and for Subassembly Name type GradeLength.
- Switch to the Input/Output Parameters tab and set the parameters as shown in Figure 6. For this subassembly we will use output parameters that can be viewed as variables used for calculations. Notice that here you have to use both input and output parameters. For the output parameters there is no need to type in a display name because the user will not be able to edit these values. These values are calculated and used for other parameters.
- Add a point component by dragging it from the toolbox and dropping it into the flowchart window. This will be the origin and insertion point.
- Add an output parameter. From the toolbox in the Miscellaneous category, drag Set Output Parameter and drop it into the flowchart.
- Set Output Parameter to Slope, which is one of the output parameters that was created in the packet settings.
- For value, type 1/Grade. By doing this we are converting the grade value into a slope value.
- Add another Output parameter from the toolbox. For Output Parameter select Atan and for value, type Math.Atan(Slope); this will give you the slope in radians.
- Add another Output Parameter. For Output Parameter select AtanDegrees and for value type Atan*180/Math.PI; this will convert the Atan into degrees.
- Add another Output Parameter. For Output Parameter select Angle and for value type 90-AtanDegrees to find the angle.
At this point you have already calculated all the parameters you need, so now it is time to create a point and a link using those parameters. We want to be able to use positive and negative grade values because depending on that, you will draw something different. And because we have two different options, we will use a conditional operator.
10. From the toolbox, drag and drop a Decision operator, which is in the Workflow category. This will work just like an “If” operator.
11. For Condition type Grade>=0, for False Label type False, and for True Label type True.
Let’s work on what to do if Grade>=0, meaning that the slope is either flat or positive.
12. Drag and drop an Auxiliary point and place it below the True label.
13. For Point Geometry Type select Delta X and Delta Y.
14. For From Point select Origin, for Delta X enter 5 and for Delta Y enter 0. Auxiliary points are used as references for other points and they are not shown in the subassembly.
15. Add a point below the auxiliary point you just created and set its properties as shown in Figure 7.
Figure 7: Point properties
We just created a workflow for what to do when the grade is positive, but we haven’t created one for when it is negative. That is why you can’t see anything yet—because the default grade is negative. Let’s take care of that.
16. Drag and drop an Auxiliary point and place it below the False label. For From Point select Origin, for Delta X enter -5 and for Delta Y enter 0.
17. Add a point below this new auxiliary point. Set its properties the same way you did for the previous point. The point will be numbered P3 and this time the Reference Point will be AP2.
18. Now the subassembly is ready and it should look like Figure 8. Save the file and close Subassembly Composer.
Figure 8: GradeLength subassembly
19. Add this subassembly to the Custom Subassemblies palette the same way you did with the other subassembly.
Conclusion
Now you have two parametric subassemblies made from scratch. I hope these two exercises shed some light on how to use Subassembly Composer. These subassemblies are rather simple, but I think you can see the potential of Subassembly Composer.
Think about the subassemblies you use when building corridors. Some of them use targets to override slopes, widths, etc. In Subassembly Composer you can also create subassemblies that work with targets. The process is similar in that you have to create parameters and use those parameters to define targets. Now that you know how to use Subassembly Composer, go ahead and create your own subassemblies, draw them in your mind, then on paper, and then build the subassembly. Customize it and make it yours!
Miguel Medina is a Civil Application Engineer for ProSoft, an Autodesk Gold Partner based out of Utah. He has worked in construction management and design since 2008 and has implemented and trained companies on Civil 3D for the past year. Miguel can be reached at mmedina@prosoftnet.com