Try this. I took the liberty of assuming that if you don't care how long or in what direction the added little Lines are, then what you really want to do is simply identify those inside-the-window ends, and I chose to do that more simply with Points instead of Lines, setting the PDMODE and PDSIZE System Variables to ensure their visibility. No error handling or other typical features yet, and lightly tested:
(defun C:LEIW ; = Line End In Window
(/ inside cor1 cor2 LL UR lineData lineStart lineEnd)
(defun inside (pt)
(and
(<= (car LL) (car pt) (car UR))
(<= (cadr LL) (cadr pt) (cadr UR))
); and
); defun -- inside
(setvar 'pdmode 35); <-- EDIT as desired
(setvar 'pdsize 0); <-- EDIT as desired
(setq
cor1 (getpoint "\nCorner of selection window: ")
cor2 (getcorner cor1 "\nOpposite corner: ")
LL (mapcar 'min cor1 cor2)
UR (mapcar 'max cor1 cor2)
); setq
(if (setq liness (ssget "_C" cor1 cor2 '((0 . "LINE"))))
(repeat (setq n (sslength liness))
(setq
lineData (entget (ssname liness (setq n (1- n))))
lineStart (cdr (assoc 10 lineData))
lineEnd (cdr (assoc 11 lineData))
); setq
(cond
((and (inside lineStart) (not (inside lineEnd)))
(command "_.point" "_none" lineStart)
); start only
((and (not (inside lineStart)) (inside lineEnd))
(command "_.point" "_none" lineEnd)
); end only
); cond
); repeat
); if
(princ)
); defun -- C:LEIW
It could be made to draw Lines instead, without much difficulty, but something would need to be decided about length -- an absolute length could be invisibly small or grossly over-long, depending on the lengths of selected Lines, so something relative would be better, but should it be a percentage of each Line's length, or of the screen height, or...?
Also, a Line endpoint that sits exactly on an edge of the selection window would be considered "inside" it by the above. If you don't want that, take the = signs out of the (<=) functions in the (inside) function definition.
Kent Cooper, AIA