CogoPointCollectionSetElevationBySurface(IEnumerableObjectId, ObjectId) Method

Sets the elevation for multiple CogoPoints with elevation values obtained from a specified surface.

Namespace: Autodesk.Civil.DatabaseServices
Assembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.8.0.292
Syntax
public ObjectIdCollection SetElevationBySurface(
	IEnumerable<ObjectId> pointIds,
	ObjectId surfaceId
)

Parameters

pointIds  IEnumerableObjectId
A list of ObjectIds of the points you want to set the elevation for.
surfaceId  ObjectId
The ObjectId of the Surface object you want to get the elevation from.

Return Value

ObjectIdCollection
An ObjectIdCollection containing the CogoPoints for which the elevation has been set successfully.
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