17 Posts
0 Kudos
Registered: ‎06-19-2012
Post 1 of 4

Counting Xrefs

217 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
104 Posts
11 Kudos
Registered: ‎04-21-2011
Post 2 of 4

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
47 Posts
4 Kudos
Registered: ‎09-04-2012
Post 3 of 4

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
762 Posts
100 Kudos
Registered: ‎03-21-2011
Post 4 of 4

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
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!