Has anyone experimented with compute_rhino3d.Util.PythonEvaluate(script, input, output)?
It’s supposed to take a python script as a string and evaluate that inside compute server and return the result, I just started playing around and it seems to exactly do that.
Well I tested it with a very basic example below:
script="""
c=a+b
"""
result = compute_rhino3d.Util.PythonEvaluate(script,{"a":3, "b":5},["c"])
And I get result = {c: 8}
But I’m running into issues trying to get non-text outputs out. For example:
script="""
import Rhino
plane = Rhino.Geometry.Plane.WorldXY
c = Rhino.Geometry.Circle(plane,r)
"""
result = compute_rhino3d.Util.PythonEvaluate(script,{"r":3},["c"])
Gives me the error below:
PythonEvaluate
output = rhino3dm.ArchivableDictionary.DecodeDict(json.loads(response))
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 341, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
Which I think means that the output is not the type expected.
My question is what’s the proper way to convert the circle in this case to an accepted type (str, bytes or bytearray) that can be decoded to rhino geometry later in the host application using rhino3dm.CommonObject.Decode(data)
?