Get Point on a LWPolyline

Get Point on a LWPolyline

Anonymous
Not applicable
247 Views
1 Reply
Message 1 of 2

Get Point on a LWPolyline

Anonymous
Not applicable
Hello !

We want to place a point on an existing object (e.g. LWPolyline) and measure the distance between the new point and the endpoint.
How is this possible in ACAD?

Thanks for all answers
Martin
0 Likes
248 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
If the user has placed the point and you want the distance, use a distance formula Length = Sqr(dX * dX + dY * dY) for 2d , Length = Sqr((dX * dX) + (dY * dY) + (dZ * dZ)) for 3d.
using the the point.Coordinates property and the poly .Coordinates property ( For a closed pline use 0 and 1 else use the last two, ubound-1 and ubound), for 3d the z value is the elevation and then you translate the xyz from ocs to world.
If you want the user to pick the point as part of your sub, the easy way is to set your snaps (Then you will need to add same error control for escape etc) then ask the user to pick a point. Else you need to do some math
0 Likes