Skip to content

added missing properties to RhinoBrep #1459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Added test function `test_to_points` in `test_volmesh.py`.
* Added test functions `test_to_points`, `test_compute_aabb`, and `test_compute_obb` in `test_mesh.py`.
* Added setters for `SceneObject.worldtransformation` and `SceneObject.frame`, which automatically handles the parent transformations.

### Changed

### Removed

* Added missing property `centroid` in `compas_rhino.geometry.RhinoBrep`.
* Added missing property `curves` in `compas_rhino.geometry.RhinoBrep`.
* Added missing property `is_closed` in `compas_rhino.geometry.RhinoBrep`.
* Added missing property `is_orientable` in `compas_rhino.geometry.RhinoBrep`.
* Added missing property `is_surface` in `compas_rhino.geometry.RhinoBrep`.
* Added missing property `is_valid` in `compas_rhino.geometry.RhinoBrep`.
* Added missing property `orientation` in `compas_rhino.geometry.RhinoBrep`.
* Added missing property `surfaces` in `compas_rhino.geometry.RhinoBrep`.
* Added implementation for `Brep.from_sweep` in `compas_rhino.geometry.RhinoBrep`.
* Added implementation for `Brep.from_cone` in `compas_rhino.geometry.RhinoBrep`.
* Added implementation for `Brep.from_plane` in `compas_rhino.geometry.RhinoBrep`.
* Added implementation for `Brep.from_brepfaces` in `compas_rhino.geometry.RhinoBrep`.
* Added implementation for `Brep.from_breps` in `compas_rhino.geometry.RhinoBrep`.
* Added implementation for `Brep.from_torus` in `compas_rhino.geometry.RhinoBrep`.
* Added implementation for `Brep.from_polygons` in `compas_rhino.geometry.RhinoBrep`.
* Added implementation for `Brep.from_pipe` in `compas_rhino.geometry.RhinoBrep`.
* Added implementation for `Brep.from_iges` in `compas_rhino.geometry.RhinoBrep`.
* Added implementation for `Brep.to_step` in `compas_rhino.geometry.RhinoBrep`.

### Changed

### Removed

* Removed property `is_compound` from `compas.geometry.Brep` as OCC specific.
* Removed property `is_compoundsolid` from `compas.geometry.Brep` as OCC specific.
* Removed property `solids` from `compas.geometry.Brep` as OCC specific.
* Removed property `shells` from `compas.geometry.Brep` as OCC specific.

## [2.13.0] 2025-06-04

Expand Down
5 changes: 5 additions & 0 deletions src/compas/geometry/brep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ def from_brepfaces(*args, **kwargs):
raise PluginNotInstalledError


@pluggable(category="factories")
def from_breps(*args, **kwargs):
raise PluginNotInstalledError


@pluggable(category="factories")
def from_cone(*args, **kwargs):
raise PluginNotInstalledError
Expand Down
50 changes: 14 additions & 36 deletions src/compas/geometry/brep/brep.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from . import from_boolean_union
from . import from_box
from . import from_brepfaces
from . import from_breps
from . import from_cone
from . import from_curves
from . import from_cylinder
Expand Down Expand Up @@ -176,30 +177,10 @@ def native_brep(self):
def orientation(self):
raise NotImplementedError

@property
def type(self):
raise NotImplementedError

@property
def is_valid(self):
raise NotImplementedError

@property
def is_shell(self):
raise NotImplementedError

@property
def is_solid(self):
raise NotImplementedError

@property
def is_compound(self):
raise NotImplementedError

@property
def is_compoundsolid(self):
raise NotImplementedError

@property
def is_orientable(self):
raise NotImplementedError
Expand Down Expand Up @@ -327,22 +308,22 @@ def from_brepfaces(cls, faces):
return from_brepfaces(faces)

@classmethod
def from_breps(cls, breps):
def from_breps(cls, breps, *args, **kwargs):
"""Construct one compound Brep from a list of other Breps.

Parameters
----------
breps : list[:class:`compas.geometry.Brep`]
breps : list of :class:`compas.geometry.Brep`

Returns
-------
:class:`compas.geometry.Brep`
list of :class:`compas.geometry.Brep`

"""
raise NotImplementedError
return from_breps(breps, *args, **kwargs)

