As spring settles in with the beautiful sun outside, I sit at my office sick as a dog, or maybe its a sick as a swine nowadays! Anyway, I thought I would start a series to help any who wanted to work with Civil3D’s API. With Civil3D 2010, they have additional functionality to the Managed .Net API. Thus you don’t have to tie into Civil3D’s database using a COM method but rather Civil is a native system namespace. If I just lost you that is fine, just realize that Autodesk is working hard to provide a cleaner, more efficient way to work with programmatically.
Okay, enough talk. Let’s setup our Visual Studio Project.
When you click okay, a new Visual Studio project will be started. Go to your solution explorer and right click on the project name (TestCivil3DApplication) and choose properties. If Solution Explorer is not visible, Go to View>Solution Explorer.
There are a few settings we want to look at in our project’s properties.
First go to the Debug section, and tell it to start Civil3D when you are debugging the application.
This will allow us to debug our application since we are creating a class library (or DLL) we cannot run the application outside of a program.
Lastly, lets look at some references we want to add. Go to the References section of the project’s properties. In the bottom right corner click on the add button which will open a dialog box to add references to your project. Click on the Browse tab and go to your Civil3D Program directory (By default, C:\Program Files\AutoCAD Civil3D 2010). From there we are going to add 4 references:
- This is the reference that will let us work with AutoCAD’s database.
- This is the reference that will let us interact with the AutoCAD application.
- This is the base managed system that Civil3D is built off of.
- Civil3D’s Base reference.
Finally, we don’t to copy these references locally. We don’t need to because we are going to having our application work in Civil3D which already has these references loaded. If we create local copies, we could run into versioning issues among other things. So select all four newly added references and in the properties window (View>Properties) select the Copy Local parameter and set it to False.
Now that we have our project setup, we will look at doing some coding next.
BTW, Would you like a class in AU to be about this? If so, let me know.