In this last post of this series of posts I’ll create a function that creates a TIN surface for an EG surface. The first part will get the drawing’s database and create a transaction. Also added is the basic error catching framework.
Next I’ll add the variables for a TIN surface and a variable for the AeccTinCreationData. The TIN creation data object contains all of the information Civil 3D needs to create a surface. It is pretty much all of the information contained in the dialog box when you create a surface in Civil 3D.
Since one of the items needed is a layer that the surface will go on I’ll see if it exists and if it doesn’t I’ll add the surface. Once the layer is created I’ll set the layer color to 9, I could also set all of the other properties of the label, but haven’t.
Next I’ll add the required information to the TinCreationData object. The base layer name is a string value along with the description, layer and name.
The next required information for the TinCreationData is the surface style that is going to be used. In this case I have a style in particular that I want to use. I’ll check to see if it exists in the drawing, if it does then I’ll use it. If the surface style does not exist then I’ll use the first one in the list. I could create the style, but have chosen not to. Then I’ll add the surface style to the TinCreationData as a string with the style’s name.
So now I’ll finally create the surface, commit the changes and return the surface.
So that completes the code necessary to do the task at hand. The compiled code may be found here. Download the file and unzip it. Type Netload at the command line and then CreateEGSurface. You may also find the TIN works also which toggles on/off the TIN triangles of a surface style. You can also add it to a toolbar. A video without sound is below.