Got this error while trying to access rhino compute locally. Imported rhino compute at the beginning and used an authentication token. Any ideas what I am missing here?

Try explicitly importing compute_rhino3d.Curve. Here’s a working sample.

import compute_rhino3d.Util
import compute_rhino3d.Curve
from rhino3dm import Point3d, Circle, Plane, CurveOffsetCornerStyle, File3dm

compute_rhino3d.Util.url = 'http://localhost:8081/' # url of your local compute server

circle = Circle(Point3d(0,0,0), 12)
plane = Plane.WorldXY()
# print(int(CurveOffsetCornerStyle.Sharp)) # ==> 1
style = 1

crvs = compute_rhino3d.Curve.Offset(circle.ToNurbsCurve(), plane, 6, 0.01, 0)

print(crvs)
# [<rhino3dm._rhino3dm.ArcCurve object at 0x1019a6830>]

f = File3dm()
f.Objects.AddCircle(circle)
for crv in crvs:
    f.Objects.AddCurve(crv)
f.Write('circls.3dm', 6)

Note that the enum CurveOffsetCornerStyle doesn’t serialise properly, so you’ll need to use the integer value.

1 Like

Thanks for the detailed reply, its working that way. While we are on the topic, any idea why the Curve.Contains(point) function [point in polygon algorithm] is considerably slower for compute when compared to RhinoCommon?

Most likely because we cache information on geometry to improve performance when searching for answers to geometric questions. This cached data is not serialized to compute and needs to be rebuilt on the compute server. If you create a brand new curve from scratch locally, you will most likely see a slower result time the first time something like Contains is called.

1 Like

Thanks for the reply. That explains other similar issues.