Another similar way [similar in finding all Lines and comparing the length of each to that of the reference Line, and leaving you with the qualifying ones selected/gripped/highlighted], but that involves no extraction of Line endpoints or VLA object conversion to get the reference or comparison lengths, nor multiple selection sets:
(defun C:SLSL (/ lsel reflen n lin ss); = Select Lines of Same Length
(if
(and
(setq lsel (entsel "\nSelect Line of reference length: "))
(member '(0 . "LINE") (entget (car lsel)))
); and
(progn ; then
(setq reflen (getpropertyvalue (car lsel) "Length"))
(repeat (setq n (sslength (setq ss (ssget "X" '((0 . "LINE")))))); then
(setq lin (ssname ss (setq n (1- n))))
(if (not (equal (getpropertyvalue lin "Length") reflen 1e-2))
(ssdel lin ss); remove
); if
); repeat
(sssetfirst nil ss)
); progn
(prompt "\nNo LINE selected."); else
); if
(prin1)
)
[Yes, I know selection can be limited to a single Line in (ssget), but you can't escape its "Select objects: " prompt always in the plural, so I don't like to use it when going for a single thing. I go for (entsel) in which you can specify your own prompt within the selection function itself.]
That defines "same length" as being within 1/100 of a drawing unit. Adjust the 1e-2 for a different precision, or the routine could be made to ask for a precision, and if you like, remember it for subsequent use.
Kent Cooper, AIA