Hello, how can I enable the solution of my grasshopper document?
Example from https://github.com/mcneel/rhino.inside-cpython.
The attributes of the document already state that the document is enabled, but it does not work as expected, even with ExpireSolution.
import rhinoinside
rhinoinside.load()
filePath =r"simple_def (1).gh"
Rhino = rhinoinside.Rhino
#Start grasshopper in "headless" mode
pluginObject = Rhino.RhinoApp.GetPlugInObject("Grasshopper")
if pluginObject:
pluginObject.RunHeadless()
import Grasshopper
io = Grasshopper.Kernel.GH_DocumentIO()
if not io.Open(filePath):
print("File loading failed.")
else:
doc = io.Document
doc.Enabled = True
doc.ExpireSolution()
for obj in doc.Objects:
try:
param = Grasshopper.Kernel.IGH_Param(obj)
except:
continue
#look for param with nickname "CollectMe"
if param.NickName == "CollectMe":
param.CollectData()
param.ComputeData()
for item in param.VolatileData.AllData(True):
try:
success, line = item.CastTo(Rhino.Geometry.Line())
if success: print("Got a Line: {}".format(line))
except:
pass
Got a Line: -5.5574407422041,12.7579864904777,0,-3.39439210003612,-2.61104333545273,0
doc.Enabled, doc.EnableSolutions
(True, True)
The solution itself does not get executed, how can I do it?
I can only trigger the parameters by param.CollectData() and param.ComputeData(), but not the whole solution.