algorithmic modeling for Rhino
I'm trying to split a list of objects up by their type. Their indexing doesn't matter, so I'm just throwing them into bins.
This problem seems very similar to Eirik K's problem(spooky that they start life as neighbors.)
Here's the code, it has sample data, so all you need to do is paste it into a PY component and then inspect the results.
Does anyone have any idea how to make it return the contents of the list, and not a list object?
Tags:
Hi Ben
Grasshopper never accepted enumerables of enumerable types, as it already has the Grasshopper tree structure that is meant to fit that purpose. You need to either look for discussions about the way to construct Grasshopper trees from scratch (there are some also for GhPython), or more simply choose a logic with which you can return a single list as result. For example, have 5 component outputs, one for each items in 'types': this allows to have a single item input and do the logic in the script for a single item. Grasshopper then reconstructs the tree from the single iteration logic.
Giulio
Hi Giulio,
Thanks for the reply. The idea is that I have a bunch of outputs from an operation, and I'd like to deal with each in a different way (the easy way for the easy stuff, the hard way for the hard stuff etc.). To keep it generic, there is no way to tell how many different types of thing go into the code, so instead of making n outputs for each type*.
I found one of your examples of how to make a datatree and tried to tweak it to make branches. I'm missing the step to make more than one branch though. How do I make each type get it's own branch?
On an unrelated note, is it possible to embed a gist?
*it'd be interesting to see how many that'd actually be!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by