I realize this is probably a VB.NET 101 question, but it's been a couple days and I'm getting frustrated.
I want to get a collection of the Point3D values (coordinates) of a LWPOLYLINE (open or closed), that's it. For example, while in AutoCAD, if I use the LIST command on my polyline, I get the following results;
at point X= 100'-0" Y= 100'-0" Z= 0'-0" at point X= 110'-0" Y= 100'-0" Z= 0'-0" at point X= 110'-0" Y= 105'-0" Z= 0'-0" at point X= 105'-0" Y= 105'-0" Z= 0'-0" at point X= 105'-0" Y= 110'-0" Z= 0'-0" at point X= 100'-0" Y= 110'-0" Z= 0'-0"
I need my sub to give me the coordinates shown above, but cannot find a way to do it. I'm aware of Polyline.GeometryExtents and Polyline.Bounds, but all that does is give me the coordinates of the opposite corners, and doesn't account for the fact a rectangle may be rotated.
Any help is very appreciated.
Thanks in advance,
George
Solved! Go to Solution.
Solved by chiefbraincloud. Go to Solution.
Solved by norman.yuan. Go to Solution.
Look at Polyline.NumberOfVertices property and Polyline.GetPoint3dAt() method.
Assume you have already obtained a valid Polyline object, represented with variable "pline":
Dim pts As New List(of Point3d)()
For i As Integer=0 To pline.NumberOfVertices
pts.Add(pline.GetPoint3dAt(i)
Next
Norman Yuan
For I as Integer = 0 to pline.NumberOfVertices - 1
Details are tiny daggers 😉
Thank you so much norman.yuan & cheifbraincloud, was exactly what I needed.I clicked both responses as the 'accepted solution'.
I thought it would be something simple, and of course, it was, I just couldn't find the solution here or at theswamp.org.
George