Originally Posted by
stephen.coff
Well the polyline has been drawn using code though also using the pline command. That said the polyline isn't a straight simple line it could be straight though could be a filleted zig zagof a polyline. This is where I am stuck, I don't know how to extract the next point with code.
Don't worry about that. This will locate the point 200 units from the endpoint of the polyline, regardless of the number of segments.
Code:
(setq obj (vlax-ename->vla-object (car (entsel))))
(vlax-curve-GetPointAtDist obj (- (vla-get-Length obj) 200.0))
Now I guess the question is, how to shorten the polyline to this point.
This works for me...
Code:
(command "._lengthen" "_De" "-200" (vlax-curve-getendpoint obj))
...although I suspect you would have problems if there was another entity at the exact same coordinates as the endpoint of the polyline....
Too bad the "length" property is RO....
I suppose you could iterate the polyline coordinates backwards from the endpoint until you reach the point calculated in the first code snip... then reconstruct the polyline using all the original points up to the new point.
Check out also (vla-get-Coordinates)