Skip to content

Commit 1667ef2

Browse files
committed
Rhino.from_extrusion also takes Polyline
1 parent 649a844 commit 1667ef2

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818

1919
### Changed
2020

21+
* Added support for `Polyline` as input for `compas_rhino.Brep.from_extrusion`.
22+
2123
### Removed
2224

2325

src/compas/geometry/brep/brep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def from_extrusion(cls, curve, vector, cap_ends=True):
392392
393393
Parameters
394394
----------
395-
curve : :class:`compas.geometry.Curve`
395+
curve : :class:`compas.geometry.Curve` or :class:`compas.geometry.Polyline`
396396
The curve to extrude
397397
vector : :class:`compas.geometry.Vector`
398398
The vector to extrude the curve by

src/compas_rhino/geometry/brep/brep.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from compas.geometry import Frame
1111
from compas.geometry import Plane
1212
from compas.geometry import Point
13+
from compas.geometry import Polyline
1314
from compas.tolerance import TOL
1415
from compas_rhino.conversions import box_to_rhino
1516
from compas_rhino.conversions import curve_to_compas
@@ -19,6 +20,7 @@
1920
from compas_rhino.conversions import mesh_to_rhino
2021
from compas_rhino.conversions import plane_to_rhino
2122
from compas_rhino.conversions import point_to_rhino
23+
from compas_rhino.conversions import polyline_to_rhino_curve
2224
from compas_rhino.conversions import sphere_to_rhino
2325
from compas_rhino.conversions import transformation_to_rhino
2426
from compas_rhino.conversions import vector_to_rhino
@@ -223,7 +225,7 @@ def from_extrusion(cls, curve, vector, cap_ends=True):
223225
224226
Parameters
225227
----------
226-
curve : :class:`~compas.geometry.Curve`
228+
curve : :class:`~compas.geometry.Curve` or :class:`~compas.geometry.Polyline`
227229
The curve to extrude.
228230
vector : :class:`~compas.geometry.Vector`
229231
The vector to extrude the curve along.
@@ -235,7 +237,11 @@ def from_extrusion(cls, curve, vector, cap_ends=True):
235237
:class:`~compas_rhino.geometry.RhinoBrep`
236238
237239
"""
238-
extrusion = Rhino.Geometry.Surface.CreateExtrusion(curve_to_rhino(curve), vector_to_rhino(vector))
240+
if isinstance(curve, Polyline):
241+
rhino_curve = polyline_to_rhino_curve(curve)
242+
else:
243+
rhino_curve = curve_to_rhino(curve)
244+
extrusion = Rhino.Geometry.Surface.CreateExtrusion(rhino_curve, vector_to_rhino(vector))
239245
if extrusion is None:
240246
raise BrepError("Failed to create extrusion from curve: {} and vector: {}".format(curve, vector))
241247
rhino_brep = extrusion.ToBrep()

0 commit comments

Comments
 (0)