Jump to content

Check to see if the Drawing has an Xref in it


nod684

Recommended Posts

Hi all...

 

am just wondering if there is a way to check if there is an Xref in a drawing without opening them. Check the whole folder and list which drawing has an xref.

 

the reason? commonly we use e-transmit to bind multiple drawings, and knowing e-transmit command; if there is an unloaded / unrefference drawing it will skip the file and goes on to the next file.

 

the log report was also deleted and no way for us to trace if there is an xref in each drawing but open them one by one.

 

can this be done?

Edited by nod684
Link to comment
Share on other sites

I don't use the Design Center, but I suspect that there is an easy way to do it,

and that is where I would start if I wanted to do this.

Link to comment
Share on other sites

Use Design Center, Search, upper left pick Xref for look for, continue from there.

 

Thanks rkent for filling in the gaps, I knew that was where to start from your previous post where you described it,

and I tried it after reading your post and was pretty impressed, a great resource for sure. :beer:

Link to comment
Share on other sites

Try this, be sure that no file in the chosen directory is open.

(defun c:xct()
 (vl-load-com)
 (setq dir (vl-directory-files (setq dirname (strcat (vl-filename-directory  (getfiled "Open file" (getvar "dwgprefix") "dwg" 4) ) "\\")) ))
 (foreach file dir
   (if (and (/= file ".") (/= file ".."))
     (progn
(setq odbx (vla-GetInterfaceObject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." (itoa (atoi (getvar "AcadVer"))))))
       (vla-open odbx (strcat dirname file))
       (setq st "" n 0)
       (vlax-for item (vla-get-Blocks odbx)
         (if (= (vla-get-IsXRef item) :vlax-true)
           (setq st (strcat st (vla-get-Name item) "; ")
          n (1+ n))
         )
       )
       (if (/= st "")
         (princ (strcat "\nFile " (vla-get-Name odbx) " has " (itoa n) " Xref" (if (> n 1) "s" "") " : " st)))
       (vlax-release-object odbx)
     )
   )
 )
 (textscr) (princ) 
)

Link to comment
Share on other sites

  • 2 weeks later...

As an alternative to the lisp.

Use the reference Manager. go to windows start, look for the autodesk folder and here you will find a program called reference manager. locate the drawings that you wish to check and it will list all items referenced in the drawings. if you sort by type, you will see what, if any, xrefs are in which drawings.

Link to comment
Share on other sites

7o7

 

The error took a place because the OP may had files other than Autocad formats in the same folder , so to go around this error I would rewrite it this way . :)

 

(setq dir (vl-directory-files (setq dirname (strcat (vl-filename-directory  (getfiled "Open file" (getvar "dwgprefix") "dwg" 4) ) "\\")) [color=magenta]"*.dwg"[/color] [color=seagreen]1[/color]))

Link to comment
Share on other sites

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