Grasshopper

algorithmic modeling for Rhino

I am having a problem with data manipulation and sorting. As you can see on the attached file, list B contains codes that refer to the objects of list C, while list A contains statistical data referring one by one to the objects of list C. List D was created by performing mass addition of the objects of list A. I want to sort the list D seen on the attached files, without having to flatten it, as the branch codes are used as indexing to connect the attributes of the items of the lists. I entwined lists B, C and D and tried to sort the groups, based on the List D item, which was always indexed at place 14 in each branch. However, I couldn't find a way to perform the index-based sorting. Any solutions are welcome.

Views: 9038

Attachments:

Replies to This Discussion

Hi Christina,

any chance of getting a GH file with the data embedded? I'd rather not have to create all that again from scratch. You can internatize data if you don't want to share a lot of components.

--

David Rutten

david@mcneel.com

Tirol, Austria

Sure! The data populating the lists comes from an shp file, but internalizing the curves did not work I'm afraid, there is "null" instead. 

Attachments:

I've reread your original question a few times as it wasn't entirely clear to me at first. I just wanted to make sure that you know that the order of branches in a tree is fixed. They are always sorted based on the path numbers.

You can assign new paths to a tree and thus change the order in which branches appear, but you will lose your paths in the process.

--

David Rutten

david@mcneel.com

Tirol, Austria

This is one way to re-order a tree based on the values inside the branches:

--

David Rutten

david@mcneel.com

Tirol, Austria

And the GH file in case you can open it with your version (might not work).

--

David Rutten

david@mcneel.com

Tirol, Austria

Attachments:

Plugging the param viewer into the sort list component did the job of sorting the paths synchronously, but it never occurred to me to use it in between. One more important question, that maybe wasn't clear in my first post as there was no .gh file: I merged the data and want to reorder the branches based on the values indexed at {0, ?}(0) in every branch. I want the data to remain intact, grouped as it is, i just want to reorder the groups accordingly, sorting them based on the number value indexed at zero. Thank you very very much!

Attachments:

Alternatively I could reorder the paths of the trees containing the curves or the 4-digit codes according to the path order provided by the initial sorting, but I don't know how to do that.

I know this is an old post, but here`s the way I managed to reorder a data tree with the use of explode tree + entwine.

Attachments:

Hi David,

I've been doing some work with this component as a means of ordering branches based on sortable keys derived from simpler lists (provided of course the list length matches the branch count). See attached image.

This works well for lists of lists (e.g. seating sections containing row curves) but not for lists of lists of lists (e.g. seating sections containing row curves containing individual seats) because of the aforementioned limitation of path loss.

I overcome this by ensuring that I'm reordering branches upstream prior to growing the data trees, but it begs the question: Is there any means to allow for the Replace (R) input to allow for path masks in addition to paths?

Wait wait wait. The Replace (R) input is requiring the indices of the reordered list as the replacement paths rather than the numbers themselves as the replacement paths. I feel like I'm missing something and this could be simplified.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service