Skip to content

Commit dc6f2de

Browse files
authored
Merge pull request #1459 from compas-dev/rhinobrep_props
added missing properties to RhinoBrep
2 parents 0dfc019 + cbdbc45 commit dc6f2de

File tree

6 files changed

+477
-52
lines changed

6 files changed

+477
-52
lines changed

CHANGELOG.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
* Added test function `test_to_points` in `test_volmesh.py`.
2020
* Added test functions `test_to_points`, `test_compute_aabb`, and `test_compute_obb` in `test_mesh.py`.
2121
* Added setters for `SceneObject.worldtransformation` and `SceneObject.frame`, which automatically handles the parent transformations.
22-
23-
### Changed
24-
25-
### Removed
26-
22+
* Added missing property `centroid` in `compas_rhino.geometry.RhinoBrep`.
23+
* Added missing property `curves` in `compas_rhino.geometry.RhinoBrep`.
24+
* Added missing property `is_closed` in `compas_rhino.geometry.RhinoBrep`.
25+
* Added missing property `is_orientable` in `compas_rhino.geometry.RhinoBrep`.
26+
* Added missing property `is_surface` in `compas_rhino.geometry.RhinoBrep`.
27+
* Added missing property `is_valid` in `compas_rhino.geometry.RhinoBrep`.
28+
* Added missing property `orientation` in `compas_rhino.geometry.RhinoBrep`.
29+
* Added missing property `surfaces` in `compas_rhino.geometry.RhinoBrep`.
30+
* Added implementation for `Brep.from_sweep` in `compas_rhino.geometry.RhinoBrep`.
31+
* Added implementation for `Brep.from_cone` in `compas_rhino.geometry.RhinoBrep`.
32+
* Added implementation for `Brep.from_plane` in `compas_rhino.geometry.RhinoBrep`.
33+
* Added implementation for `Brep.from_brepfaces` in `compas_rhino.geometry.RhinoBrep`.
34+
* Added implementation for `Brep.from_breps` in `compas_rhino.geometry.RhinoBrep`.
35+
* Added implementation for `Brep.from_torus` in `compas_rhino.geometry.RhinoBrep`.
36+
* Added implementation for `Brep.from_polygons` in `compas_rhino.geometry.RhinoBrep`.
37+
* Added implementation for `Brep.from_pipe` in `compas_rhino.geometry.RhinoBrep`.
38+
* Added implementation for `Brep.from_iges` in `compas_rhino.geometry.RhinoBrep`.
39+
* Added implementation for `Brep.to_step` in `compas_rhino.geometry.RhinoBrep`.
40+
* Added implementation for `Brep.to_viewmesh()` in `compas_rhino.geometry.RhinoBrep`.
41+
42+
### Changed
43+
44+
### Removed
45+
46+
* Removed property `is_compound` from `compas.geometry.Brep` as OCC specific.
47+
* Removed property `is_compoundsolid` from `compas.geometry.Brep` as OCC specific.
48+
* Removed property `solids` from `compas.geometry.Brep` as OCC specific.
49+
* Removed property `shells` from `compas.geometry.Brep` as OCC specific.
2750

2851
## [2.13.0] 2025-06-04
2952

src/compas/geometry/brep/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ def from_brepfaces(*args, **kwargs):
2727
raise PluginNotInstalledError
2828

2929

30+
@pluggable(category="factories")
31+
def from_breps(*args, **kwargs):
32+
raise PluginNotInstalledError
33+
34+
3035
@pluggable(category="factories")
3136
def from_cone(*args, **kwargs):
3237
raise PluginNotInstalledError

src/compas/geometry/brep/brep.py

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from . import from_boolean_union
66
from . import from_box
77
from . import from_brepfaces
8+
from . import from_breps
89
from . import from_cone
910
from . import from_curves
1011
from . import from_cylinder
@@ -176,30 +177,10 @@ def native_brep(self):
176177
def orientation(self):
177178
raise NotImplementedError
178179

179-
@property
180-
def type(self):
181-
raise NotImplementedError
182-
183180
@property
184181
def is_valid(self):
185182
raise NotImplementedError
186183

187-
@property
188-
def is_shell(self):
189-
raise NotImplementedError
190-
191-
@property
192-
def is_solid(self):
193-
raise NotImplementedError
194-
195-
@property
196-
def is_compound(self):
197-
raise NotImplementedError
198-
199-
@property
200-
def is_compoundsolid(self):
201-
raise NotImplementedError
202-
203184
@property
204185
def is_orientable(self):
205186
raise NotImplementedError
@@ -327,22 +308,22 @@ def from_brepfaces(cls, faces):
327308
return from_brepfaces(faces)
328309

329310
@classmethod
330-
def from_breps(cls, breps):
311+
def from_breps(cls, breps, *args, **kwargs):
331312
"""Construct one compound Brep from a list of other Breps.
332313
333314
Parameters
334315
----------
335-
breps : list[:class:`compas.geometry.Brep`]
316+
breps : list of :class:`compas.geometry.Brep`
336317
337318
Returns
338319
-------
339-
:class:`compas.geometry.Brep`
320+
list of :class:`compas.geometry.Brep`
340321
341322
"""
342-
raise NotImplementedError
323+
return from_breps(breps, *args, **kwargs)
343324

344325
@classmethod
345-
def from_cone(cls, cone):
326+
def from_cone(cls, cone, *args, **kwargs):
346327
"""Construct a Brep from a COMPAS cone.
347328
348329
Parameters
@@ -354,7 +335,7 @@ def from_cone(cls, cone):
354335
:class:`compas.geometry.Brep`
355336
356337
"""
357-
return from_cone(cone)
338+
return from_cone(cone, *args, **kwargs)
358339

