Extracts the surface contour information from the terrain surface at a specified elevation interval with smoothing.
Namespace: Autodesk.Civil.DatabaseServicesAssembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.4.2516.0
Syntax
C# |
---|
public ObjectIdCollection ExtractContours(
double interval,
ContourSmoothingType smoothType,
int smoothFactor
) |
Visual Basic |
---|
Public Function ExtractContours ( _
interval As Double, _
smoothType As ContourSmoothingType, _
smoothFactor As Integer _
) As ObjectIdCollection |
Visual C++ |
---|
public:
virtual ObjectIdCollection^ ExtractContours(
double interval,
ContourSmoothingType smoothType,
int smoothFactor
) sealed |
Parameters
- interval
- Type: System..::..Double
The specified elevation interval.
- smoothType
- Type: Autodesk.Civil.DatabaseServices.Styles..::..ContourSmoothingType
Currently, smoothType can be AddVertices only.
- smoothFactor
- Type: System..::..Int32
smoothFactor should be in the range [0, 10]. A value of 10 generates the smoothest contours.
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..::..ExtractContours(Double, ContourSmoothingType, Int32)
Examples
CopyC#
1
2
3TinSurface surface = CreateRandomSurface("Example Surface");
4
5
6ObjectIdCollection contours;
7double contourInterval = 50.0;
8contours = surface.ExtractContours(contourInterval);
9write("# of extracted contours: " + contours.Count + "\n");
10int totalVertices = 0;
11for (int i = 0; i < contours.Count; i++)
12{
13 ObjectId contourId = contours[i];
14
15
16 Polyline contour = contourId.GetObject(OpenMode.ForRead) as Polyline;
17 write(String.Format("Contour #{0} length:{1}, # of vertices:{2}\n",
18 i, contour.Length, contour.NumberOfVertices));
19 totalVertices += contour.NumberOfVertices;
20}
21
22
23contours = surface.ExtractContours(contourInterval, ContourSmoothingType.AddVertices, 10);
24int totalVerticesSmoothed = 0;
25foreach (ObjectId contourId in contours)
26{
27 Polyline contour = contourId.GetObject(OpenMode.ForRead) as Polyline;
28 totalVerticesSmoothed += contour.NumberOfVertices;
29}
30
31
32write(String.Format("Effects of smoothing:\n total vertices no smoothing: {0}\n total vertices with smoothing: {1}\n",
33 totalVertices, totalVerticesSmoothed));
34
35
36double startRange = 130.0;
37double endRange = 190.0;
38contours = surface.ExtractContours(contourInterval, startRange, endRange);
39
40write("# of extracted contours in range: " + contours.Count + "\n");
41
42
43
44
CopyVB.NET
Exceptions
Exception | Condition |
---|
System..::..ArgumentException |
Thrown when smoothFactor is not between the range [0, 10].
|
See Also