algorithmic modeling for Rhino
Is there a way to call solveinstance and after calculating it do not propagate the data ? I don't know if I'm calling things correcly, but let's say I would like to call me.expiresolution but after all I don't want the descending components to recalculate.
EDIT : and I would like to access the solveinstance of the component, so overriding expiresolution with "return" won't (?) do the job.
Tags:
ExpireSolution(false) won't cause a new solution. It will only expire the current object and any objects that depend on the current object. But it won't call SolveInstance either, that's the point.
You should not call SolveInstance directly, you need to provide a properly set up IGH_DataAccess instance and that's just too hard. What you can do is call ClearData(), CollectData() and ComputeData(), which basically solves the component without solving anything downstream.
However I fear that you are looking for a solution in the wrong direction. What exactly is the problem?
--
David Rutten
david@mcneel.com
I will just simplify it to the bare minimum, this is how the components looks like more-less :
public counter as integer
public limit as integer
byval overrides sub solveinstance(da as igh_dataaccess)
da.getdata(0,limit)
if counter < limit then
counter +=1
da.setdata(0,counter)
end if
end sub
The problem is that it's connected with gh_timer. When finally counter = limit timer still forces downstream objects to calculate. I partially resolved the problem overriding expiresolution with something like :
public overrides sub (recompute as boolean)
if counter = limit then
return
else
mybase.expiresolution(recompute)
end if
end sub
But when the user changes the limit somehow (with slider or panel or anything), nothing happens (it returns obviously). I tried to addhandler to this component to catch source... well, long story short - I crashed Rhino.
I will try with collectdata and computedata, maybe it'll work in this case.
EDIT : Sorry for a bit unclear text formatting.
Well, I did not test it in all cases yet, but seems that me.params.input(0).CollectData() does the job ! Thanks.
Public Overrides Sub ExpireSolution(recompute As Boolean)
If something Then
myBase.ExpireSolution(recompute)
Else
Return
End IfEnd Sub
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by