CogoPointRenumber(UInt32) Method |
Renumbers the PointNumber to a new value.
Namespace: Autodesk.Civil.DatabaseServicesAssembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.8.0.292
Syntaxpublic uint Renumber(
uint newPointNumber
)
Public Function Renumber (
newPointNumber As UInteger
) As UInteger
public:
unsigned int Renumber(
unsigned int newPointNumber
)
Parameters
- newPointNumber UInt32
-
Return Value
UInt32
The new PointNumber. If a CogoPoint with newPointNumber already exists, this method will try to find another new valid PointNumber,
using the point collision resolution settings in the CreatePoints command settings.
Therefore the return value may differ from the newPointNumber passed to the method.
ExceptionsException | Condition |
---|
InvalidOperationException |
Thrown when the CogoPoint is a ProjectPoint and is not checked out, and the "Allow Checked-In Points to be Modified" setting is false.
|
Example 1
2
3
4Point3dCollection pts = getRandomPoints();
5ObjectIdCollection addedPointsIds = _civildoc.CogoPoints.Add(pts, "Example Point", false);
6
7ObjectId firstCogoPointId = addedPointsIds[0];
8ObjectId secondCogoPointId = addedPointsIds[1];
9CogoPoint firstPoint = firstCogoPointId.GetObject(OpenMode.ForWrite) as CogoPoint;
10CogoPoint secondPoint = secondCogoPointId.GetObject(OpenMode.ForWrite) as CogoPoint;
11
12_editor.WriteMessage("\nInitial point number values:");
13_editor.WriteMessage("\n- First COGO Point = {0}", firstPoint.PointNumber);
14_editor.WriteMessage("\n- Second COGO Point = {0}", secondPoint.PointNumber);
15
16
17
18
19try
20{
21 firstPoint.PointNumber = secondPoint.PointNumber;
22}
23catch (ArgumentException ex)
24{
25 string msg = String.Format("\n{0}", ex.Message);
26 _editor.WriteMessage(msg);
27}
28_editor.WriteMessage("\nAfter trying to set the PointNumber property (with collision):");
29_editor.WriteMessage("\n- First COGO Point = {0}", firstPoint.PointNumber);
30_editor.WriteMessage("\n- Second COGO Point = {0}", secondPoint.PointNumber);
31
32
33
34
35
36firstPoint.Renumber(secondPoint.PointNumber);
37_editor.WriteMessage("\nAfter using the Renumber() method:");
38_editor.WriteMessage("\n- First COGO Point = {0}", firstPoint.PointNumber);
39_editor.WriteMessage("\n- Second COGO Point = {0}", secondPoint.PointNumber);
40
41
42
43
44if (_civildoc.CogoPoints.SetPointNumber(firstCogoPointId, secondPoint.PointNumber) == ObjectId.Null)
45 _editor.WriteMessage("\nSetPointNumber() duplicate number.");
46
47_editor.WriteMessage("\nAfter using SetPointNumber() in CogoPointCollection:");
48_editor.WriteMessage("\n- First COGO Point = {0}", firstPoint.PointNumber);
49_editor.WriteMessage("\n- Second COGO Point = {0}", secondPoint.PointNumber);
50
51
52
53
1
2
3
4Dim pts As Point3dCollection = getRandomPoints()
5Dim addedPointsIds As ObjectIdCollection = _civildoc.CogoPoints.Add(pts, "Example Point")
6
7Dim firstCogoPointId As ObjectId = addedPointsIds(0)
8Dim secondCogoPointId As ObjectId = addedPointsIds(1)
9Dim firstPoint As CogoPoint = TryCast(firstCogoPointId.GetObject(OpenMode.ForWrite), CogoPoint)
10Dim secondPoint As CogoPoint = TryCast(secondCogoPointId.GetObject(OpenMode.ForWrite), CogoPoint)
11
12_editor.WriteMessage(vbLf & "Initial point number values:")
13_editor.WriteMessage(vbLf & "- First COGO Point = {0}", firstPoint.PointNumber)
14_editor.WriteMessage(vbLf & "- Second COGO Point = {0}", secondPoint.PointNumber)
15
16
17
18
19Try
20 firstPoint.PointNumber = secondPoint.PointNumber
21Catch ex As ArgumentException
22 Dim msg As String = [String].Format(vbLf & "{0}", ex.Message)
23 _editor.WriteMessage(msg)
24End Try
25_editor.WriteMessage(vbLf & "After trying to set the PointNumber property (with collision):")
26_editor.WriteMessage(vbLf & "- First COGO Point = {0}", firstPoint.PointNumber)
27_editor.WriteMessage(vbLf & "- Second COGO Point = {0}", secondPoint.PointNumber)
28
29
30
31
32
33firstPoint.Renumber(secondPoint.PointNumber)
34_editor.WriteMessage(vbLf & "After using the Renumber() method:")
35_editor.WriteMessage(vbLf & "- First COGO Point = {0}", firstPoint.PointNumber)
36_editor.WriteMessage(vbLf & "- Second COGO Point = {0}", secondPoint.PointNumber)
37
38
39
40
41If _civildoc.CogoPoints.SetPointNumber(firstCogoPointId, secondPoint.PointNumber) = ObjectId.Null Then
42 _editor.WriteMessage(vbLf & "SetPointNumber() duplicate number.")
43End If
44
45_editor.WriteMessage(vbLf & "After using SetPointNumber() in CogoPointCollection:")
46_editor.WriteMessage(vbLf & "- First COGO Point = {0}", firstPoint.PointNumber)
47_editor.WriteMessage(vbLf & "- Second COGO Point = {0}", secondPoint.PointNumber)
48
49
50
51
No code example is currently available or this language may not be supported.
See Also