cmchadwick Posted March 14, 2017 Share 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 Link to comment Share on other sites More sharing options...
Tharwat Posted March 14, 2017 Share 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 Link to comment Share on other sites More sharing options...
CadSpartan Posted December 5, 2019 Share Posted December 5, 2019 I'm not too familiar with vlisp, how do I incorporate my xref names into this lisp? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 6, 2019 Share Posted December 6, 2019 (detachxref "Pe seal") Quote Link to comment Share on other sites More sharing options...
CadSpartan Posted December 6, 2019 Share 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 Link to comment Share on other sites More sharing options...
BIGAL Posted December 7, 2019 Share 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 Link to comment Share on other sites More sharing options...
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.