My C# script component works reliably but fails at the following line when the script executes on the Compute environment.
ghDoc = Grasshopper.Instances.ActiveCanvas.Document;
“Object reference not set to an instance”
I assume this is because Compute is headless.
I am trying to access the ActiveCanvas.Document
to iterate all the IGH_DocumentObjects on the canvas and then to log details about things to a log file.
Is there a workaround perhaps to create the grasshopper document headlessly - similar to creating a Rhino document headlessly (RhinoDoc.CreateHeadless Method) or perhaps to access the IGH_DocumentObjects of the canvas some other way?
@AndyPayne - tagging you on the hope that you see this as you know a lot about grasshopper and compute.