Thursday, April 25, 2013

Creating Alignments With the .NET API

This post is about creating alignments with the API. I’ve decided I suck at getting code to show up correctly in Blogger, so I’m going to use pictures from now on for the code.

The first example creates an alignment from a polyline.


The code gets the default settings and then creates an alignment from the polyline. It also checks to see if the alignment name already exists. If it does exist then it appends a number behind it, just like Civil 3D does.


I’m going to call my AlignmentNameExists my secret sauce, so I’m not going to share it. It should be easy to figure out, just go through all of the alignments in the drawing and see if it exists. If you are for sure the name doesn’t already exist you can skip the code.

I was going to go through some of the other options, but noticed I don’t have any code handy for the other methods. They should be fairly easy to figure out since they follow the same pattern as the code above.

No comments:


Blog Widget by LinkWithin