Skip to content

Commit

Permalink
add vertex support to make_loft
Browse files Browse the repository at this point in the history
  • Loading branch information
jdegenstein authored Nov 26, 2023
1 parent 2a747b3 commit f20501e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/build123d/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -5935,13 +5935,13 @@ def make_torus(
)

@classmethod
def make_loft(cls, wires: list[Wire], ruled: bool = False) -> Solid:
def make_loft(objs: list[Vertex, Wire], ruled: bool = False) -> Solid:
"""make loft
Makes a loft from a list of wires.
Makes a loft from a list of wires and vertices, where vertices can be the first, last, or first and last elements.
Args:
wires (list[Wire]): section perimeters
objs (list[Vertex, Wire]): wire perimeters or vertices
ruled (bool, optional): stepped or smooth. Defaults to False (smooth).
Raises:
Expand All @@ -5950,13 +5950,18 @@ def make_loft(cls, wires: list[Wire], ruled: bool = False) -> Solid:
Returns:
Solid: Lofted object
"""

if len(objs) < 2:
raise ValueError("More than one wire, or a wire and a vertex is required")

# the True flag requests building a solid instead of a shell.
if len(wires) < 2:
raise ValueError("More than one wire is required")
loft_builder = BRepOffsetAPI_ThruSections(True, ruled)

for wire in wires:
loft_builder.AddWire(wire.wrapped)
for obj in objs:
if isinstance(obj, Vertex):
loft_builder.AddVertex(obj.wrapped)
elif isinstance(obj, Wire):
loft_builder.AddWire(obj.wrapped)

loft_builder.Build()

Expand Down

0 comments on commit f20501e

Please sign in to comment.