HasanCAD 发表于 2016-3-2 08:18:04

How to detach Xref copied on more than one layout

I am facing a problem while detach an Xref
If 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?

Rob... 发表于 2016-3-2 08:20:47

Probably, with code.

ronjonp 发表于 2016-3-2 09:13:29

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)
)

mstg007 发表于 2016-3-2 11:19:46

That one does ROCK. Its a great one.

HasanCAD 发表于 2016-3-3 03:41:34


Whats a great and simple code.

ronjonp 发表于 2016-3-3 09:32:15

Glad you like it
页: [1]
查看完整版本: How to detach Xref copied on more than one layout