Live update Date and Time?

I think you want to call expire solution with a time step…
reference code here

It was something like this :

  private void RunScript(ref object D, ref object Y, ref object M, ref object D, ref object h, ref object m, ref object s)
  {

    now = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");

    String[] dateList = now.Split((char) 32);
    string YMD = dateList[0];
    string hms = dateList[1];
    
    String[] YMDList = YMD.Split((char) 47);
    String[] hmsList = hms.Split((char) 58);
    
    Date = now;
    Y = YMDList[2];
    M = YMDList[0];
    D = YMDList[1];
    h = hmsList[0];
    m = hmsList[1];
    s = hmsList[2];
    
    GrasshopperDocument.ScheduleSolution(1000, ScheduleSolutionCallback);
  }

  // <Custom additional code> 

  string now;

  public void ScheduleSolutionCallback(GH_Document doc)
  {
    this.Component.ExpireSolution(false);
  }

  // </Custom additional code> 
}

date_NOW.gh (5.7 KB)

Keep in mind that every second, Grasshopper thinks you’ve modified the definition.
You’ll pretty much have the small " * " on the top left, next to the name of your file :slight_smile:

3 Likes