Passing information from python to GH

workshop_step6.ghx (118.5 KB)

import compute_rhino3d.Util
import compute_rhino3d.Grasshopper as gh
import rhino3dm
import json

compute_rhino3d.Util.authToken = “”
compute_rhino3d.Util.url = “http://127.0.0.1:8085/

pt1 = rhino3dm.Point3d(0, 0, 0)
circle = rhino3dm.Circle(pt1, 5)
angle = 20

curve = json.dumps(circle.ToNurbsCurve().Encode())

curve_tree = gh.DataTree(“RH_IN:curve”)
curve_tree.Append([0], [curve])
rotate_tree = gh.DataTree(“RH_IN:rotate”)
rotate_tree.Append([0], [angle])
trees = [curve_tree, rotate_tree]

output = gh.EvaluateDefinition(‘workshop_step6.ghx’, trees)
print(output)

Can someone please help me with this issue?
I’m trying to pass information from python to GH with grate difficulties.

the “ghx” file is in the same directory.

after the last update, the decoder seems to have some problems, what am I doing wrong?
Thx for your help!

check out GitHub - mcneel/compute.rhino3d.appserver: A node.js server for solving Grasshopper definitions on Rhino Compute, it makes evaluating grasshopper definitions easier, if you don’t need to use python

there are some talks and presentations about it, it’s really nice

What do I do if I need to use python? :smiley:

I have built a larger script with multiple GH files; the idea was to create a self-standing application capable of computing multiple multi-objective optimization instances based on pymoo. This application suffers from the same issues as described here. I’m a bit under pressure since I need to present this work, it is part of a Master’s thesis, and it worked until one week ago :grimacing:

All the help is highly appreciated!

What changed in the meantime of two weeks?
If all you did is pulling new commits from the github repo and recompile, you can checkout older commits and check if it works.
Have you tried evaluating a simple grasshopper definition with compute?
What steps did you take to isolate the problem?

Please post your rhino.compute logs.