BlockTableRecord.GetXrefDatabase Method

BlockTableRecord.GetXrefDatabase Method

fsztuczny
Advocate Advocate
652 Views
1 Reply
Message 1 of 2

BlockTableRecord.GetXrefDatabase Method

fsztuczny
Advocate
Advocate

Hello
Please download the attachment, unpack it to some subdirectory and open the 1.dwg file.
I am trying to do the following thing: I want to programmatically open the above drawing, reload xrefs and view all files connected to it (dwg, pdf and jpg). This is not a problem. When browsing nested xrefs visible in 1.dwg I want to get handle of all nested xrefs BlockTableRecord, i.e. having open 1.dwg I would like to get handle 3.dwg and others. Also no problem. I took from the xrefs BlockTableRecord XrefDatabase.
However, there is a problem. Looking through the above XrefDatabase drawing 2.dwg I can get handle, but this handle is exactly the same as handle 3.dwg in 1.dwg. I want to take handle 3.dwg the same as in opened a 2.dwg file in autocad editor.
Why do I need it? Because I have an open one drawing 1.dwg for read, recursively iterate all nested references, recreate the structure of xrefs, open xrefs owner (for example 2.dwg) for write (Database.ReadDwgFile method) and direct modify 3.dwg xref path in the owner of the nested xref, (in 2.dwg). To open the 3.dwg xref I want use the BlockTableRecord handle.

 

Simplifying: I have open 1.dwg I see 3.dwg and I want his handle to be exactly like in 2.dwg and not in 1.dwg.

See ArxDbg tool and check the BlockTableRecord handle of the 3.dwg in two cases: When is open 1.dwg and is open 2.dwg.

0 Likes
653 Views
1 Reply
Reply (1)
Message 2 of 2

fsztuczny
Advocate
Advocate

Hello

I solved the problem a bit differently. I stored in the program the name of the nested xrefs instead of Handle, and I obtained Handle by querying the appropriate Dictionary. Simple, effective, reliable.

Regards.

 

0 Likes