Thanks for sharing the link.
I’m unable to get the union/ join breps. I have tried looking through the forums and documentation but can’t seem to figure out, what I am doing wrong.
Any suggestions?
import rhinoinside
rhinoinside.load()
import Rhino
import System
import Rhino.Geometry
# rhino 3dm import
# from rhino3dm import *
import rhino3dm as r3d
import random
import compute_rhino3d
import compute_rhino3d.Util
import compute_rhino3d.Curve
import compute_rhino3d.Mesh
import compute_rhino3d.Intersection
import compute_rhino3d.Brep
# general pyhthon libs import
import base64
import json
import requests
# import
# Rhino compute by default launches on port 6500
compute_url = "http://localhost:6500//"
# set the URL
compute_rhino3d.Util.url = compute_url
# no auth token required
compute_rhino3d.Util.authToken = ""
# test, should return version object
version_test = requests.get(compute_url + '/version')
json.loads(version_test.content)
This runs and shows this output
{‘rhino’: ‘7.29.23107.3001’, ‘compute’: ‘1.0.0.0’, ‘git_sha’: None}
I am creating a rectangle and a triangle that share a common edge
# create one reactanble surface
surface1 = Rhino.Geometry.Brep.CreateFromCornerPoints(
Rhino.Geometry.Point3d(0.0,0.0,0.0),
Rhino.Geometry.Point3d(10.0,0.0,0.0),
Rhino.Geometry.Point3d(10.0,10.0,0.0),
Rhino.Geometry.Point3d(0.0,10.0,0.0),
3
)
# create one triangle surface
surface2 = Rhino.Geometry.Brep.CreateFromCornerPoints(
Rhino.Geometry.Point3d(10.0,0.0,0.0),
Rhino.Geometry.Point3d(10.0,10.0,0.0),
Rhino.Geometry.Point3d(20.0,0.0,0.0),
3
)
Then I’m creating a list
breps = System.Collections.Generic.List[Rhino.Geometry.Brep]()
breps.Add(surface1)
breps.Add(surface2)
breps
Which results in
<System.Collections.Generic.List[Brep] object at 0x000001703F178640>
Now I’m trying to join, but not getting any results
USing RHino Common
joined_brep =Rhino.Geometry.Brep.JoinBreps(breps,3)
joined_brep
<Rhino.Geometry.Brep object at 0x000001703F221600>
or
joined_brep2 = Rhino.Geometry.Brep.CreateBooleanUnion(breps, 3, manifoldOnly=True)
type(joined_brep2)
NoneType
or using compute_3d
compute_rhino3d.Brep.CreateBooleanUnion(breps, 3, multiple=False)
which results in this
TypeError Traceback (most recent call last)
Cell In[84], line 1
----> 1 compute_rhino3d.Brep.CreateBooleanUnion(breps, 3, multiple=False)
File c:\Users\<username>\mambaforge\envs\py031012\lib\site-packages\compute_rhino3d\Brep.py:1488, in CreateBooleanUnion(breps, tolerance, multiple)
1486 args = [breps, tolerance]
1487 if multiple: args = list(zip(breps, tolerance))
-> 1488 response = Util.ComputeFetch(url, args)
1489 response = Util.DecodeToCommonObject(response)
1490 return response
File c:\Users\<username>\mambaforge\envs\py031012\lib\site-packages\compute_rhino3d\Util.py:28, in ComputeFetch(endpoint, arglist)
26 else: posturl += '?stopat='
27 posturl += str(stopat)
---> 28 postdata = json.dumps(arglist, cls=__Rhino3dmEncoder)
29 headers = { 'User-Agent': 'compute.rhino3d.py/' + __version__ }
30 if authToken:
File c:\Users\<username>\mambaforge\envs\py031012\lib\json\__init__.py:238, in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
232 if cls is None:
233 cls = JSONEncoder
234 return cls(
235 skipkeys=skipkeys, ensure_ascii=ensure_ascii,
236 check_circular=check_circular, allow_nan=allow_nan, indent=indent,
...
178 """
--> 179 raise TypeError(f'Object of type {o.__class__.__name__} '
180 f'is not JSON serializable')
TypeError: Object of type List[Brep] is not JSON serializable