Extracts the surface contour information from the terrain surface at a specified elevation.

Namespace: Autodesk.Civil.DatabaseServices
Assembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.4.2516.0

Syntax

C#
public ObjectIdCollection ExtractContoursAt(
	double elevation
)
Visual Basic
Public Function ExtractContoursAt ( _
	elevation As Double _
) As ObjectIdCollection
Visual C++
public:
virtual ObjectIdCollection^ ExtractContoursAt(
	double elevation
) sealed

Parameters

elevation
Type: System..::..Double
The specified elevation.

Return Value

An ObjectIdCollection of the extracted entities. The extracted entities are Polyline objects. If the surface has no contour information, this method returns an empty ObjectIdCollection.

Implements

ITerrainSurface..::..ExtractContoursAt(Double)

Examples

CopyC#
 1// Setup: creates a new, random surface
 2// 
 3TinSurface surface = CreateRandomSurface("Example Surface");
 4
 5// Extracted contours become AutoCAD objects (Polylines) and can be
 6// inspected and manipulated.
 7// 
 8ObjectIdCollection contours;
 9double contourElevation = 50.0;
10contours = surface.ExtractContoursAt(contourElevation);
11write("# of extracted contours: " + contours.Count + "\n");
12int totalVertices = 0;
13for (int i = 0; i < contours.Count; i++)
14{
15    ObjectId contourId = contours[i];
16
17    // Contours are lightweight Polyline objects:
18    Polyline contour = contourId.GetObject(OpenMode.ForRead) as Polyline;
19    write(String.Format("Contour #{0} length:{1}, # of vertices:{2}\n",
20        i, contour.Length, contour.NumberOfVertices));
21    totalVertices += contour.NumberOfVertices;
22}
23
24// Extract contours with smoothing:
25contours = surface.ExtractContoursAt(contourElevation, ContourSmoothingType.AddVertices, 10);
26int totalVerticesSmoothed = 0;
27foreach (ObjectId contourId in contours)
28{
29    Polyline contour = contourId.GetObject(OpenMode.ForRead) as Polyline;
30    totalVerticesSmoothed += contour.NumberOfVertices;
31}
32
33// Compare smoothing by adding vertices:
34write(String.Format("Effects of smoothing:\n  total vertices no smoothing: {0}\n  total vertices with smoothing: {1}\n",
35    totalVertices, totalVerticesSmoothed));
CopyVB.NET
1!ERROR: See log file!

See Also