@Anonymous wrote:
....i want to know the distance between different points of my polyline which is not straight.
Going back to that.... Maybe you need something like this:
(vl-load-com)
(defun C:DPO ; = Distance between Points on Object
(/ ent p1 p2)
(setq
ent (car (entsel "\nSelect object: "))
p1 (getpoint "\nFirst point on object: ")
p2 (getpoint "\nSecond point on object: ")
); setq
(prompt
(strcat
"\nDistance along object between those two points = "
(rtos ; in current Units mode/precision settings
(abs
(-
(vlax-curve-getDistAtPoint ent (vlax-curve-getClosestPointTo ent p1))
(vlax-curve-getDistAtPoint ent (vlax-curve-getClosestPointTo ent p2))
); -
); abs
); rtos
); strcat
); prompt
(princ)
); defun
You select an object, and select any two locations along it, and it tells you the distance along that object between those two locations. It works on any kind of object with linearity [Line, Arc, Circle, Polyline, Ellipse, Spline, Ray, Xline].
It asks for the points to measure between separately from selection of the object. It could be altered to use the point at which you first select the object for the first point of the measured distance, if that would suit your workflow better.
It's in very simplest terms, and does not check that you picked an object that it can measure along [i.e. not a thing without linearity such as Text or a Block], nor that the two points you pick are actually on it. But it could be enhanced to check for those things.
Kent Cooper, AIA