From f20501ed0ccdd7a38038e2a4a1ee6ce005c4c86f Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Sat, 25 Nov 2023 20:59:52 -0600 Subject: [PATCH] add vertex support to make_loft --- src/build123d/topology.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/build123d/topology.py b/src/build123d/topology.py index 94a240e5..74cab0a8 100644 --- a/src/build123d/topology.py +++ b/src/build123d/topology.py @@ -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: @@ -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()