@n.lagos.pdr wrote:
.... The LISP routine I want to create should select a polyline and perform a reverse when the leftmost vertex is not vertex 1, and then apply the measure command.
When you say "the leftmost vertex is not vertex 1," do you mean only that vertex 1 is not at a lower X-coordinate value than the end vertex? Could the leftmost vertex be neither the first nor last one?

EDIT: If it's only a question of Reversing when the start is to the right of the end, try this:
(defun C:SLE (/ esel pl); = Start at Left End
(if
(and
(setq esel (entsel "\nPolyline or Line to Reverse if drawn right-to-left: "))
(wcmatch (cdr (assoc 0 (entget (setq pl (car esel))))) "*POLYLINE,LINE")
); and
(if (> (car (vlax-curve-getStartPoint pl)) (car (vlax-curve-getEndPoint pl)))
(command "_.reverse" pl ""); then
); if
(prompt "\nNothing selected, or not a Polyline or Line.")
)
(prin1)
)
If it's vertical or closed [X coordinates of start and end are equal], it will not be reversed.
Since the same standard can be applied to a Line by the same approach, it allows for them. It could also allow a Spline or even a Helix, but REVERSE won't work on other things [e.g. an Arc]. If those or other kinds of paths are wanted, it could be done [see my ReverseDirection.lsp routine, >here<].
Kent Cooper, AIA