ITerrainSurfaceExtractContours(Double, Double, Double, ContourSmoothingType, Int32) Method |
Extracts the surface contour information from the terrain surface at a specified elevation range and interval with smoothing.
Namespace: Autodesk.Civil.DatabaseServicesAssembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.8.0.292
SyntaxObjectIdCollection ExtractContours(
double lowElev,
double highElev,
double interval,
ContourSmoothingType smoothType,
int smoothFactor
)
Function ExtractContours (
lowElev As Double,
highElev As Double,
interval As Double,
smoothType As ContourSmoothingType,
smoothFactor As Integer
) As ObjectIdCollection
ObjectIdCollection^ ExtractContours(
double lowElev,
double highElev,
double interval,
ContourSmoothingType smoothType,
int smoothFactor
)
Parameters
- lowElev Double
-
The specified lower elevation.
- highElev Double
-
The specified high elevation.
- interval Double
-
The specified elevation interval.
- smoothType ContourSmoothingType
-
Currently, smoothType can be AddVertices only.
- smoothFactor Int32
-
smoothFactor should be in the range [0, 10]. A value of 10 generates the smoothest contours.
Return Value
ObjectIdCollection
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.
ExceptionsException | Condition |
---|
ArgumentException |
Thrown when smoothFactor is not between the range [0, 10].
|
Example 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
No code example is currently available or this language may not be supported.
See Also