Take loaded overlays

fsztuczny
Advocate
Advocate

Take loaded overlays

fsztuczny
Advocate
Advocate

Hello

I have loaded a drawing by
__db.ReadDwgFile (...).

I want to iterate xrefs, so I use:
__db.ResolveXrefs (true, false);
and
XrefGraph xg = __db.GetHostDwgXrefGraph (false)
e.t.c.
For dwg drawings, it works correctly. I would like to do similarly for drawing pdf, jpg, tiff, etc. Is it possible using a similar mechanism?

0 Likes
Reply
435 Views
3 Replies
Replies (3)

ActivistInvestor
Advisor
Advisor

It depends on what release of AutoCAD you're targeting.

 

For some unexplained reason, Autodesk removed the FileDependencyManager API from recent product releases.

 


@fsztuczny wrote:

Hello

I have loaded a drawing by
__db.ReadDwgFile (...).

I want to iterate xrefs, so I use:
__db.ResolveXrefs (true, false);
and
XrefGraph xg = __db.GetHostDwgXrefGraph (false)
e.t.c.
For dwg drawings, it works correctly. I would like to do similarly for drawing pdf, jpg, tiff, etc. Is it possible using a similar mechanism?


 

0 Likes

fsztuczny
Advocate
Advocate

Hello

My target is autocad 2012, 2014, 2016 and 2018.

I'm trying to successfully browse dictionaries:

 

DBDictionary namedDic = ( DBDictionary )__tr.GetObject( __db.NamedObjectsDictionaryId, OpenMode.ForRead );

string pdfDicKey = PdfDefinition.GetDictionaryKey( typeof( PdfDefinition ) );

if( namedDic.Contains( pdfDicKey ) )

  DBDictionary pdfDic = __tr.GetObject( namedDic.GetAt( pdfDicKey ), OpenMode.ForRead ) as DBDictionary;

 

and

 

ObjectId imgDictId = RasterImageDef.GetImageDictionary( __db );

 

It works very well. There is another problem: If xref is not nested and this xref is the owner of pdf and image files, then the contents of pdf and images are visible in the parent drawing. This is desirable. However, I would like to detect the presence in the parent drawing of pdf files and images used by xref, but without opening the xref. Is it possible?

0 Likes

fsztuczny
Advocate
Advocate

Hello

I have a solution:

 

Database xrefDatabase = xrefBtr.GetXrefDatabase(true );

and check above dictionaries in this xrefDatabase described in previous posts.

 

0 Likes