Cancel
Showing results for 
Search instead for 
Did you mean: 

Dont getting GetAllDescendants with filter

Pioneer
Pioneer

Hello,

 

TxObjectList parts = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(TxComponent)));

 

 

I tried this code to get all component. But it never shows component. The same code i tries with different filter like TxRobot, TxCompoundPart but it  never works for loaded study. What shold be the reason?

 

Thanx 

18 REPLIES

Re: Dont getting GetAllDescendants with filter

Siemens Legend Siemens Legend
Siemens Legend

That is strange.

What data do you have loaded in 3D view?

Are you running this in Process Simulate? Process Designer?

Re: Dont getting GetAllDescendants with filter

Pioneer
Pioneer

It is process simulate standalone. and its not working for any of objet type. I have tried for TxRobot , TxCompoundPart, Txcomponent. I couldnt get any about this. 

Re: Dont getting GetAllDescendants with filter

Siemens Legend Siemens Legend
Siemens Legend

What data do you have loaded in 3D view? and in the Object Tree?

Also, does this work?

TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(ITxObject)));

Re: Dont getting GetAllDescendants with filter

Pioneer
Pioneer

Hello,

 

here i attached a picture, U can see there is avery normal data , which cell use. But your updated code also not working. In the picture , i have manually expand object tree , N I want to expand it by button1. 

 

Thanx

Re: Dont getting GetAllDescendants with filter

Pioneer
Pioneer

Sorry here is picture

Re: Dont getting GetAllDescendants with filter

Siemens Legend Siemens Legend
Siemens Legend

You might have some other bug in your code which prevents you from seeing the results, or you run with optimized code?

 

If you build your DLL in debug, and connect with a VS debugger, do you see that the returned TxObjectList is empty?

TxObjectList objList = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(ITxObject)));

When I run this I get a full list. See attached image.

Re: Dont getting GetAllDescendants with filter

Pioneer
Pioneer

Hello, I m little bit new in VS. Can u explain me with steps , how did you get this list in VS ?

I have applied same method as u applied. Just want to know in VS how did you get Lisr?

May be that will be helpful for me to solve original problem.

Thanx 

Re: Dont getting GetAllDescendants with filter

Pioneer
Pioneer

How to build dll in debug. ? When i try normally to debug the project. as usual it opern error window like attached image.

 

Re: Dont getting GetAllDescendants with filter

Siemens Legend Siemens Legend
Siemens Legend

To debug your code using VS, first start Process Simulate (not from VS).

Then you need to attach VS to a process named "Tune.exe".

Do that by:

1. clicking on "Debug" --> Attach to Process...

2. In the dialog that opens, choose "Tune.exe" process.

3. Make sure you select "Managed (v4.5, v4.0) code" code type (using "Select..." button if needed)

4. Click on Attach.

5. Set a breakpoint in code by putting the marker on the line you wish to debug and clicking 'F9' - you will see a red dot next to it.

6. Run your command/dialog.

 

See this for more tips about debugging:

https://docs.microsoft.com/en-us/visualstudio/debugger/getting-started-with-the-debugger