@classmethod
def from_cone(cls, cone):
def from_cone(cls, cone, *args, **kwargs):
"""Construct a Brep from a COMPAS cone.

Parameters
Expand All @@ -354,7 +335,7 @@ def from_cone(cls, cone):
:class:`compas.geometry.Brep`

"""
return from_cone(cone)
return from_cone(cone, *args, **kwargs)

@classmethod
def from_curves(cls, curves):
Expand Down Expand Up @@ -467,25 +448,22 @@ def from_native(cls, native_brep):
return from_native(native_brep)

@classmethod
def from_pipe(cls, curve, radius, thickness=None):
"""Construct a Brep by extruding a closed curve along a path curve.
def from_pipe(cls, path, radius, *args, **kwargs):
"""Construct a Brep by extruding a circle curve along the path curve.

Parameters
----------
curve : :class:`compas.geometry.Curve`
The curve to extrude
radius : float
The radius of the pipe.
thickness : float, optional
The thickness of the pipe.
The thickness should be smaller than the radius.

Returns
-------
:class:`compas.geometry.Brep`

"""
return from_pipe(curve, radius, thickness=thickness)
return from_pipe(path, radius, *args, **kwargs)

@classmethod
def from_plane(cls, plane, domain_u=(-1, +1), domain_v=(-1, +1)):
Expand Down Expand Up @@ -524,7 +502,7 @@ def from_planes(cls, planes):
return from_planes(planes)

@classmethod
def from_polygons(cls, polygons):
def from_polygons(cls, polygons, *args, **kwargs):
"""Construct a Brep from a set of polygons.

Parameters
Expand All @@ -536,7 +514,7 @@ def from_polygons(cls, polygons):
:class:`compas.geometry.Brep`

"""
return from_polygons(polygons)
return from_polygons(polygons, *args, **kwargs)

@classmethod
def from_sphere(cls, sphere):
Expand Down Expand Up @@ -569,7 +547,7 @@ def from_step(cls, filename):
return from_step(filename)

@classmethod
def from_sweep(cls, profile, path):
def from_sweep(cls, profile, path, *args, **kwargs):
"""Construct a BRep by sweeping a profile along a path.

Parameters
Expand All @@ -584,7 +562,7 @@ def from_sweep(cls, profile, path):
:class:`compas.geometry.Brep`

"""
return from_sweep(profile, path)
return from_sweep(profile, path, *args, **kwargs)

@classmethod
def from_torus(cls, torus):
Expand Down
45 changes: 45 additions & 0 deletions src/compas_rhino/geometry/brep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ def from_box(*args, **kwargs):
return RhinoBrep.from_box(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_brepfaces(*args, **kwargs):
return RhinoBrep.from_brepfaces(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_breps(*args, **kwargs):
return RhinoBrep.from_breps(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_cone(*args, **kwargs):
return RhinoBrep.from_cone(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_cylinder(*args, **kwargs):
return RhinoBrep.from_cylinder(*args, **kwargs)
Expand All @@ -40,6 +55,11 @@ def from_curves(*args, **kwargs):
return RhinoBrep.from_curves(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_iges(*args, **kwargs):
return RhinoBrep.from_iges(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_loft(*args, **kwargs):
return RhinoBrep.from_loft(*args, **kwargs)
Expand All @@ -55,6 +75,21 @@ def from_native(*args, **kwargs):
return RhinoBrep.from_native(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_plane(*args, **kwargs):
return RhinoBrep.from_plane(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_polygons(*args, **kwargs):
return RhinoBrep.from_polygons(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_pipe(*args, **kwargs):
return RhinoBrep.from_pipe(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_sphere(*args, **kwargs):
return RhinoBrep.from_sphere(*args, **kwargs)
Expand All @@ -65,6 +100,16 @@ def from_step(*args, **kwargs):
return RhinoBrep.from_step(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_sweep(*args, **kwargs):
return RhinoBrep.from_sweep(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def from_torus(*args, **kwargs):
return RhinoBrep.from_torus(*args, **kwargs)


@plugin(category="factories", requires=["Rhino"])
def new_brep(*args, **kwargs):
return object.__new__(RhinoBrep)
Loading
Loading