#Picking off XREFS
10 messages in this thread
I have an application where I need to be able to open an AutoCAD drawing
and extract the filenames of XREF objects. I need to be able to do this
outside of AutoCAD itself. Does anyone have any code that accomplishes
this or can anyone give me pointers on how to go about doing it? (I have
the Release 11 SDK for DOS.)
Thanks!
AutoCAD creates and updates a log file that records actions during Attach,
Detach, and Reload of Xrefs. It is an ASCII text file with a .XLG
extension. Perhaps this can help.
Thanks for the reply. Are you aware of any API library functions that
would let me fetch these names out of a drawing directly?
Yes, if you do not mind loading AutoCAD. No, probably not, if you want to
extract this information without loading AutoCAD. The AutoCAD data file
format is not released – because it can change with each new release (See
also other threads on this topic).
More specific answers require more specific input from you as to what you
want to do.
I'm working on a network check-out utility for AutoCAD and need to be able
to extract XREF filenames from a drawing file. The check-out utility will
actually fetch and keep track of the files that AutoCAD needs from the
drawing, making the necessary network requests and placing them on the
local drive before AutoCAD loads. It has to run outside the AutoCAD
environment (obviously). I know bupkis about AutoCAD (also obviously); I'm
a systems and network programmer under contract with a software vendor.
Did you look at the .XLG file? In simple ASCII text, it lists all the
Xrefs that a drawing has used. A simple string parser should be all that
is needed to allow you to download the required Xrefs.
I did, but since this application is intended for a vertical market
reseller, I can't count on the XLG file not being removed by some eager
sysadm's maintenance. After a few hours of anatomy with a binary editor I
managed to leach out a (so far) reliable, non-API method of extracting
those Release 11 XREF filenames from the DWG file. It would help if
AutoDesk (the tech support end, not the CIS folks) was more cooperative
with third-party developers. I see no percentage in withhholding
information from developers whose efforts only stand to enhance your market
penetration. The information I needed was likewise not something I
couldn't find on my own, given enough time… just a needless (and costly
to my client) aggravation. These structures really should be published.
My client is happy, I get paid, that's what counts. Thanks for your help,
Theo.
Good stuff. On the other hand, your customer should not count on the DWG
format staying the same from release to release. You should notify your
customer that your routines will need regular (chargeable) maintenance with
each new AutoCAD release.
Thinks…. Xfrefs can be nested – and stored anywhere on system. Test
for this. Probably more. Anything looking at DWGs – needs lots of
testing. Let us know how it goes…
Steven – Actually, there's a pretty good argument against disclosing the .DWG
file format to *anyone*. If Autodesk were to encourge the proliferation of
external applications that are tied to a specific release of AutoCAD vis a vis
the drawing file format, then users of those applications would not be overly-
anxous to upgrade to new releases of AutoCAD (with an incompatible drawing file
format), because none of their external applications would work with drawings
produced by the new release(s).
To me, that's like shooting ones own foot off.
-TonyT.
Steve-
I'm curious as to why you need to "check out" xrefs; Autocad handles
file locking itself, and I would tend to think that doing anything would
only interfere with the way R11 was designed to work.
Keep in mind that I am *not* criticising you; I'm just trying to open
some discussion about the use and advantages of the "old" network checkout
schemes, and how they work/should work/is it extraenous with Autocad R11….