Simulate a button click with python

You could simplify things by also scripting the GHPython component to update itself (i.e. instead of using a timer and plugins). This function should do it:

import Grasshopper as gh

def updateComponent(interval):
    
    """ Updates this component, similar to using a grasshopper timer """
    
    # Define callback action
    def callBack(e):
        ghenv.Component.ExpireSolution(False)
        
    # Get grasshopper document
    ghDoc = ghenv.Component.OnPingDocument()
    
    # Schedule this component to expire at interval
    ghDoc.ScheduleSolution(interval,gh.Kernel.GH_Document.GH_ScheduleDelegate(callBack))
6 Likes