Showing results for 
Search instead for 
Do you mean 

How to sort my results...

Hello, I am trying to discover a an alternate way to achieve and end in my code.


I have some code that will measure the volume of each part in an assembly. However it measures the parts in an order that isn't the same as the assembly navigator, and that is exactly what I am trying to achieve. It does not have to be exactly the same order, so long as the parents have there respective children under them so I know what parts belong to what.


I have another version of the code that aplphabetizes the parents, but that code does not work on certain kinds of parts. I am looking for an alternative method to sorting my results. The code posted below is what I am working with.


If anybody has any ideas that would be awesome.




Re: How to sort my results...

[ Edited ]

"...does not work on certain kinds of parts."


Which type of parts give it trouble? Does it give an error message or just not work as you expect?

Re: How to sort my results...

[ Edited ]

Well so far, from what I am aware of, it does not seem to process assemblies with deformed parts in it. It gives an error message concerning a certain line of code.  Did you want to see the code that alphabetizes the results?

Re: How to sort my results...

Initially could you create a set of arraylists/List of T for each sub assy in your assy.  This would cintain component name.

Then later on in your code perform a lookup in the arraylist/List of T of the component name to find it's immediate parent sub.  The use of arraylist or List is very efficient as you won't need to index over them unlike an array.

Re: How to sort my results...

That is a good idea, I will try that. I did discover something though. I know a lot of people are looking forward to the .AskChildrenOrder function working. I grabbed some sample code made by GTAC at this link:


The function seems to work just fine for me. It will only work for Chronological and Sequential orders though. Which I prefer anyway. I am not sure about other people. I think I might try and write up a version of my code using this function.


I am running NX 10.0.1.