Extract Civil 3D Surface border using .NET API ExtractBorder() – Part I

By Partha Sarkar

In AutoCAD Civil 3D 2013 .NET API, ExtractBorder(SurfaceExtractionSettingsType   settingsType) is a new addition which extracts the surface border from the terrain surface.

You need to specify SurfaceExtractionSettingsType.Plan to extract the border information using the plan visual style settings, or SurfaceExtractionSettingsType.Model to use the model settings.

The extracted entities can be Polyline, Polyline3d, or Face. If the surface has no border information, this method returns an empty ObjectIdCollection.

Here is C# .NET code snippet which demonstrates usage of ExtractBorder() :

TinSurface surface = trans.GetObject(surfaceId, OpenMode.ForRead) as TinSurface;
 
  // Extract Border from the TinSurface
  // The extracted entities can be Polyline, Polyline3d, or Face.
 
  ObjectIdCollection entityIds;                
  entityIds = surface.ExtractBorder(Autodesk.Civil.SurfaceExtractionSettingsType.Plan);
  for (int i = 0; i < entityIds.Count; i++)
  {
      ObjectId entityId = entityIds[i];
      if (entityId.ObjectClass == RXClass.GetClass(typeof(Polyline3d)))
      {
          Polyline3d border = entityId.GetObject(OpenMode.ForWrite) as Polyline3d;
          // Do what you want with the extrated 3d-polyline
      }
 
  }

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading