@Anonymous wrote:
.... I would like to measure the distance between the two red points. ....
I would like to know if there is another way of measuring the distance between the two points (ALONG the poly-line) by only specifying the the start and end points? ....
If the Polyline's entity name is in a variable, let's call it 'pl', and those two points are in variables, let's call them 'pt1' and 'pt2', then the distance between them along the Polyline would be the difference between their individual distances along it, something like [untested]:
(abs
(-
(vlax-curve-getDistAtPoint pl (vlax-curve-getClosestPointTo pl pt2))
(vlax-curve-getDistAtPoint pl (vlax-curve-getClosestPointTo pl pt1))
); -
); abs
I used (abs) so that it won't matter whether pt1 or pt2 is the one nearer the beginning of the Polyline, and you won't get a negative result. I used (...getClosestPointTo ...) because I believe the measured locations need to be on the Polyline center-line, not on the edge of its width as your red marks are.
Type in (vla-load-com) if those functions are not recognized.
EDIT: Now I'm noticing your description of it as a closed Polyline, which suggests that those red marks are on its centerline, and what I took for Polyline width is an infilling solid Hatch pattern or some such thing. If that's the case, you can simplify it:
(abs (- (vlax-curve-getDistAtPoint pl pt2) (vlax-curve-getDistAtPoint pl pt1)))
but make sure the points are on the same side of the filled pathway -- you would get a much longer distance result if it's measuring along one edge and around an end and back down the other side.
Also, the validity of that would be affected by where the Polyline starts/ends. If the portion to be measured crosses that start/end vertex, it would need to be handled differently.
Kent Cooper, AIA