Public Shared Function getAllVertices(ByVal ent As Polyline) As Point2dCollection Dim verCollection As Point2dCollection = New Point2dCollection() Dim vertex As Point2d Dim i As Integer = 0 For i = 0 To ent.NumberOfVertices - 1 vertex = ent.GetPoint2dAt(i) verCollection.Add(vertex) Next Return verCollection End Function
Thank you for the response.
In fact, I need to read vertices of 3D Polylines and have problems finding NumberOfVertices property...
Could you suggest me in this regard? Thanx,
Depending on circumstances, in the past I have used Polyline3d.GetStretchPoints. You pass it an empty Point3dCollection and it fills the collection.
That said, it doesn't work when the polyline is not db resident, and I'm not sure what it would do if the Polyline was not type SimplePoly, so, this is another way.
For I as Integer = 0 to Poly3d.EndParam
This is a way to do it:
Sub Read3DPolyline(ByVal poly3d As Polyline3d)
'' Start a transaction
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
Dim vId As ObjectId
For Each vId In poly3d
Dim v3d As PolylineVertex3d = acTrans.GetObject(vId, OpenMode.ForRead)
acDoc.Editor.WriteMessage(vbCrLf + v3d.Position.ToString())