Jump to content

Recommended Posts

Posted

Is there a lisp routine I can use to detach a specific xref. Example: PE seal on all drawings to be removed.

Posted

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)

  • 2 years later...
Posted

I'm not too familiar with vlisp, how do I incorporate my xref names into this lisp?

 

Posted

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)
Posted (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 by BIGAL

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...