Adds boundaries to the surface from a Point2dCollection.
Namespace: Autodesk.Civil.DatabaseServices
Assembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.8.0.280
Syntax
C#
public SurfaceOperationAddBoundary AddBoundaries( Point2dCollection points, double midOrdinateDistance, SurfaceBoundaryType boundaryType, bool useNonDestructiveBreakline )
VB
Public Function AddBoundaries ( points As Point2dCollection, midOrdinateDistance As Double, boundaryType As SurfaceBoundaryType, useNonDestructiveBreakline As Boolean ) As SurfaceOperationAddBoundary
C++
public: SurfaceOperationAddBoundary^ AddBoundaries( Point2dCollection^ points, double midOrdinateDistance, SurfaceBoundaryType boundaryType, bool useNonDestructiveBreakline )
Parameters
- points Point2dCollection
- A collection that contains 2d points used to define surface boundaries.
- midOrdinateDistance Double
- When the boundary is defined from a polyline with curves, the midOrdinateDistance value is used to tessellate the arc segments of the boundary. This value must be greater than 0.
- boundaryType SurfaceBoundaryType
- Specifies the surface boundary type.
- useNonDestructiveBreakline Boolean
- Spefifies whether to use non-destructive breaklines when creating the boundary.
Return Value
SurfaceOperationAddBoundaryExceptions
Exception | Condition |
---|---|
ArgumentException |
Thrown when:
|
InvalidOperationException | Thrown when boundaryType is DataClip, and the SurfaceDefinitionBoundaries is obtained from a GridVolumeSurface or TinVolumeSurface. |
Remarks
- The parameter useNonDestructiveBreakline is ignored for a GridVolumeSurface or TinSurface with a DataClip boundary type.
- For a DataClip boundary type, the order of points in the collection should define a closed polygon, and should not create edges that cross. The first and last points must be the same.
Example
C#
1// Setup: create and populate a surface with 100 random points: 2ObjectId surfaceId = TinSurface.Create(_acaddoc.Database, "Example Surface"); 3TinSurface surface = surfaceId.GetObject(OpenMode.ForWrite) as TinSurface; 4Point3dGenerator p3dgen = new Point3dGenerator(); 5Point3dCollection locations = p3dgen.AsPoint3dCollection(); 6surface.AddVertices(locations); 7 8SurfaceDefinitionBoundaries surfaceBoundaries = surface.BoundariesDefinition; 9write(String.Format("Existing surface boundary definitions: {0} \n", surfaceBoundaries.Count)); 10 11// Define a polygon with 2d points to use as a boundary 12// 13Point2dCollection point2dBoundary = new Point2dCollection(); 14point2dBoundary.Add(new Point2d(10, 10)); 15point2dBoundary.Add(new Point2d(10, 90)); 16point2dBoundary.Add(new Point2d(90, 90)); 17point2dBoundary.Add(new Point2d(90, 10)); 18// point2dBoundary.Add(new Point2d(10, 10)); // required for SurfaceBoundaryType.DataClip 19 20surfaceBoundaries.AddBoundaries(point2dBoundary, 1.0, SurfaceBoundaryType.Outer, true); 21 22// Define a polygon with 3d points to use as a boundary 23// 24Point3dCollection point3dBoundary = new Point3dCollection(); 25point3dBoundary.Add(new Point3d(20, 20, 0)); 26point3dBoundary.Add(new Point3d(20, 30, 0)); 27point3dBoundary.Add(new Point3d(30, 30, 0)); 28point3dBoundary.Add(new Point3d(30, 20, 0)); 29// point3dBoundary.Add(new Point3d(20, 20, 0)); // required for SurfaceBoundaryType.DataClip 30surfaceBoundaries.AddBoundaries(point3dBoundary, 1.0, SurfaceBoundaryType.Hide, true); 31 32// Define a polygon to use as a boundary 33// 34Database acadDb = _acaddoc.Database; 35BlockTable blockTable = tr.GetObject(acadDb.BlockTableId, OpenMode.ForRead) as BlockTable; 36BlockTableRecord blockTableRec = tr.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; 37 38Polyline polyline = new Polyline(); 39polyline.SetDatabaseDefaults(); 40polyline.AddVertexAt(0, new Point2d(70, 70), 0, 0, 0); 41polyline.AddVertexAt(1, new Point2d(70, 110), 0, 0, 0); 42polyline.AddVertexAt(2, new Point2d(110, 110), 0, 0, 0); 43polyline.AddVertexAt(3, new Point2d(110, 70), 0, 0, 0); 44polyline.Closed = true; 45blockTableRec.AppendEntity(polyline); 46tr.AddNewlyCreatedDBObject(polyline, true); 47 48// Add the polyline's ObjectId to a collection 49ObjectIdCollection verticeIds = new ObjectIdCollection(); 50verticeIds.Add(polyline.ObjectId); 51 52surfaceBoundaries.AddBoundaries(verticeIds, 1.0, SurfaceBoundaryType.Show, true); 53 54surface.Rebuild();
VB
1' Setup: create and populate a surface with 100 random points: 2Dim surfaceId As ObjectId = TinSurface.Create(_acaddoc.Database, "Example Surface") 3Dim surface As TinSurface = TryCast(surfaceId.GetObject(OpenMode.ForWrite), TinSurface) 4Dim p3dgen As New Point3dGenerator() 5Dim locations As Point3dCollection = p3dgen.AsPoint3dCollection() 6surface.AddVertices(locations) 7 8Dim surfaceBoundaries As SurfaceDefinitionBoundaries = surface.BoundariesDefinition 9write([String].Format("Existing surface boundary definitions: {0} " & vbLf, surfaceBoundaries.Count)) 10 11' Define a polygon with 2d points to use as a boundary 12' 13Dim point2dBoundary As New Point2dCollection() 14point2dBoundary.Add(New Point2d(10, 10)) 15point2dBoundary.Add(New Point2d(10, 90)) 16point2dBoundary.Add(New Point2d(90, 90)) 17point2dBoundary.Add(New Point2d(90, 10)) 18' point2dBoundary.Add(new Point2d(10, 10)); // required for SurfaceBoundaryType.DataClip 19 20surfaceBoundaries.AddBoundaries(point2dBoundary, 1.0, SurfaceBoundaryType.Outer, True) 21 22' Define a polygon with 3d points to use as a boundary 23' 24Dim point3dBoundary As New Point3dCollection() 25point3dBoundary.Add(New Point3d(20, 20, 0)) 26point3dBoundary.Add(New Point3d(20, 30, 0)) 27point3dBoundary.Add(New Point3d(30, 30, 0)) 28point3dBoundary.Add(New Point3d(30, 20, 0)) 29' point3dBoundary.Add(new Point3d(20, 20, 0)); // required for SurfaceBoundaryType.DataClip 30surfaceBoundaries.AddBoundaries(point3dBoundary, 1.0, SurfaceBoundaryType.Hide, True) 31 32' Define a polygon to use as a boundary 33' 34Dim acadDb As Database = _acaddoc.Database 35Dim blockTable As BlockTable = TryCast(tr.GetObject(acadDb.BlockTableId, OpenMode.ForRead), BlockTable) 36Dim blockTableRec As BlockTableRecord = TryCast(tr.GetObject(blockTable(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord) 37 38Dim polyline As New Polyline() 39polyline.SetDatabaseDefaults() 40polyline.AddVertexAt(0, New Point2d(70, 70), 0, 0, 0) 41polyline.AddVertexAt(1, New Point2d(70, 110), 0, 0, 0) 42polyline.AddVertexAt(2, New Point2d(110, 110), 0, 0, 0) 43polyline.AddVertexAt(3, New Point2d(110, 70), 0, 0, 0) 44polyline.Closed = True 45blockTableRec.AppendEntity(polyline) 46tr.AddNewlyCreatedDBObject(polyline, True) 47 48' Add the polyline's ObjectId to a collection 49Dim verticeIds As New ObjectIdCollection() 50verticeIds.Add(polyline.ObjectId) 51 52surfaceBoundaries.AddBoundaries(verticeIds, 1.0, SurfaceBoundaryType.Show, True)