Grasshopper

algorithmic modeling for Rhino

Hello all, I am trying to solve a simple puzzle in GH, I was using Galapagos as one process to solve the puzzle, however I would like to explore enumerating all possibilities as well. 

My plan is to loop through all combinations with series of conditional statements that bake the solution when the 'right' conditionals are met. 

 

I have been looking at Giulio's tools: http://www.giuliopiacentino.com/grasshopper-tools/ theEngine in particular. Taking a look at the code it appears to be a work-around where it refreshes the canvas then keeps track of the refreshes(I cannot build nested loops as far as I know)

I would like to have 4 outputs that loop 24 times to reach every possible combination like such: 


Is this possible in anyway? Thank you for your time 

Views: 1308

Replies to This Discussion

I wrote a small script without realising I misread the problem. The attached file creates all possible permutations, including double entries. Maybe it will get you started anyway.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Thanks for your time David, this is what I was looking for however my goal is to have 4 outputs which display each item in the list (once at a time) per refresh. I guess the part im stuck on is the whole refresh part so that it will try one combination at a time. I dont have a full understanding of how to do this given that everything in GH is runtime.  

 

Outputs: A,B,C,D

A0: Cat

B0: Cat

C0: Cat

D0: Cat

A1: Cat

A2: Cat

A3: Cat

A4: Dog

etc, per refresh.....

I found a work around by combining your code and Giulio's. I take the result and have the engine grab each item one at a time, I then split the string and pull each item into their own list, it works but as one would imagine after 6 or so 'animals' it gets so large that the machine starts to crawl :/  

88% of the resources come from the permutation script, my guess is that if the permutation were calculated on the fly with the counter(the engine) it wont have to pre-compile the list which would be much faster...


If anyone has an idea im all ears....


I attached the file (re-written in C#) 

Attachments:

I have tried some time ago to do this:

I had Galapagos running the permutations.

The generated geometry is fed to Ecotect with Geco. The numbers came back via Geco.

1. I wrote a VB component to bake the geometry into Rhino, select all of those, export them in a seperate file with unique file names (timestamps in my case). Delete the geometry from Rhino, and the loop completes, Galapagos go forward to the next slider settings. Since the geometry only exist in active Rhino for a while and are deleted, it will release the memory.

I dont have those scripts anymore, but I used the VB components, commands are simple run-scripts:

RhinoApp.RunScript("_Enter", True)
RhinoApp.RunScript("'_SelNone", False)

etc etc...

2. Similar is to write the numbers to a text file via some common text writter scripts(could be found easily). Each to a different .txt path.

3. Or similarly you could use a screen capture component (could also be found on forum) to take captures and save them as uniquely named .jpgs.

Thanks Victor, do you by chance remember exactly what methods were used to bake/export/delete the geometry? I see the Rhino.RhinoApp methods but im not quite sure which ones to use.

I also attached the Exhaustive Enumerating script I wrote that seems to work pretty well. To get around the looping issue I have a C# script that takes the engine numbers from Giulio's script as an input, which acts as the looping mechanisim, I then use those values to feed a function which counts in base 4 then return the combinations, this works well for it does the math on the fly vs. pre-compiling all combinations at once. 

Attachments:

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