How to detach Xref copied on more than one layout
I am facing a problem while detach an XrefIf the Xref copied on more than one layout I cant detach. I have to delete from each layout first then detach.
Is there a way to detach whithout deleting from each layout? Probably, with code. I've been using this one for years
(defun c:dx (/ bd b name ss x)
(setq b (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))
(while (and (setq o (car (entsel "\nSelect Reference to Detach: ")))
(setq o (vlax-ename->vla-object o))
(equal (vla-get-objectname o) "AcDbBlockReference")
(setq name (vla-get-name o))
(setq bd (vla-item b name))
(equal (vla-get-isxref bd) :vlax-true)
)
(if (= 1 (sslength (setq ss (ssget "_x" (list (cons 2 name))))))
(vla-detach bd)
(progn (mapcar '(lambda (x) (vl-catch-all-apply 'vla-delete (list x)))
(mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss)))
)
(vla-detach bd)
)
)
)
(princ)
) That one does ROCK. Its a great one.
Whats a great and simple code. Glad you like it
页:
[1]