How To Change Subassembly Codes Depending on Assembly Side in Civil 3D


Side-dependant codes might be required to ease quantity computation by segregating materials in complex projects. This behavior can be created by leveraging the power of Visual Basic functions within Subassembly Composer, and designers can type the code of their preference.


Have you ever needed to individualize subassembly codes depending on the assembly side? A while ago, I was required to deliver quantity computation for corridor-right and left side separately. As we were working with custom subassemblies, this was not a difficult task, and I want to share how we solved it here.


Resident engineers were suffering when estimating the correct material quantity to be ordered to the quarry. The material computation reports had been created for the whole road section at every station, but in real life, the situation was different. Since the project enhanced an existing road, they had to build the road's left side first to keep the traffic flowing through the right side. Then, they had to detour vehicles to the new road portion while the rest was also constructed.


In this context, resident engineers found themselves adding and subtracting values manually from the reports, and this situation became the source of many errors that provoked material underestimation and overestimation, affecting the project budget and schedule.


The solution:

We combined Subassembly Input Parameters and simple Visual Basic functions to compose side-dependent shape codes to be edited directly in Civil 3D. Then, we updated the subassemblies and rebuilt the model with this enhancement. This is how we did it.


a. Subassembly Editing

- We had an Input parameter for the user to define a custom code, and we kept it.

- Then, we created a string-type variable (ShapeCode1) to store this input and concatenated it with a suffix, "Right" or "Left," since we could access this information from the Side Class (See the following image).




The expression for the variable is comprised of the string class and the side class. The former is a visual basic class, while the latter belongs to the subassembly composer API.









string.concat(Code1, "_",Side.Value)









  • String is a Class, and Concat is a method that can be accessed to concatenate two or more strings. In this case: Code1, "_," and "Side.Value".
    • If you want to know more about this Class, see String Class
  • Code1 is just the Input parameter that allows the user to define the code of his preference.
  • Side.Value is part of the subassembly composer API, and we can access its property value using dot notation.


b. Adding the variable to the shape code

- Finally, when this string-type (ShapeCode1) variable is added to the shape code, it should look like this:



- And the different codes when changing the side of the subassembly should look like this:


Right side



Left Side





Dotnet-Bot, M. (n.d.). String class (system). (System) | Microsoft Learn.


Autodesk. (n.d.). Autodesk Subassembly Composer. Autodesk Subassembly Composer Help.