Gets the sampled points along a curve entity.

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

Syntax

C#
public Point3dCollection SampleElevations(
	ObjectId curveId
)
Visual Basic
Public Function SampleElevations ( _
	curveId As ObjectId _
) As Point3dCollection
Visual C++
public:
virtual Point3dCollection^ SampleElevations(
	ObjectId curveId
) sealed

Parameters

curveId
Type: ObjectId
An ObjectId of Autodesk.AutoCAD.DatabaseServices.Curve. The curve can be a line, arc and so on.

Implements

ITerrainSurface..::..SampleElevations(ObjectId)

Examples

CopyC#
 1// Setup: create a new, random surface
 2// 
 3ObjectId surfaceId = TinSurface.Create(_acaddoc.Database, "Example Surface");
 4TinSurface surface = surfaceId.GetObject(OpenMode.ForWrite) as TinSurface;
 5Point3dGenerator p3dgen = new Point3dGenerator();
 6Point3dCollection locations = p3dgen.AsPoint3dCollection();
 7surface.AddVertices(locations);
 8
 9// Define a polyline to sample elevations along
10// SampleElevations takes the ObjectId of any object derived from
11// Autodesk.AutoCAD.DatabaseServices.Curve, including Arc, Line, Polyline, and Spline
12// 
13Database acadDb = _acaddoc.Database;
14BlockTable blockTable = tr.GetObject(acadDb.BlockTableId, OpenMode.ForRead) as BlockTable;
15BlockTableRecord blockTableRec = tr.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
16
17Polyline polyline = new Polyline();
18polyline.SetDatabaseDefaults();
19polyline.AddVertexAt(0, new Point2d(10, 10), 0, 0, 0);
20polyline.AddVertexAt(1, new Point2d(20, 10), 0, 0, 0);
21polyline.AddVertexAt(2, new Point2d(40, 35), 0, 0, 0);
22polyline.AddVertexAt(3, new Point2d(60, 40), 0, 0, 0);
23polyline.Closed = false;
24blockTableRec.AppendEntity(polyline);
25tr.AddNewlyCreatedDBObject(polyline, true);
26
27// Sample elevations at each intersection between triangle/grid edges and
28// the curve:
29// 
30Point3dCollection samples = surface.SampleElevations(polyline.ObjectId);
31foreach (Point3d point in samples)
32{
33    write(String.Format("Elevation at {0},{1}:{2}\n",
34        point.X, point.Y, point.Z));
35}
CopyVB.NET
1!ERROR: See log file!

Exceptions

ExceptionCondition
System..::..ArgumentException Thrown when curveId is not a valid ObjectId of a Curve object.
Autodesk.Civil..::..SurfaceException Thrown when the method can't find the intersection point with the surface.

See Also