SurfaceDefinitionBoundariesAddBoundaries(Point3dCollection, Double, SurfaceBoundaryType, Boolean) Method

Adds boundaries to the surface from a Point3dCollection.

Namespace: Autodesk.Civil.DatabaseServices
Assembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.8.0.292
Syntax
public SurfaceOperationAddBoundary AddBoundaries(
	Point3dCollection points,
	double midOrdinateDistance,
	SurfaceBoundaryType boundaryType,
	bool useNonDestructiveBreakline
)

Parameters

points  Point3dCollection
A collection that contains 3d 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.
boundaryType  SurfaceBoundaryType
Defines the surface boundary type.
useNonDestructiveBreakline  Boolean
Spefifies whether use to non-destructive breaklines when creating the boundary.

Return Value

SurfaceOperationAddBoundary
Exceptions
ExceptionCondition
ArgumentException Thrown when:
  1. The number of points is less than three.
  2. The midOrdinateDistance parameter is less than or equal to 0.0.
InvalidOperationException Thrown when boundaryType is DataClip, and the SurfaceDefinitionBoundaries is obtained from a GridVolumeSurface or TinVolumeSurface.
Remarks
  1. The parameter useNonDestructiveBreakline is ignored for a GridVolumeSurface or TinSurface with a DataClip boundary type.
  2. 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
 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();
See Also