I needed/wanted a way to select a MLeader with additional objects around it (text, lines marking through text in MLeader, etc.), move to new location but keep original placement of leader points.
I scratched this out last night and tested in '08 to find that it worked perfectly. However, when I got to work today and tested it in '09, it refused to entmod my Multileader.
The extraction data still works to retrieve each leader end point, but I can't make it entmod in '09. Without this option, it's garbage to me. Thought I'd share the data anyway...
;;;( (lambda (lst n)
;;; (vl-remove nil
;;; (mapcar
;;; (function
;;; (lambda (x)
;;; (setq n (1+ n))
;;; (if (and (eq (car x) 10)
;;; (eq (cdr (nth (1- n) lst)) "LEADER_LINE{"))
;;; (cons n (AT:DrawX (cdr x) 1))))) lst)))
;;; (entget (car (entsel)))
;;; -1)
;;;
;;;
;;;
;;;
;;;
;;;
;;;( (lambda (lst n)
;;; (mapcar
;;; (function
;;; (lambda (x)
;;; (setq n (1+ n))
;;; (if (and (eq (car x) 10)
;;; (eq (cdr (nth (1- n) lst)) "LEADER_LINE{"))
;;; (cons n (AT:DrawX (cdr x) 1))))) lst))
;;; (entget (car (entsel)))
;;; -1)
(defun c:Test (/ ss p1 p2 lst)
(and (setq ss (ssget "_:L" '((0 . "MULTILEADER,LINE,TEXT,MTEXT,LWPOLYLINE"))))
(setq p1 (getpoint "\nSpecify base point: "))
(if acet-ss-drag-move
(setq p2 (acet-ss-drag-move ss p1 "\nSpecify second point: " T))
(setq p2 (getpoint p1 "\nSpecify second point: "))
)
((lambda (i)
(while (setq e (ssname ss (setq i (1+ i))))
(if (eq "MULTILEADER" (cdr (assoc 0 (entget e))))
(setq lst ((lambda (lst n)
(mapcar
(function
(lambda (x)
(setq n (1+ n))
(if (and (eq (car x) 10)
(eq (cdr (nth (1- n) lst)) "LEADER_LINE{")
)
x
)
)
)
lst
)
)
(entget e)
-1
)
)
)
(vla-move (vlax-ename->vla-object e)
(vlax-3d-point (trans p1 1 0))
(vlax-3d-point (trans p2 1 0))
)
(and lst
(entmod
(mapcar
(function
(lambda (a b)
(if a
a
b
)
)
)
lst
(entget e)
)
)
)
)
)
-1
)
)
(princ)
)