Hello!
I found Lee's amazing code here on the forums.
http://www.theswamp.org/index.php?topic=55023.msg594013#msg594013It inserts points on the vertices the selected MLeader.
It was not hard to modify the code to insert a block instead of points, but
I would like to select
multiple MLeaders and iterate through all of them, inserting my block on all the vertices.
I am not as advanced in coding to write it myself so I am asking for your help.
This is how far I got with it:
(defun LM:mleadervertices ( ent )
(mapcar '(lambda ( x ) (massoc 10 x))
(massoc "LEADER_LINE{"
(cdr
(assoc "LEADER{"
(cdr
(assoc "CONTEXT_DATA{"
(parsedxfdata (entget ent))
)
)
)
)
)
)
)
(defun massoc ( k l )
(mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= k (car x))) l))
)
(defun parsedxfdata ( l / foo )
(defun foo ( / x )
(setq x (car l)
l (cdr l)
)
(cond
( (or (null x) (= "}" (cdr x)))
nil
)
( (and (= 'str (type (cdr x))) (wcmatch (cdr x) "*{*"))
(cons (cons (cdr x) (foo)) (foo))
)
( (cons x (foo)))
)
)
(foo)
)
(defun c:test ( / c e )
(if
(and
(setq e (car (entsel "\nSelect mleader: ")))
(= "MULTILEADER" (cdr (assoc 0 (entget e))))
(setq c 1)
)
(foreach l (LM:mleadervertices e)
(foreach v l
(entmake (list '(0 . "INSERT") '(2 . "myblockname") (cons 10 v) (cons 62 c) '(41 . 1.0) '(42 . 1.0) '(43 . 1.0) '(50 . 0)))
)
(setq c (1+ (rem c 255)))
)
)
)