Ad

Saturday, March 28, 2009

EG Surface Creator – Part Deux

In the last post I went over one way to create a formwork for an automated routine to create and EG Surface. In this post I’ll cover how to create a Point Group for all of the EG related point groups to be added to the surface definition. This would be helpful since you wouldn’t need to have the point group exist in your template or a have a template specifically for an EG surface. The first thing that needs to be done is to create a Private Function that will create the point group. I also added code to start a transaction with the drawing’s database and the error catching framework.

image

Next I need to create variables for a PointGroups object, name string, and PointGroup Object. I’ll use the global Civil 3D object to assign the PointGroups variable to and set the name string equal to “EG Surface Point Group” which is the name I want to call the new point group. Creating a point group just takes using the add method of the PointGroups Object, which requires the name of the point group. Lastly I’ll add the description of the PointGroup.

image

Next we’ll be using the Query Builder portion of the PointGroup Object. To do this I’ll add a Query Statement to the Query Builder using the Add method. Once the line is added we can add the components that make up the query statement.

image

Well the above is kind of verbose, lets see if I can reduce it. By adding some more imports to the top of the code I can reduce the length of the code and get it to fit across the blog page.

image

So what does the Item Properties mean? Well the picture below illustrates what they do. In the code I went alphabetically, but it would probably make more sense to go in the order of they show up in in the Query Builder.

image

I then recreated each and every line for the Query Builder using the same type of code above. Each Query Statement you add gets the next numerical number. So the next line would be 1, the one after it 2 and so on. In the picture below you can see that I ended up going up to 19. You could also have the code get the information from a database or text document so it would be easier to change rather than going into the code each time. If you run the code and get a parse error message after the code is run, that indicates you did something wrong in the code. For instance I forgot to add the Right Parenthesis to end the Query Builder and was getting that error. Next I’ll update the PointGroup Object to refresh it and then commit the changes to the drawing’s database and finally return the PointGroup to code that was done in the last post.

image 

In the next post I’ll go over how to create a TIN surface, which should end this series of posts.

No comments:

LinkWithin

Blog Widget by LinkWithin

Ad