TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mohan on May 31, 2021, 02:43:38 AM

Title: Detach a specific xref
Post by: mohan 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) . . .
Title: Re: Detach a specific xref
Post by: ribarm 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...