[code="lisp]
; a way to find a closed polyline by point inside
;Lee Mac
(defun polyfrominsidepoint ( p / e i r s )
(if
(setq i -1 s
(ssget "_X"
(list '(0 . "LWPOLYLINE") '(-4 . "&=") '(70 . 1)
(if (= 1 (getvar 'cvport))
(cons 410 (getvar 'ctab))
'(410 . "Model")
)
)
)
)
(while (and (null r) (setq e (ssname s (setq i (1+ i)))))
(if (raycast p (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) (entget e))))
(setq r e)
)
)
)
r
)
(defun raycast ( p l )
(= 1
(logand 1
(length
(vl-remove 'nil
(mapcar
'(lambda ( a b ) (inters p (mapcar '+ p '(1e8 0.0)) a b))
(cons (las