Sets the elevation for a single CogoPoint with the elevation obtained from a specified surface.
Namespace: Autodesk.Civil.DatabaseServicesAssembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.3.1717.0
Syntax
C#
public ObjectId SetElevationBySurface( ObjectId pointId, ObjectId surfaceId )
Visual Basic
Public Function SetElevationBySurface ( _ pointId As ObjectId, _ surfaceId As ObjectId _ ) As ObjectId
Visual C++
public: ObjectId SetElevationBySurface( ObjectId pointId, ObjectId surfaceId )
Parameters
- pointId
- Type: ObjectId
The ObjectId of the point 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
If the method succeeds, it returns the same ObjectId pointId passed in. If the method fails, it returns ObjectId.Null.Examples

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));

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)