Recompute Button

I was just in need of this myself (for a one-click Recompute Solution from the RCP) and ended up here. I’m not sure if this GHPython approach (based on David’s advice above) would be considered super correct, but it does appear to do the trick:

def ghSolutionRecompute():
    
    """ Recomputes the Grasshopper solution (ala pressing F5) """
    
    def expireAllComponentsButThis(e):
        for obj in ghenv.Component.OnPingDocument().Objects:
            if not obj.InstanceGuid == ghenv.Component.InstanceGuid:
                obj.ExpireSolution(False)
                
    ghenv.Component.OnPingDocument().ScheduleSolution(1000,expireAllComponentsButThis)

191001_RecomputeSolution_GHPython_00.gh (4.3 KB)

In case others end up here while searching.

12 Likes