Hi All,
Suppose I have a Drawing Structure like:
MasterRoot
Root1
MasterChild1
Child
MasterChild2
Child
Root2
MasterChild1
Child
MasterChild2
Child
When I use XrefGraph xg = mainDb.GetHostDwgXrefGraph(true); in Code then I get all the Files as a node including MasterRoot (say count=6).
If I want to get Only direct Children (here, Root1 and Root2)(means count=2 only), then wha i have to do?
Is it Possible?
Any help will be appreciated.
Thanks in Advance..
Thanks & Regards,
Vasant Padhiyar
Solved! Go to Solution.
Solved by vasantpadhiyar71. Go to Solution.
Have you tried the XrefGraphNode.IsNested property?
From the ObjectARX docs for this property:
"Returns True if this node represents a nested xref that is not directly referenced in the host drawing."
So in code you could check for this property to be false, i.e.:
XrefGraph graph = db.GetHostDwgXrefGraph(true); for (int i = 0; i < graph.NumNodes; i++) { XrefGraphNode node = graph.GetXrefNode(i); if (!node.IsNested) { // < Insert your code for non-nested xref here > } }
Haven't tried this myself but hopefully this will help you out.
Art
Hi,
The ObjectARX docs say something like this...
Each reference (between databases) is represented by an edge in the graph, and can be queried by calling GraphNode.In(int index) for what is referencing this node...
I haven't tried to do this, but looking at the ObjectARX documentation I would try the following:
1. Get the root node (which is effectively the host drawing), i.e.:
XrefGraph graph = db.GetHostDwgXrefGraph(true);
XrefGraphNode rootNode = graph.RootNode;
2. Then use the XrefGraphNode.NumIn property and XrefGraphNode.In(int i) method to iterate child nodes recursively.
You might need to experiment and step through in debug mode to see what's happening under the hood. I've never looked closely at it.
Good luck, Art
Thanks Art,
I have done it using the same Concept and it works fine.
1. Get the root node (which is effectively the host drawing), i.e.:
XrefGraph graph = db.GetHostDwgXrefGraph(true);
XrefGraphNode rootNode = graph.RootNode;
2. Then use the XrefGraphNode.NumIn property and XrefGraphNode.In(int i) method to iterate child nodes recursively.
Thanks,