Skip to content

Commit

Permalink
👽️ Improve sweep shape API
Browse files Browse the repository at this point in the history
  • Loading branch information
je-cook committed Mar 27, 2024
1 parent 1693ec4 commit 659deec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
13 changes: 12 additions & 1 deletion bluemira/codes/_freecadapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1629,12 +1629,21 @@ def _split_wire(wire):
return apiWire(edges_1), apiWire(edges_2)


class SweepShapeTransition(enum.IntEnum):
"""Sweep shape corner transition options"""

DEFAULT = 0
RIGHT_CORNER = 1
ROUND_CORNER = 2


def sweep_shape(
profiles: Iterable[apiWire],
path: apiWire,
*,
solid: bool = True,
frenet: bool = True,
transition: SweepShapeTransition | int = SweepShapeTransition.DEFAULT,
) -> apiShell | apiSolid:
"""
Sweep a a set of profiles along a path.
Expand Down Expand Up @@ -1677,7 +1686,9 @@ def sweep_shape(
" produce unexpected results."
)

result = path.makePipeShell(profiles, True, frenet) # noqa: FBT003
result = path.makePipeShell(
profiles, solid, frenet, SweepShapeTransition(transition)
)

solid_result = apiSolid(result)
if solid:
Expand Down
7 changes: 6 additions & 1 deletion bluemira/geometry/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ def sweep_shape(
*,
solid: bool = True,
frenet: bool = True,
transition: int = 0,
label: str = "",
) -> BluemiraSolid | BluemiraShell:
"""
Expand All @@ -858,6 +859,8 @@ def sweep_shape(
frenet:
If true, the orientation of the profile(s) is calculated based on local curvature
and tangency. For planar paths, should not make a difference.
transition:
transition type between sweep sections
Returns
-------
Expand All @@ -868,7 +871,9 @@ def sweep_shape(

profile_shapes = [p.shape for p in profiles]

result = cadapi.sweep_shape(profile_shapes, path.shape, solid=solid, frenet=frenet)
result = cadapi.sweep_shape(
profile_shapes, path.shape, solid=solid, frenet=frenet, transition=transition
)

return convert(result, label=label)

Expand Down

0 comments on commit 659deec

Please sign in to comment.