Grasshopper

algorithmic modeling for Rhino

Up until now I have not had to mess with GH's default behavior regarding solutions. However I am trying to develop a component X which will cause a complete recalculation of all downstream components multiple times (with different input values) from within X's SolveInstance. I want this to behave something like the way the slider animation process updates its value repeatedly, or the way galapagos functions when recalculating a new genome. I've come across the "ExpireDownStreamObjects()" method but I am definitely missing something in how to properly deploy it because currently it just causes my custom component to throw all kinds of errors. 

 

Suggestions?

Views: 317

Replies to This Discussion

Hi Andy,

 

the one thing you should never ever do is start new solutions from within existing ones. It will result in all manner of nasty bugs and maybe even crashes due to stack-overflow.

 

There's a method on GH_Document called ScheduleSolution which allows you to.. well, schedule a solution some time in the future. Don't use a 0ms delay either, but rather use 1ms if you want as soon as possible while keeping safe.

 

You can provide a callback method when scheduling solutions. You can use this callback (which is called just before the scheduled solution kicks in) to expire whatever objects you need. If you merely want to expire a specific component and all its descendants, Object.ExpireSolution(False) would be a good place to start.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service