Share

CogoPointCollection.GetPointByPointNumber Method

Gets the ObjectId of a CogoPoint by a given pointNumber.



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

Syntax

C#

public ObjectId GetPointByPointNumber(
	uint pointNumber
)

VB

Public Function GetPointByPointNumber ( 
	pointNumber As UInteger
) As ObjectId

C++

public:
ObjectId GetPointByPointNumber(
	unsigned int pointNumber
)

Parameters

pointNumber  UInt32
The point number to get.

Return Value

ObjectId
The ObjectId of the CogoPoint with the given pointNumber, if it exists.

Exceptions

ExceptionCondition
ArgumentException Thrown when the collection doesn't contain a CogoPoint with the given pointNumber.

Remarks

Use the Contains(UInt32) method to determine whether the collection contains a point with the given point number.

Example

C#

 1// _civildoc is the active CivilDocument instance.
 2CogoPointCollection cogoPoints = _civildoc.CogoPoints;
 3uint pointNumber = 1;
 4try
 5{
 6    ObjectId pointId = cogoPoints.GetPointByPointNumber(pointNumber);
 7    CogoPoint cogoPoint = pointId.GetObject(OpenMode.ForRead) as CogoPoint;
 8    write("Point number: " + cogoPoint.PointNumber + ", point name: " + cogoPoint.PointName);
 9}
10catch (System.ArgumentException e)
11{
12    write("Document does not contain a point with PointNumber == " + pointNumber);
13}

VB

1' _civildoc is the active CivilDocument instance.
2Dim cogoPoints As CogoPointCollection = _civildoc.CogoPoints
3Dim pointNumber As UInteger = 1
4Try
5    Dim pointId As ObjectId = cogoPoints.GetPointByPointNumber(pointNumber)
6    Dim cogoPoint As CogoPoint = TryCast(pointId.GetObject(OpenMode.ForRead), CogoPoint)
7    write(("Point number: " + cogoPoint.PointNumber & ", point name: ") + cogoPoint.PointName)
8Catch e As System.ArgumentException
9    write("Document does not contain a point with PointNumber == " & pointNumber)

See Also

Reference

Was this information helpful?