Grasshopper

algorithmic modeling for Rhino

This is from a discussion earlier today that the professors felt would be beneficial for wider exposure here on the forum:

I hope you are doing well. I am having an issue with the animations. After generating all the values from Galapagos and internalizing the data, I still could not figure out how to re-use these numbers to rebuild the new geometry for animation. I am trying to sort the data from both containers (combinations and fitness values) simultaneously to re-feed them in the new geometry sliders and animate. Although I have the fitness values sorted out in order, i could not seem to find a way to use the index of these sorted values to also sort the order of the internalized combination values. Please see attached grasshopper file (components highlighted : The main issue)

My reply was as follows:

Looking at your script it seems that you have been successful in using the Galapagos listener as well as pulling out the parameters to feed back into your model.  As far as ordering goes, if you are sure you want to sort the values according to fitness there is a pretty simple way to do this.  It's easier to explain in person, but I'll do my best with some screenshots and alterations to the script.

The new components that I've used here are tree statistics and tree branch.  The tree statistics component gives me the correct paths of each branch in the tree, which operates like an index in a list.  This gives me information about the tree structure that can be sorted and used after.  The tree branch component is a lot like list item.  By feeding it the tree branches in a new order, it reorders the tree accordingly.  This allows you to sort the data structure of the tree according to fitness values, or any other ordered parameter you would like to use.  I've tried to explain it the best I can remotely, please let me know if there are still more questions I can clarify.  The modified script is attached.

Views: 398

Attachments:

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service