Cancel
Showing results for 
Search instead for 
Did you mean: 

Get locations from an operation

Valued Contributor
Valued Contributor

Is there a way to get the locations that are in an operation given that I have a link to the path?  

 

I see this to get all of the locations at the opertation root:

 

TxObjectList locList = TxApplication.ActiveDocument.OperationRoot.GetAllDescendants(new TxTypeFilter(typeof(ITxLocationOperation)));

 

Then I could probably use the Collection property to drill up and get the opertaion, but I would have to do that for every location and workout duplicate operations.  That does not seem very efficent given I already have the collection of operations.  Anyway to drill down from the operation and get the locations (children)?

2 REPLIES

Re: Get locations from an operation

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi,

 

Here an quick example how to get all location under a weld operation.

TxObjectList selection = TxApplication.ActiveDocument.Selection.GetAllItems();
TxWeldOperation weldOp = selection[0] as TxWeldOperation;
TxObjectList locatons = weldOp.GetAllDescendants(new TxNoTypeFilter());

Best regards

Patrick

Re: Get locations from an operation

Valued Contributor
Valued Contributor

Very nice solution! I was trying to use the GetAllDescendants method, but was getting hung up with the filter.  Thanks!