Thursday, June 09, 2011

Extract All Surface Boundaries

Ever want to extract a bunch of surface boundaries? I have, but I don't really want to select each and every surface. Here is some code for VBA that will automate the process.

Sub ExtractBoundaries()
Dim oAcadObject As AcadObject
For Each oAcadObject In ThisDrawing.ModelSpace
If (TypeOf oAcadObject Is AeccTinSurface) Then
Dim oSurf As AeccTinSurface
Set oSurf = oAcadObject

oSurf.ExtractBorder aeccDisplayOrientationPlan

End If

End Sub

It's similar code for vb.NET.


Neron said...

Can you present a situation for which one would want to extract out the boundaries from a file? For use in another file? And if so, how are they going to be accessible? As linework? Thanks,

Christopher Fugitt said...

Sure, I have a levee corridor surface and then I have to grade in ramps for access to the top of it. I then need to create a FG surface that combines the levee surface and the ramps. In order to create an outer boundary I would then need to extract the boundaries of the levee and the ramps and then using the LineWorkShrinkwrap command combine the boundaries into one polyline that I can then add to the combined surface as a final boundary.

neil jones said...

This is something that I'd find very useful. How do I get it into C3D 2012 to be able to use it??

Christopher Fugitt said...

Neil you can purchase and download the app from this page or you can download VBA from the Autodesk site and paste the above code into one of the Sample Civil 3D VBA code files.


Blog Widget by LinkWithin