We can add
boundaries to Civil 3D Surface object using the SurfaceDefinitionBoundaries
class; this class encapsulates the boundary operation list for a surface. Note
that, operations are stored in the order they are performed on the surface.
SurfaceDefinitionBoundaries class has overloaded function AddBoundaries(). In
the following example we will see how to add boundaries to a surface from a
collection of entity ObjectIds using SurfaceOperationAddBoundary
AddBoundaries(ObjectIdCollection boundaryEntities , double midOrdinateDistance, SurfaceBoundaryType boundaryType, bool
useNonDestructiveBreakline )
There are few
important notes on this API mentioned in Civil 3D .NET API Reference document
which I am highlighting below -
- The parameter
useNonDestructiveBreakline is ignored for a GridVolumeSurface or TinSurface
with a DataClip boundary type. - When creating
the DataClip/Outer boundary, the first ObjectId in boundaryEntities is used,
and any other ObjectIds in the collection are ignored. - The first
boundary in the boundaryEntities should be closed when creating a DataClip
boundary.
And here is a
C# .NET code snippet on usage of this API -
try
{
TinSurface surface = trans.GetObject(surfaceId, OpenMode.ForWrite) as TinSurface;
// Add the selected polyline's ObjectId to a collection
ObjectIdCollection boundaryEntities = new ObjectIdCollection();
boundaryEntities.Add(plineId);
// Access the BoundariesDefinition object from the surface object
SurfaceDefinitionBoundaries surfaceBoundaries = surface.BoundariesDefinition;
// now add the boundary to the surface
surfaceBoundaries.AddBoundaries(boundaryEntities, 1.0, SurfaceBoundaryType.Outer, true);
trans.Commit();
}
Hope this is useful to you!

Leave a Reply