CogoPointCollectionSetElevationBySurface(ObjectId, ObjectId) Method

Sets the elevation for a single CogoPoint with the elevation obtained from a specified surface.

Namespace: Autodesk.Civil.DatabaseServices
Assembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.7.0.1190
Syntax
public ObjectId SetElevationBySurface(
	ObjectId pointId,
	ObjectId surfaceId
)

Parameters

pointId  ObjectId
The ObjectId of the point you want to set the elevation for.
surfaceId  ObjectId
The ObjectId of the Surface object you want to get the elevation from.

Return Value

ObjectId
If the method succeeds, it returns the same ObjectId pointId passed in. If the method fails, it returns ObjectId.Null.
Example
 1// _civildoc is the active CivilDocument instance.
 2CogoPointCollection cogoPoints = _civildoc.CogoPoints;
 3ObjectId pointId = cogoPoints.Add(new Point3d(100, 100, 0), false);
 4
 5// Set elevation for a single point:
 6if (ObjectId.Null == cogoPoints.SetElevationBySurface(pointId, tinSurfaceId))
 7{ write("SetElevationBySurface failed, perhaps the point is outside the surface?\n"); }
 8else
 9{
10    CogoPoint point = pointId.GetObject(OpenMode.ForRead) as CogoPoint;
11    write("Point's new elevation from surface: " + point.Elevation);
12}
13
14// Create multiple points to set elevation for:
15Point3dCollection pointCollection = new Point3dCollection();
16pointCollection.Add(new Point3d(100, 110, 0));
17pointCollection.Add(new Point3d(110, 100, 0));
18ObjectIdCollection pointIdCollection = cogoPoints.Add(pointCollection, "Example Points", false);
19List<ObjectId> pointIdList = new List<ObjectId>();
20foreach (ObjectId id in pointIdCollection) { pointIdList.Add(id); }
21
22// Set elevation for multiple points: 
23ObjectIdCollection successfullySetPoints = cogoPoints.SetElevationBySurface(pointIdList, tinSurfaceId);
24write(String.Format("Successfully set elevation for {0} of {1} points.\n",
25    pointIdCollection.Count, successfullySetPoints.Count));
See Also