Tuesday, June 08, 2010

Civil 3D Styles and Command Settings Automation in .NET

These are my notes from the Experts: Civil 3D Styles and Command Settings Automation in .NET class I attended at AEC DevCamp.

Command Settings

User Defaults, Controls everything from which label styles will be used to the default numeric values.

All of the command settings in Civil 3D 2011 should be available. If you find one’s that’s left out let me know and I’ll request it be added.

Command Settings Export

Can export them out to an XML file, example in the class.

Uses a StringBuilder to add the items to to add to the XML file.

Need to add references to the Civil 3D .NET API: AeccDbmgd.dll (In the program folder)

AecBaseMgd.dll, is the framework for OMF, needed for the program to compile correctly.

System.Windows.Forms, contains the Windows Save Dialog box to save the file.

Need to look at the Toolbox in Visual Studio, to put often used code.

Sample code provides a method to check to see if the setting is a command setting.

The sample code uses Reflection to get the information, an example to look at later to get what that exactly means.

Make sure to set the references to Copy to Local to false.


Can use to see what’s available to change/access.


“Civil 3D is a style based design application”

All styles in 2011 should have access.

Styles Structure – All styles have a common root or collections of styles (Similar to Toolspace Collection layout)

Usually organized by features (Example of one not is General)

Demo, Styles Compare Application

Has a slightly different example than what is included in Civil 3D samples.

An example of how to get the data from two different drawings and then go back to the original drawing.

Try to use a single transaction and not nested transactions to avoid potential problems.

Need to through an exception if an object is not a Root or a Collection when looking to see what type of object it is. Shouldn’t happen, but should handle it someway incase in the future something changes.

Display settings as strings regardless of value to avoid having to do additional work to figure out the value should be.

Uses tree to show the information in a Presenter. Uses colors to show the difference.

Can’t use For Each to go through the objects because the drawings may have different number of styles in each object. Has assumptions on sorting the information. Civil 3D may not return the information in order. The sample code sorts the information.

Check out the code for transactions and not using them.

No comments:


Blog Widget by LinkWithin