SurfaceDefinitionBoundariesAddBoundaries(ObjectIdCollection, Double, SurfaceBoundaryType, Boolean) Method

Adds boundaries to the surface from a collection of entity ObjectIds.

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

Parameters

boundaryEntities  ObjectIdCollection
A collection that contains the ObjectIds of entities used to define the 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
Specifies the surface boundary type.
useNonDestructiveBreakline  Boolean
Spefifies whether to use non-destructive breaklines when the boundary is created.

Return Value

SurfaceOperationAddBoundary
Exceptions
ExceptionCondition
ArgumentException Thrown when:
  1. There is invalid ObjectId in the boundaryEntities collection.
  2. midOrdinateDistance <= 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. When creating the DataClip/Outer boundary, the first ObjectId in boundaryEntities is used, and any other ObjectIds in the collection are ignored.
  3. The first boundary in the boundaryEntities should be closed when creating a DataClip boundary.
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