Playing with compute and rhino3dm at the moment and have few problems.
If I use example from
I paste token and everything is ok but if I don’t want to use Tkinter and try to store token in document as
auth_token = “my_token_from_compute_login”
compute_rhino3d.Util.authToken = auth_token
everything goes south…
get errors like
Traceback (most recent call last):
File "/home/lukasz/.local/lib/python2.7/site-packages/compute_rhino3d/Curve.py", line 552, in Split
response = Util.ComputeFetch("rhino/geometry/curve/split-curve_brep_double", args)
File "/home/lukasz/.local/lib/python2.7/site-packages/compute_rhino3d/Util.py", line 17, in ComputeFetch
response = urllib2.urlopen(req, json.dumps(args))
File "/usr/lib/python2.7/json/__init__.py", line 244, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <rhino3dm._rhino3dm.Circle object at 0x7fd41d28bb90> is not JSON serializable
I’m sure I’m doing something wrong.
Is there some way of storing token within document?
The other thing is when I look at
https://compute.rhino3d.com/sdk
there is tons of stuff like
2401 [/rhino/geometry/circle/getplane](https://compute.rhino3d.com/rhino/geometry/circle/getplane)
2402 [/rhino/geometry/circle/getradius](https://compute.rhino3d.com/rhino/geometry/circle/getradius)
2403 [/rhino/geometry/circle/getunset](https://compute.rhino3d.com/rhino/geometry/circle/getunset)
2404 [/rhino/geometry/circle/isinplane](https://compute.rhino3d.com/rhino/geometry/circle/isinplane)
but when I import compute_rhino3d.
I only get
-Curve
-Brep
-Util
-Extrusion
-NurbsCurve
-BezierCurve
How can I access all these methods?
My rhino3dm is in 0.0.7 and compute_rhino3d in 0.0.6
Running on Python 2.7 using Pycharm in virtualbox (ubuntu)
PS. I think rhino3dm and compute is a killer project!!
PS2.
@stevebaer
Your sample from
>>> from rhino3dm import *
>>> import compute_rhino3d.Util
>>> import compute_rhino3d.Mesh
>>>
>>> center = Point3d(250, 250, 0)
>>> sphere = Sphere(center, 100)
>>> brep = sphere.ToBrep()
>>> compute_rhino3d.Util.authToken = AUTH_TOKEN_FROM (rhino3d.com/compute/login)
>>> response = compute_rhino3d.Mesh.CreateFromBrep(brep)
>>> mesh = CommonObject.Decode(response[0])
>>> print("Computed mesh with {} faces".format(len(mesh.Faces))
Doesn’t work for me. I get…
Traceback (most recent call last):
File "/home/lukasz/PycharmProjects/t2/q2.py", line 7, in <module>
compute_rhino3d.Util.authToken = AUTH_TOKEN_FROM (rhino3d.com/compute/login)
NameError: name 'AUTH_TOKEN_FROM' is not defined