Can I delete a vertex from a lwpolyline with VBA?

Can I delete a vertex from a lwpolyline with VBA?

markc0826
Contributor Contributor
880 Views
3 Replies
Message 1 of 4

Can I delete a vertex from a lwpolyline with VBA?

markc0826
Contributor
Contributor

when I comand to draw the polyline like: 0,0 -> 10,0 -> 10,15 -> c

I can get the property of closed is True

but if I type : 0,0 -> 10,0 -> 10,15 ->0,0

I get the of closed is False becase 1st point and last point are overlaped.

so how to delete one of endpoints with VBA?

 

Thanks for advicing..

0 Likes
Accepted solutions (1)
881 Views
3 Replies
Replies (3)
Message 2 of 4

Hallex
Advisor
Advisor
Accepted solution

Not sure about if this is what you need but

you can to try this code, found it on forum

 

Option Explicit

Sub RemoveLast()

 Dim oEnt As AcadEntity
   Dim oPline As AcadLWPolyline
   Dim pickPnt As Variant
   Dim varCoords As Variant
   ThisDrawing.Utility.GetEntity oEnt, pickPnt, "Select a polyline: "
If TypeOf oEnt Is AcadLWPolyline Then
Set oPline = oEnt
   varCoords = oPline.Coordinates
   ReDim Preserve varCoords(UBound(varCoords) - 2)
   oPline.Coordinates = varCoords
End If

End Sub

 

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 4

markc0826
Contributor
Contributor

The point is Redim the coords....

Thank you for your help..^^

0 Likes
Message 4 of 4

Hallex
Advisor
Advisor

You're welcome

Cheers 🙂

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes