Ad

Monday, January 12, 2009

VBA - Add Pipes to a Profile View

The API for Civil 3D, as far as I know, doesn't have way to add pipes or structures to a profile view. There is a possible workaround using AutoCAD's SendCommand. The code would look something like this:

ZoomExtents
ThisDrawing.SendCommand ("AddNetworkPartsToProf " & "3741.54989837,3396.84999773 " & " " & _
"4077.571130249153,3497.898627605000 ")
ZoomExtents

The first ZoomExtents is to refresh model space because if the graphics aren't current AutoCAD won't recognize the newly created pipe/structure or profile view. The next part sends the commands to the command line. The AddNetworkPartsToProf is the command to in Civil 3D to add pipe/structures to a profile view. The next part is the coordinate location of where a pipe/structure is located in the drawing and the last part is the point in the drawing where a profile view may be selected. The last ZoomExtents is just for show. The & symbol joins text strings together.

5 comments:

Thomas Gail Haws said...

Now that Autodesk appears to be turning away from VBA, not shipping with the latest versions (quite a strong message), what is your take?

Tom Haws

Christopher Fugitt said...

It looks like a .NET language is the way to go, unfortunately it takes a little more knowledge to use.

JPL said...

Based on a nice combo of VBA, ASCII and standard AutoLisp - I can "extract" the desired pipes/structures, get alignment name, station and offset to a comma delimited file... then simply open my Profile Base (different drawing) and read the ASCII...into the applicable Profile Views associated with the parent alignment...coool...

Great to be back on the scene! Thanks for the hint

--Jeff

JPL said...

Based on a nice combo of VBA, ASCII and standard AutoLisp - I can "extract" the desired pipes/structures, get alignment name, station and offset to a comma delimited file... then simply open my Profile Base (different drawing) and read the ASCII...into the applicable Profile Views associated with the parent alignment...coool...

Great to be back on the scene! Thanks for the hint

--Jeff

JPL said...

Based on a nice combo of VBA, ASCII and standard AutoLisp - I can "extract" the desired pipes/structures, get alignment name, station and offset to a comma delimited file... then simply open my Profile Base (different drawing) and read the ASCII...into the applicable Profile Views associated with the parent alignment...coool...

Great to be back on the scene! Thanks for the hint

--Jeff

LinkWithin

Blog Widget by LinkWithin

Ad