Grasshopper

algorithmic modeling for Rhino

I've been playing around with grasshopper recently and have run into a problem that I need help with. There is a simple operation that creates an output, then that output is plugged back in as an input to a duplicate operation, and repeats X number of times. However, with the way that Grasshopper deals with information, each time the operation is repeated, the amount of computation increases exponentially.

I've attached a file as an example of the problem I'm running into. When attempting to animate it, the RAM usage shoots up to my maximum 8GB and crashes after a while. Some of the inputs for the repeating operations have been disabled otherwise the file won't even open. Is there any way to make this file more efficient? For example, in between each operation, I like to copy the results of an output into another node, so I can easily attach it to other nodes elsewhere, but this will create a duplicate of the output. If there is a way to combine multiple links into one node without making a duplicate of the geometries, it would reduce the amount of geometries calculated by half. There must be some components I'm missing.

I've also attached a screenshot pointing out what everything is

and a screenshot of what a resulting baked geometry would look like

As you can see, it's quite heavy. I also can't get the custom previews to look well. The shadows don't look right and when I try to preview the edges, it's as if the object is semi-transparent. I wonder if there's a better way.

Views: 4076

Attachments:

Replies to This Discussion

Grasshopper will create a copy of the entire input data at each component. The copy in each component will exist for the entire solution time. For iterations, its better to use sctipting or iteration add ons such as hoopsnake.

Thanks, hoopsnake sounds like exactly the sort of component I need for repeating operations like mine. It would simplify my file a lot.

Also, does anyone know of a way for grasshopper's custom preview to look like Rhino 5.0's "Artistic View", or "Rendered View"? I guess it would need some sort of rough shadow-making algorithm, but light enough that it can be applied to a very heavy model.

I wrote your definition as a script. It takes around 2 min and 5 GB of ram to compute all iterations (you end up with a list of breps, one per iteration).

In your definition you have the same slider to rotate the base box and also advance between the iterations. I assumed these should not be linked since previous iterations would change every time you rotate the box so I used two different sliders.

Also, if you prefer to use hoopsnake or anemone, there are a few components in your loop that can be placed outside the loop making it more efficient.

Attachments:

Holy crap that's amazing, I didn't know it was possible to consolidate grasshopper systems  into a script. Did it take long to do? I wonder if it's feasible for someone like me, who've never learned any coding beyond basic html, to learn how to do what you just did. I'm still tinkering with the configurations, making it more efficient and trying alternate setups, so it would be nice to compile it when I'm finished. At the very least, this script will allow me to animate the sequence overnight and see just how much changing the initial condition will affect the final geometry. Thanks!

I had been playing around with hoopsnake for a few hours earlier today and it gave me some ideas on some future projects. However it doesn't seem to let me animate depending on the initial geometry. In my setup I had the initial object slowly rotating as it animates. When I use hoopsnake I would have to right click on the component and click "loop" everytime. Is there a way to automate this?

Also, is there a way to clear the hoopsnake history, and only have it save the latest iteration for use in the next loop? For my next project I would need to run a very simple operation more than a thousand times, perhaps tens of thousands, so I can't have it cumulatively storing all previous iterations. I know there was a component someone wrote to render animations (http://www.grasshopper3d.com/forum/topics/renderanimation-by-giulio...) (it doesn't seem to work properly anymore so if anyone has an updated version I would be grateful!) that bakes the geometry, renders it, deletes it, moves the slider, and repeats. What I have in mind would be something similar: It would bake the geometry, reference it, internalize the data, delete the geometry, run it through the operation again, and repeat. Perhaps with the right coding it would skip the baking part. Would this be simple to make?

It didn't take long but the script is very basic, I didn't add any error handling so if a splitting or intersect operation fails the whole script will fail.

If I understand correctly, in the animation you want to rotate the original box and display the last iteration for every rotation value, right? (in the definition you had linked every iteration step to the animation).

I don't know if you can do that with hoopsnake automatically but I'm sure you can do it with anemone (another plugin that allows recursion).

If you want the script to output only the last iteration make these changes:

- Delete the line: List<Brep> brep_list = new List<Brep>(); 

- Delete the line: brep_list.Add(brep);

- Modify the line: A = brep_list; to A = brep;

Hey thanks again! I'll definitely check out anemone. Are there online tutorials somewhere that would teach me how to make scripts like these? It seems there are certain things you can do in scripts that you can't do in grasshopper alone. What is the name of this language?

It's C#, there's also VB.NET and Python. Python seems to be the more popular choice for beginners.

You'll find a lot learning resources on the internet. Not so many to use it inside Grasshopper but search this forum and you'll find some.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service