RhinoCompute Decode property error

Hello All,
I am interested in learning rhinocompute and was following Junricho Horikawa’s youtube tutorial. However, these are some of the issues which I encounter. Below is the sample code. Auth token is
not mentioned here. I am using PyCharm IDE and Decode property has some issue

CODE>>>>

import rhino3dm
import random
import compute_rhino3d
import compute_rhino3d.Util
import compute_rhino3d.Curve

model = rhino3dm.File3dm()

compute_rhino3d.Util.authToken = “-----”

curves =

for i in range(20):
pt = rhino3dm.Point3d(random.uniform(-10,10),random.randint(-10,10),0)
circle = rhino3dm.Circle(pt,random.uniform(1,4))
curve = circle.ToNurbsCurve()
curves.append(curve)

bcurves = compute_rhino3d.Curve.CreateBooleanUnion(curves)

for bcurve in bcurves:
bcurveObj = rhino3dm.CommonObject.Decode(bcurve)
model.Objects.AddCurve(bcurveObj)

model.Write(‘boolean2d.3dm’,6)

Error on PyCharm IDE >>>

line 39, in
bcurveObj = rhino3dm.CommonObject.Decode(bcurve)
TypeError: Decode(): incompatible function arguments. The following argument types are supported:
1. (jsonObject: dict) -> rhino3dm._rhino3dm.CommonObject

Invoked with: <rhino3dm._rhino3dm.NurbsCurve object at 0x000001E485F80CB0>

Moved to #serengeti:compute-rhino3d category.

Any help would be much appreciated. Thank you all!

Hey @_AS, the CreateBooleanUnion() function returns rhino3dm.NurbsCurve[]. There’s no need to decode them again.

import rhino3dm
import random
import compute_rhino3d.Util
import compute_rhino3d.Curve

model = rhino3dm.File3dm()

compute_rhino3d.Util.authToken =  'ADD_TOKEN_HERE'

curves = []

for i in range(20):
    pt = rhino3dm.Point3d(random.uniform(-10,10),random.randint(-10,10),0)
    circle = rhino3dm.Circle(pt,random.uniform(1,4))
    curve = circle.ToNurbsCurve()
    curves.append(curve)

bcurves = compute_rhino3d.Curve.CreateBooleanUnion(curves)

for bcurve in bcurves:
    # bcurveObj = rhino3dm.CommonObject.Decode(bcurve)
    model.Objects.AddCurve(bcurve)

model.Write('boolean2d.3dm', 6)
1 Like