Author Topic: Detach a specific xref  (Read 188 times)

0 Members and 1 Guest are viewing this topic.


  • Newt
  • Posts: 41
Detach a specific xref
« on: May 31, 2021, 02:43:38 AM »
Pls anyone complete the routine
Code: [Select]
(defun DetachXref (name / xref)
(if (and (not (vl-catch-all-error-p (setq xref (vl-catch-all-apply 'vla-item
                                                  (list  (vla-get-blocks  (vla-get-activedocument (vlax-get-acad-object))) name )))))
       (= :vlax-true (vla-get-isxref xref))) (vla-detach xref)) (princ)) (vl-load-com)

what is name?
what is xref?
Important: Detach a specific xref (name) completely (from all layouts) . . .
« Last Edit: May 31, 2021, 06:26:34 AM by mohan »
"Save Energy"


  • Gator
  • Posts: 2527
  • Marko Ribar, architect
Re: Detach a specific xref
« Reply #1 on: May 31, 2021, 07:06:28 AM »
name is argument of function (Detachxref "name")
xref is localized variable defined in function (Detachxref "name")

Function (Detachxref "name") is correct, you call it with (Detachxref "name") where "name" is user specified string representing DWG name of xref already attached in main DWG and if present, function will detach it, or if not, nothing will be processed...
Marko Ribar, d.i.a. (graduated engineer of architecture)


M.R. on Youtube