algorithmic modeling for Rhino
I've been playing around (so far mostly unsuccessfully) with a component that only expires its solution under certain conditions. The basic idea is to have a component that only expires if its input changes - so that new values cause downstream components to update, but repeats of the same data do not cause an update. (e.g. repeatedly passing true to this component will not produce a new true value on the output side).
I have come close by overriding ExpireDownStreamObjects to only call the base function when a comparison test with the previously stored value is false, but I seem to always get one "extra" expire the first time the value is the same. I am somewhat unclear on what the exact sequence of events is when a component runs - when SolveInstance is called, when ExpireSolution and ExpireDownStreamObjects are called, etc. Thoughts/Clarifications?
Tags:
Something happens somewhere which causes a parameter (it's almost always parameters which are expired) to become stale. The ExpireSolution(bool) method is then called on that parameter. This causes the data inside that parameter to be cleared, all runtime messages/warnings/errors to be erased and the SolutionPhase to be set to GH_SolutionPhase.Blank
Then the ExpireDownstreamObjects method is called which recursively applies the above logic to anything attached to the parameter in question.
To properly change the behaviour you'd have to override ExpireSolution(bool) and decide whether or not to call the base class method based on your data-state check. Does that work any better?
If the data that expires you comes from someplace else then of course it becomes impossible to be smart about this because you don't know whether the new data is the same as the old data until the next solution runs, at which point it will be too late to decide whether to expire or not.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2025 Created by Scott Davidson.
Powered by