Bug: Grasshopper Scripts compiled into plugin commands return out of date results

I have a grasshopper file that has two nodes:

*A C# node that outputs System.DateTime.Now.ToString()
*A Context Print that reads that data back out to Rhino

I compile this GH script into a plugin and import it into Rhino as a command.
The first time I run the script, it will return the correct timestamp. Any future time I run the command, it will return the old timestamp.

I assume that because the tool has no inputs, the configuration of the script is being cached and returned to save calculation time.

Any ideas of how to fix this behavior?

1 Like

When do you call this, and where do you store that? Can you provide the 1-2 lines of code?

CICDTest.rhp (13 KB)
dateTimeTest.gh (3.4 KB)
cicdtest.txt (756 Bytes)

CICDtest.txt needs to be renamed to rhc

The expected behavior, which is that the current datetime is called on each execution, occurs if the script is called via the grasshopper player. So what we’re doing at the moment for our drafting team is making a dummy command in the rhp that calls the actual gh script.

import Rhino as r

path = “path\\to\\script\\folder\\script.gh”

r.RhinoApp.RunScript(“-GrasshopperPlayer \”" + path + “\”", False)
r.RhinoApp.WriteLine(“Run Complete”)

@will this is related to our CI/CD conversation earlier - can you confirm if Grasshopper scripts with identical inputs from Rhino’s perspective cache old results?

@stevebaer can you please take a look at this compiled-Grasshopper-command caching issue?

I logged this at https://mcneel.myjetbrains.com/youtrack/issue/RH-65033 and will try to find some time in the next week to take a look.

Cheers folks!

@stevebaer happy to test anything you want tested by the way.

Try the Script Compiler that becomes available when the next Rhino 8 WIP is out. That will have the changes I made for 7.10

Cheers Steve, I’ll wait for that.