cmchadwick Posted March 14, 2017 Posted March 14, 2017 Is there a lisp routine I can use to detach a specific xref. Example: PE seal on all drawings to be removed. Quote
Tharwat Posted March 14, 2017 Posted March 14, 2017 Hi, Try this code: (defun DetachXref (name / xref) ;; Tharwat - Date: 14.Mar.2017 ;; (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) Quote
CadSpartan Posted December 5, 2019 Posted December 5, 2019 I'm not too familiar with vlisp, how do I incorporate my xref names into this lisp? Quote
CadSpartan Posted December 6, 2019 Posted December 6, 2019 Sorry for being so dense. What is text that issues this command DETACHXREF? I want to detach drawing named ca-dan.dwg, would I update lisp like so? (defun DetachXref (name / xref) ;; Tharwat - Date: 14.Mar.2017 ;; (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)) ) (detachxref "ca-dan") ) ) ) ) ) (= :vlax-true (vla-get-isxref xref)) ) (vla-detach xref) ) (princ) ) (vl-load-com) Quote
BIGAL Posted December 7, 2019 Posted December 7, 2019 (edited) I gave you the answer (detachxref "ca-dan") or (detachxref "some variable value as a string") its in your code not Tharwat's. (defun DetachXref (name / xref) ………... ) (setq xname (getstring "Enter name of xref to remove")) (detachxref xname) or (detachxref (getstring "Enter name of xref to remove")) or pick xref and get its name. Edited December 7, 2019 by BIGAL Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.