Posts: 17
Registered: ‎06-19-2012
Message 1 of 4 (216 Views)

Counting Xrefs

216 Views, 3 Replies
06-27-2012 08:33 AM



I would like to know one thing, if a have a drawing named dwgtest, and i've added another drawing as xref named dwgtestxref. So the number of xnodes in the xgraph of the dwgtest would be 2 right?  the dwgtest itself and the xref


But if the dwgtestxref has two xrefs named dwgtestxrefxref1 and dwgtestxrefxref2. Why the number of xnodes in the xgraph of the dwgtest is 4? Shouldn't be 2? And the number of xnodes in the xgraph of the dwgtestxref would be 3, the dwgtestxref itself and his 2 xrefs.


I'm asking this because I'm updating the path of the xref, and I update for the dwgtestxref the two path of his xrefs, and then when I'm with the dwgtest i get 4 xnodes, and last two i get an eWasErased, that refer to the dwgtestxrefxref1 and dwgtestxrefxref2.

Am I doing something wrong? Do you understand my problem? I know it can be confusing :smileyindifferent:


Thanks and kind regards,


Distinguished Contributor
Posts: 104
Registered: ‎04-21-2011
Message 2 of 4 (189 Views)

Re: Counting Xrefs

07-01-2012 09:34 AM in reply to: DiogoSantos

According to the ObjectARX docs:
"The host drawing is always the rootNode"


The xgraph includes the drawing itself and all xrefs, including xrefs nested within xrefs.


So 4 xnodes makes sense. One node each for:
- dwgtest
- dwgtestxref
- dwgtestxrefxref1
- dwgtestxrefxref2


Let's say that you have this:
- dwgA xrefed into dwgB
- dwgA xrefed into dwgC
- dwgB and dwgC xrefed into dwgD

Then you'd also have 4 xnodes.


It might be worth looking at the code in the following post which will list the structure of the graph:




Active Contributor
Posts: 47
Registered: ‎09-04-2012
Message 3 of 4 (133 Views)

Re: Counting Xrefs

01-30-2013 12:03 PM in reply to: DiogoSantos

Would it be true to say that the type of graph AutoCAD uses always leaves 2 empth nodes, right and left?

ADN Support Specialist
Posts: 749
Registered: ‎03-21-2011
Message 4 of 4 (110 Views)

Re: Counting Xrefs

02-01-2013 09:22 AM in reply to: DouceDeux

Can you please clarify what you mean by "always 2 empty nodes right and left ?"


You can try running the sample code from the blog post that Art has mentioned in his reply or the sample code from



This can help in understanding the layout of the Xref graph.

Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.