Hello.
Is there a way to track the order of a list of referenced geometries? Certain operations in GH tend to mess the order of the list and I need a way to preserve or restore that order without having to take extensive unnecessary steps. Does GH “recognize” the items of a list or does it just use the index?
Good morning @Hayete_BTA
Welcome to the community!
As far as I know it only is by lists, not by geometry.
Often times this can be solved by better list management. or better geometry management.
Posting your gh file here will give us a much better idea of what your problem is and if we can provide a suitable solution.
-Ryan
Hi @Hayete_BTA ,
It depends… technically yes, a list is just an index based data structure but that doesn’t mean you can’t keep that data structure intact.
However, you can use different components and methods to maintain or restore lists/data trees to their original structure/organizations.
It also depends on if you are working strictly with GH or Rhino geometry. Everything in Rhino has a GUID assigned to it. If you operate on Rhino objects you could reorganize the list to the original order by cross referencing the resulting GUID list to the original order in the referenced list.
You can also assign User Data Keys/Values to data and then track/reorder it based on those values.
For example you could assign a User Key called “Original List Position” and feed it the original index as a Value pair.
Then downstream after doing a bunch of operations you could query the value at that key and re order the resulting list based on the original index values found in the “Original List Position - Value Field”.
That being said, with good data managment/tree structuring you rarely actually need to a “brute force” method like that and often times quering a data tree branch and index will be enough.
If you maintain your paths and keep your empty/null values you can, downstream, see exactly where the results end up and move the data as needed.
It really is dependent on the situation and what you are trying to achieve,
If you share an example/objective that would be helpful.
Cheers!