11-15-2017 05:55 AM
Hi
I am trying to get the root TxPartAppearance using the below method
TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(New TxTypeFilter(GetType(TxPartAppearance)))
It is geting a lot of the child elements but not the main nodes. Please see below which part apperances I am referring to. Is this approach incorrect? Is there another method.
Thanks for the help
11-15-2017 07:01 AM
Hi,
we use: TxApplication.ActiveDocument.PhysicalRoot.GetDirectDescendants()
11-15-2017 07:08 AM
Hi
Yes I used this as well with the same bad result. I can't see how that would help as GetDirectDescendants is a reduced list of GetAllDescendants.
Regards
11-17-2017 09:11 AM
Hello,
In my case the following code works fine for MPA created from assembly structure:
TxObjectList allMPADescendants = TxApplication.ActiveDocument.PhysicalRoot.GetDirectDescendants(new TxTypeFilter(new Type[]{ typeof( TxPartAppearance), } ));
From your provided screenshot I would say your MPA is coming from IPA part structure.
The strange thing is, when using ...
TxObjectList test = TxApplication.ActiveDocument.Selection.GetAllItems();
... it returns "TxPartAppearance" as object type.
Best regards
Patrick
11-22-2017 03:05 AM
Hi
After some investigation using GetDirectDescendants these are the items it is returning ticked in blue which is not what I need.
The main goal is to get the main part appearance node and move it to a new location using ITxLocatableObject but there is no metod to get to this without manually selecting it.
Regards
11-22-2017 03:22 AM
Hi,
Yes that´s what I said.
This is because your Appearance is coming from "IPA".
As you said you get the appearances (children) from API.
Maybe you need to check if these appearances have parents, so iterate backwards to find the parents.
Best regards
Patrick
11-22-2017 04:29 AM
Hi
The parent is physicalroot so this will not be possible
Regards
11-23-2017 03:58 AM
Hi Root7,
Can you check what is the API type of that root objects?
You can write a small command, something like that:
ITxObject selectedObject = TxApplication.ActiveSelection.GetAllItems()[0]; MessageBox.Show(selectedObject.ToString());
Or check the type while debugging.
Best Regards,
DianaG
11-23-2017 04:21 AM
Hi
It is TxPartApperance. I have found a solution using TxOperationEx.GetAllPartApperances.
Regards
Watch Replays of Previous Topics