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 12 commits into
base: main
Choose a base branch
from
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Added `compas.geometry.angle_vectors_projected`.
* Added `compas.geometry.Brep.from_curves`.
* Added `compas_rhino.geometry.RhinoBrep.from_curves`.
* 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_compound` in `compas_rhino.geometry.RhinoBrep`.
* Added missing property `is_compoundsolid` 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`.

### Changed

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 @@
raise PluginNotInstalledError


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

Check warning on line 32 in src/compas/geometry/brep/__init__.py

View check run for this annotation

Codecov / codecov/patch

src/compas/geometry/brep/__init__.py#L32

Added line #L32 was not covered by tests


@pluggable(category="factories")
def from_cone(*args, **kwargs):
raise PluginNotInstalledError
Expand Down
30 changes: 14 additions & 16 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 @@ -327,22 +328,22 @@
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)

Check warning on line 343 in src/compas/geometry/brep/brep.py

View check run for this annotation

Codecov / codecov/patch

src/compas/geometry/brep/brep.py#L343

Added line #L343 was not covered by tests

@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 +355,7 @@
:class:`compas.geometry.Brep`

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

Check warning on line 358 in src/compas/geometry/brep/brep.py

View check run for this annotation

Codecov / codecov/patch

src/compas/geometry/brep/brep.py#L358

Added line #L358 was not covered by tests

@classmethod
def from_curves(cls, curves):
Expand Down Expand Up @@ -467,25 +468,22 @@
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)

Check warning on line 486 in src/compas/geometry/brep/brep.py

View check run for this annotation

Codecov / codecov/patch

src/compas/geometry/brep/brep.py#L486

Added line #L486 was not covered by tests

@classmethod
def from_plane(cls, plane, domain_u=(-1, +1), domain_v=(-1, +1)):
Expand Down Expand Up @@ -524,7 +522,7 @@
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 +534,7 @@
:class:`compas.geometry.Brep`

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

Check warning on line 537 in src/compas/geometry/brep/brep.py

View check run for this annotation

Codecov / codecov/patch

src/compas/geometry/brep/brep.py#L537

Added line #L537 was not covered by tests

@classmethod
def from_sphere(cls, sphere):
Expand Down Expand Up @@ -569,7 +567,7 @@
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 +582,7 @@
:class:`compas.geometry.Brep`

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

Check warning on line 585 in src/compas/geometry/brep/brep.py

View check run for this annotation

Codecov / codecov/patch

src/compas/geometry/brep/brep.py#L585

Added line #L585 was not covered by tests

@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