I thought I answered your question in previous post but if you want more, here it is
- (defun C:TEST ( / i ss) (if (setq i 0 ss (ssget ":E:S" '((0 . "LWPOLYLINE")))) (foreach n (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (ssname ss 0)))) (set (read (strcat "P" (itoa (setq i (1+ i))))) n) ; - here you can draw a line like (entmakex (list '(0 . "LINE") (cons 10 n) (cons 11 some_point))) ) ))
However, I still think that your approach is wrong. You can draw those lines without setting (global) variables P1 ... Pn |