Ad

Monday, December 15, 2008

How to Create Civil 3D Points for Each TIN Vertex - VBA

The From the Ground Up Blog had a post on how to create COGO points from a surface. The post may be found at this link: http://civilcommunity.autodesk.com/blogs/blog/6/blogpost/10511/

While the method works it could be easier using some programming. The first thing we need to do is make sure we get the Civil 3D document so we can add the points to the drawing.

image

Next lets have the user select the surface they want the points created from. The On Resume Next is error catching in case the user doesn't select an object or escapes out of the command.

image

So now that we have the object we need to make sure it is a surface. Once we make sure the object selected is a surface we need to create the points. To do this we will get the points out of the surface using the Points Method of the surface. The Points is a list (an array) of points in the X,Y,Z format. Next we'll create the Civil 3D points using the AddMultiple method of the Points Object. To use the AddMultiple method we need to give how many points we want created, the list of point locations (an array) in X,Y,Z format and what number to start with in the array. The code below shows the completed code.

image

The above code creates points without a description, so additional work would be needed to add the descriptions. The method should be easier than exploding the surface. The completed code may be found on this page: http://style.civil3dreminders.com/programming

Correction Post: http://blog.civil3dreminders.com/2008/12/how-to-create-civil-3d-points-for-each.html

Wednesday, December 10, 2008

Create Points with Elevation

I was surprised to find when you create a Civil 3D point the manual way it doesn't keep the elevation of the place you select. I guess I've never noticed. Well here's a way to get the program to keep the elevation.

First thing that needs to get done is to get the base Civil 3D objects. I just copied the code from the sample programs that come with Civil 3D.

image 

So now that we have the base Civil 3D objects we can create the rest of the program. First thing that needs to be done is to create a variable that is the Points Object of the drawing. Once we have that we can create a point and add it to the collection, but first we need to prompt the user to select a point. To do this I'll use the GetPoint utility.

image

So that's the basic code to get it to work. As with all my free stuff it needs some error catching, maybe a On Error Resume Next (not the best method), or adding a description to the point or a point number. Maybe in another post. To save you some time, I've posted the code here.

Wednesday, December 03, 2008

Action Recorder

I was pretty disappointed when the Action Recorder first came out. I was hoping for a product more like the macro recorder in the Office products that writes the actions in VBA. I do find the action recorder useful in seeing if you can program the creation of Civil 3D labels by sending the required information to the command line. For instance you can create a General Label by sending the AddNoteLabel to the command line and then send the location where you want the label to be placed (X,Y format).

The AddNoteLabel will use the default style set in the command settings. To change it using VBA use the following line of code:

g_oDocument.Settings.GeneralCommandsSettings.AddNoteLabelSettings.StyleSettings.NoteLabelStyle.Value = "Standard"

Where the "Standard" is the name of the style you want to use and the g_oDocument is the global variable that is used in the sample vba projects that ship with Civil 3D.

Autodesk University Not Even Unplugged

Took a detour from my vacation to go golfing with the EE golf outing on Monday and the AU Blogger's Social on Tuesday. I had a good time in the warm weather of Las Vegas golfing with Matt Kolberg and Dave Dixon. My golf game was horrible as usual, but Dave and Matt are decent golfers. At the AU Blogger's Social got to meet some fellow bloggers as well as some of the Autodesk marketing people. The marketing people where nice enough to arrange to get me a pass to go through the exhibit hall.

Before going to the exhibit hall I was able to sneak into the last part of the Civil 3D Beta Launch. I did sign a non-disclosure form so I can't divulge what I saw, but the features did look like it would be worth upgrading from Civil 3D 2008, the version I'm using at work, to 2010 when it comes out sometime next year. If you want to beta test it you can sign up for it at the myfeedback.autodesk.com website.

The exhibit hall had lots of exhibitors showing their products, but it seemed there was less giveaways this year. I only ended up with one t-shirt, a pack of gum and Playdoh from the Engineered Efficiency booth. The Engineered Efficiency booth had Rock Band set up and seemed to be popular with people standing around watching the action. I got to meet some of my coworkers from around the country. It was also interesting to get recognized this year by people. At the two previous AU's I attended I was more under the radar.

My short visit to AU is done for this year and now I'm headed onto Utah to enjoy the scenery.

Monday, December 01, 2008

SynchronizeReferences

Sometimes at the computer at work the notification of data shortcuts being out of date doesn't work. Without the notification it can be time consuming to update the data shortcuts one at a time. To force an update off all of the data shortcuts in the drawing the SynchronizeReferences command can be used. The command updates all of the data shortcuts in the drawing.

LinkWithin

Blog Widget by LinkWithin

Ad