Message 1 of 14
How to programmatically find all references (xref dwg, jpg, pdf, OLE etc)?
Not applicable
02-24-2010
10:59 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have some code (.Net addin application) that reads xrefs from a drawing. This code uses DataBase.GetHostDwgXrefGraph() and has worked fine until now.
However, now I've run into some drawings that references not only .dwg-files, but also .jpg-files.
In the XREF dialog in AutoCAD I can see that .jpg-files are referenced by the "parent" drawing, but GetHostDwgXrefGraph() doesn't seem to find the .jpg files.
I have attached some sample code to illustrate what I do (FindExternalReferences.cs). In that file, I have a CommandMethod "xrl" finds all references of the mdi document and writes to debug output in visual studio.
Also I added a zip-file containing a drawing "parent.dwg", and it referenes some other files that also are in the zip-file:
* Another .dwg - child.dwg
* sample-jpg.jpg
* OLE link - sample-word.docx
* PDF - sample-pdf.pdf
* WMF - sample-wmf.wmf
My top priority is to find referenced images (jpg, png, bmp), but I'd also be interested in how to find referenced OLE links, PDF and WMF.
Can I use GetHostDwgXrefGraph to accomplish this, or do I need to use some other method? Basically I'd like some code suggestion how I can find all referenced files from "parent.dwg" (not only the .dwg as my code works now).
Thanks in advance,
Mattias
I have some code (.Net addin application) that reads xrefs from a drawing. This code uses DataBase.GetHostDwgXrefGraph() and has worked fine until now.
However, now I've run into some drawings that references not only .dwg-files, but also .jpg-files.
In the XREF dialog in AutoCAD I can see that .jpg-files are referenced by the "parent" drawing, but GetHostDwgXrefGraph() doesn't seem to find the .jpg files.
I have attached some sample code to illustrate what I do (FindExternalReferences.cs). In that file, I have a CommandMethod "xrl" finds all references of the mdi document and writes to debug output in visual studio.
Also I added a zip-file containing a drawing "parent.dwg", and it referenes some other files that also are in the zip-file:
* Another .dwg - child.dwg
* sample-jpg.jpg
* OLE link - sample-word.docx
* PDF - sample-pdf.pdf
* WMF - sample-wmf.wmf
My top priority is to find referenced images (jpg, png, bmp), but I'd also be interested in how to find referenced OLE links, PDF and WMF.
Can I use GetHostDwgXrefGraph to accomplish this, or do I need to use some other method? Basically I'd like some code suggestion how I can find all referenced files from "parent.dwg" (not only the .dwg as my code works now).
Thanks in advance,
Mattias