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

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

Syntax

C#
public ObjectIdCollection SetElevationBySurface(
	IEnumerable<ObjectId> pointIds,
	ObjectId surfaceId
)
Visual Basic
Public Function SetElevationBySurface ( _
	pointIds As IEnumerable(Of ObjectId), _
	surfaceId As ObjectId _
) As ObjectIdCollection
Visual C++
public:
ObjectIdCollection^ SetElevationBySurface(
	IEnumerable<ObjectId>^ pointIds, 
	ObjectId surfaceId
)

Parameters

pointIds
Type: System.Collections.Generic..::..IEnumerable<(Of <(<'ObjectId>)>)>
A list of ObjectIds of the points you want to set the elevation for.
surfaceId
Type: ObjectId
The ObjectId of the Surface object you want to get the elevation from.

Return Value

An ObjectIdCollection containing the CogoPoints for which the elevation has been set successfully.

Examples

CopyC#
 1// _civildoc is the active CivilDocument instance.
 2CogoPointCollection cogoPoints = _civildoc.CogoPoints;
 3ObjectId pointId = cogoPoints.Add(new Point3d(100, 100, 0));
 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");
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));
CopyVB.NET
 1' _civildoc is the active CivilDocument instance.
 2Dim cogoPoints As CogoPointCollection = _civildoc.CogoPoints
 3Dim pointId As ObjectId = cogoPoints.Add(New Point3d(100, 100, 0))
 4
 5' Set elevation for a single point:
 6If ObjectId.Null = cogoPoints.SetElevationBySurface(pointId, tinSurfaceId) Then
 7    write("SetElevationBySurface failed, perhaps the point is outside the surface?" & vbLf)
 8Else
 9    Dim point As CogoPoint = TryCast(pointId.GetObject(OpenMode.ForRead), CogoPoint)
10    write("Point's new elevation from surface: " + point.Elevation)
11End If
12
13' Create multiple points to set elevation for:
14Dim pointCollection As New Point3dCollection()
15pointCollection.Add(New Point3d(100, 110, 0))
16pointCollection.Add(New Point3d(110, 100, 0))
17Dim pointIdCollection As ObjectIdCollection = cogoPoints.Add(pointCollection, "Example Points")
18Dim pointIdList As New List(Of ObjectId)()
19For Each id As ObjectId In pointIdCollection
20    pointIdList.Add(id)
21Next
22
23' Set elevation for multiple points: 
24Dim successfullySetPoints As ObjectIdCollection = cogoPoints.SetElevationBySurface(pointIdList, tinSurfaceId)

See Also