Author Topic: Batch Determine if DWG Has Reference File(s)  (Read 5295 times)

0 Members and 1 Guest are viewing this topic.

encepta

  • Mosquito
  • Posts: 13
Batch Determine if DWG Has Reference File(s)
« on: June 27, 2023, 05:55:43 PM »
I have a ~2000 unique DWG's across various directory locations.

1. I need to know how many of these have reference file(s).

2. Has anyone tried to do something like this before? I.e. checking for reference files via LISP function, API, Python, etc.?

3. I would like to do this programmatically, but I need to know if the 'Check for Reference File' is even possible?

Cheers,
Henry

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8698
  • AKA Daniel
Re: Batch Determine if DWG Has Reference File(s)
« Reply #1 on: June 27, 2023, 07:24:37 PM »
You should be able to use any COM aware language, along with the e-Transmit API

There’s a sample here in C# at
https://adndevblog.typepad.com/autocad/2012/06/using-e-transmit-api-in-net-to-find-external-references-in-a-drawing.html

e-Transmit API should pick up xrefs, datalinks and such

JohnK

  • Administrator
  • Seagull
  • Posts: 10634
Re: Batch Determine if DWG Has Reference File(s)
« Reply #2 on: June 28, 2023, 10:32:30 AM »
Getting a list of all the reference files is easy enough with lisp too.

Code - Auto/Visual Lisp: [Select]
  1. ( (lambda (/ entry)
  2.     (while
  3.       (setq entry (tblnext "block" (not entry)))
  4.       (if (cdr (assoc 1 entry))
  5.         ;; check to see if it has a path
  6.         ;;
  7.         ;; if it does..
  8.         (print entry)
  9.         ) ; if
  10.       ); while
  11.     (princ)
  12.     )
  13.  )
  14.  
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ronjonp

  • Needs a day job
  • Posts: 7529

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

encepta

  • Mosquito
  • Posts: 13

57gmc

  • Bull Frog
  • Posts: 366
Re: Batch Determine if DWG Has Reference File(s)
« Reply #5 on: June 28, 2023, 07:13:18 PM »
There's also the Reference Manager tool that comes with AutoCAD. Look in the start menu. Just open a folder of files and it will show you all the files being reference and by type. If it finds broken xref links, you can batch fix them with this tool.