Jump to content

Can't detach XREF.


Recommended Posts

Posted

I'm cleaning up some old drawings and have an issue. Some of the drawings have an old titleblock XREF'd in, it shows a status of NOT FOUND in the XREF dialog. I can UNLOAD it, but when I try to DETACH it, I get an error "Xref ... has multiple references. Not detached." If I try to Qselect it, the block name is not listed in the block names that I can select on either the model or layout tabs. Purge shows it as a block that I can not purge. Auditing the drawing does not seem to help.

 

How can I get rid of a block that I can't find?

 

Glen

Posted

Is there no block in your drawing that shares the same name as one of the layers in the xref.

 

Is there a lot of blocks? if not 'rename' all of them.

 

I had a similar problem not so long ago when one of the layers within the x-ref matched a block name. All i had to do was rename the block and hey presto.

Posted

Try this Glen...it's not the most elegant way but it works for me:

 

 

(defun c:dx (/ blk blks e ent n name ss x)
 (vl-load-com)
 (setq blks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))
 (while (and (setq ent (car (entsel "\n Select Reference to Detach: ")))
         (setq ent (vlax-ename->vla-object ent))
         (equal (vla-get-objectname ent) "AcDbBlockReference")
         (setq name (vla-get-name ent))
         (setq blk (vla-item blks name))
         (equal (vla-get-isxref blk) :vlax-true)
         (setq ss (ssget "_x" (list (cons 2 name))))
         (setq n -1)
    )
   (if    (= (sslength ss) 1)
     (vl-catch-all-apply 'vla-detach (list blk))
     (progn (while (setq e (ssname ss (setq n (1+ n))))
          (vl-catch-all-apply 'vla-delete (list (vlax-ename->vla-object e)))
        )
        (vl-catch-all-apply 'vla-detach (list blk))
     )
   )
 )
 (princ)
)

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...