Help with selection and loop
Hey all, I am working on a simple piece of code that will place a leader at the insertion point of every block with a specified name. Hears the good part then I want to select each of the added leaders and use the QLATTACH to connect the leaders to a specified string in the drawing. below is the code that I have so far, and what it doesn't do is select all of the newly added leaders only the first one. Please help. Thanks in advance.
[code] (setq ss (ssget "X" (list (cons 0 "INSERT") (cons 2 blockname)))
n (1- (sslength ss))
)
(while (>= n 0)
(setq blockname (ssname ss n)
n (1- n)
inspt (cdr (assoc 10 (entget blockname)))
)
(command "._LEADER" inspt "@12<0" "" "" "N")
(setq ldrs (entlast))
)
(COMMAND "QLATTACH" ldrs PAUSE)[/code]
[code] (setq ss (ssget "X" (list (cons 0 "INSERT") (cons 2 blockname)))
n (1- (sslength ss))
)
(while (>= n 0)
(setq blockname (ssname ss n)
n (1- n)
inspt (cdr (assoc 10 (entget blockname)))
)
(command "._LEADER" inspt "@12<0" "" "" "N")
(setq ldrs (entlast))
)
(COMMAND "QLATTACH" ldrs PAUSE)[/code]
Link copied