// Extract contours and print information about them:
ObjectIdCollection contours;
double contourInterval = 50.0;
contours = surface.ExtractContours(contourInterval);
write("# of extracted contours: " + contours.Count + "\n");
int totalVertices = 0;
for (int i = 0; i < contours.Count; i++)
{
ObjectId contourId = contours[i];
// Contours are lightweight Polyline objects:
Polyline contour = contourId.GetObject(OpenMode.ForRead) as Polyline;
write(String.Format("Contour #{0} length:{1}, # of vertices:{2}\n", i, contour.Length, contour.NumberOfVertices));
totalVertices += contour.NumberOfVertices;
}