359340
@classmethod
360341
def from_curves(cls, curves):
@@ -467,25 +448,22 @@ def from_native(cls, native_brep):
467448
return from_native(native_brep)
468449

469450
@classmethod
470-
def from_pipe(cls, curve, radius, thickness=None):
471-
"""Construct a Brep by extruding a closed curve along a path curve.
451+
def from_pipe(cls, path, radius, *args, **kwargs):
452+
"""Construct a Brep by extruding a circle curve along the path curve.
472453
473454
Parameters
474455
----------
475456
curve : :class:`compas.geometry.Curve`
476457
The curve to extrude
477458
radius : float
478459
The radius of the pipe.
479-
thickness : float, optional
480-
The thickness of the pipe.
481-
The thickness should be smaller than the radius.
482460
483461
Returns
484462
-------
485463
:class:`compas.geometry.Brep`
486464
487465
"""
488-
return from_pipe(curve, radius, thickness=thickness)
466+
return from_pipe(path, radius, *args, **kwargs)
489467

490468
@classmethod
491469
def from_plane(cls, plane, domain_u=(-1, +1), domain_v=(-1, +1)):
@@ -524,7 +502,7 @@ def from_planes(cls, planes):
524502
return from_planes(planes)
525503

526504
@classmethod
527-
def from_polygons(cls, polygons):
505+
def from_polygons(cls, polygons, *args, **kwargs):
528506
"""Construct a Brep from a set of polygons.
529507
530508
Parameters
@@ -536,7 +514,7 @@ def from_polygons(cls, polygons):
536514
:class:`compas.geometry.Brep`
537515
538516
"""
539-
return from_polygons(polygons)
517+
return from_polygons(polygons, *args, **kwargs)
540518

541519
@classmethod
542520
def from_sphere(cls, sphere):
@@ -569,7 +547,7 @@ def from_step(cls, filename):
569547
return from_step(filename)
570548

571549
@classmethod
572-
def from_sweep(cls, profile, path):
550+
def from_sweep(cls, profile, path, *args, **kwargs):
573551
"""Construct a BRep by sweeping a profile along a path.
574552
575553
Parameters
@@ -584,7 +562,7 @@ def from_sweep(cls, profile, path):
584562
:class:`compas.geometry.Brep`
585563
586564
"""
587-
return from_sweep(profile, path)
565+
return from_sweep(profile, path, *args, **kwargs)
588566

589567
@classmethod
590568
def from_torus(cls, torus):

src/compas_rhino/geometry/brep/__init__.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@ def from_box(*args, **kwargs):
2525
return RhinoBrep.from_box(*args, **kwargs)
2626

2727

28+
@plugin(category="factories", requires=["Rhino"])
29+
def from_brepfaces(*args, **kwargs):
30+
return RhinoBrep.from_brepfaces(*args, **kwargs)
31+
32+
33+
@plugin(category="factories", requires=["Rhino"])
34+
def from_breps(*args, **kwargs):
35+
return RhinoBrep.from_breps(*args, **kwargs)
36+
37+
38+
@plugin(category="factories", requires=["Rhino"])
39+
def from_cone(*args, **kwargs):
40+
return RhinoBrep.from_cone(*args, **kwargs)
41+
42+
2843
@plugin(category="factories", requires=["Rhino"])
2944
def from_cylinder(*args, **kwargs):
3045
return RhinoBrep.from_cylinder(*args, **kwargs)
@@ -40,6 +55,11 @@ def from_curves(*args, **kwargs):
4055
return RhinoBrep.from_curves(*args, **kwargs)
4156

4257

58+
@plugin(category="factories", requires=["Rhino"])
59+
def from_iges(*args, **kwargs):
60+
return RhinoBrep.from_iges(*args, **kwargs)
61+
62+
4363
@plugin(category="factories", requires=["Rhino"])
4464
def from_loft(*args, **kwargs):
4565
return RhinoBrep.from_loft(*args, **kwargs)
@@ -55,6 +75,21 @@ def from_native(*args, **kwargs):
5575
return RhinoBrep.from_native(*args, **kwargs)
5676

5777

78+
@plugin(category="factories", requires=["Rhino"])
79+
def from_plane(*args, **kwargs):
80+
return RhinoBrep.from_plane(*args, **kwargs)
81+
82+
83+
@plugin(category="factories", requires=["Rhino"])
84+
def from_polygons(*args, **kwargs):
85+
return RhinoBrep.from_polygons(*args, **kwargs)
86+
87+
88+
@plugin(category="factories", requires=["Rhino"])
89+
def from_pipe(*args, **kwargs):
90+
return RhinoBrep.from_pipe(*args, **kwargs)
91+
92+
5893
@plugin(category="factories", requires=["Rhino"])
5994
def from_sphere(*args, **kwargs):
6095
return RhinoBrep.from_sphere(*args, **kwargs)
@@ -65,6 +100,16 @@ def from_step(*args, **kwargs):
65100
return RhinoBrep.from_step(*args, **kwargs)
66101

67102

103+
@plugin(category="factories", requires=["Rhino"])
104+
def from_sweep(*args, **kwargs):
105+
return RhinoBrep.from_sweep(*args, **kwargs)
106+
107+
108+
@plugin(category="factories", requires=["Rhino"])
109+
def from_torus(*args, **kwargs):
110+
return RhinoBrep.from_torus(*args, **kwargs)
111+
112+
68113
@plugin(category="factories", requires=["Rhino"])
69114
def new_brep(*args, **kwargs):
70115
return object.__new__(RhinoBrep)

0 commit comments

Comments
 (0)