MCPcopy
hub / github.com/CadQuery/cadquery / loft

Method loft

cadquery/cq.py:3615–3650  ·  view source on GitHub ↗

Make a lofted solid, through the set of wires. :param ruled: When set to `True` connects each section linearly and without continuity :param combine: True or "a" to combine the resulting solid with parent solids if found, "cut" or "s" to remove the resulting sol

(
        self: T, ruled: bool = False, combine: CombineMode = True, clean: bool = True
    )

Source from the content-addressed store, hash-verified

3613 return self.newObject([s])
3614
3615 def loft(
3616 self: T, ruled: bool = False, combine: CombineMode = True, clean: bool = True
3617 ) -> T:
3618 """
3619 Make a lofted solid, through the set of wires.
3620
3621 :param ruled: When set to `True` connects each section linearly and without continuity
3622 :param combine: True or "a" to combine the resulting solid with parent solids if found,
3623 "cut" or "s" to remove the resulting solid from the parent solids if found.
3624 False to keep the resulting solid separated from the parent solids.
3625 :param clean: call :meth:`clean` afterwards to have a clean shape
3626
3627 :return: a Workplane object containing the created loft
3628
3629 """
3630
3631 toLoft: List[Union[Wire, Vertex]] = []
3632
3633 if self.ctx.pendingWires:
3634 toLoft.extend(self.ctx.popPendingWires())
3635 else:
3636 toLoft = [
3637 el if isinstance(el, Vertex) else el.outerWire()
3638 for el in self._getFacesVertices()
3639 ]
3640
3641 if not toLoft:
3642 raise ValueError("Nothing to loft")
3643 elif len(toLoft) == 1:
3644 raise ValueError("More than one wire or face is required")
3645
3646 r: Shape = loft(toLoft, cap=True, ruled=ruled)
3647
3648 newS = self._combineWithBase(r, combine, clean)
3649
3650 return newS
3651
3652 def _getFaces(self) -> List[Face]:
3653 """

Callers 11

test_bezier_curveMethod · 0.80
testLoftMethod · 0.80
testLoftCombineMethod · 0.80
testDoubleTwistedLoftMethod · 0.80
testTwistedLoftMethod · 0.80
testCupMethod · 0.80
testSketchMethod · 0.80
test_loft_faceMethod · 0.80
test_loft_to_vertexMethod · 0.80

Calls 6

_getFacesVerticesMethod · 0.95
_combineWithBaseMethod · 0.95
extendMethod · 0.80
popPendingWiresMethod · 0.80
outerWireMethod · 0.80
loftFunction · 0.50

Tested by 10

test_bezier_curveMethod · 0.64
testLoftMethod · 0.64
testLoftCombineMethod · 0.64
testDoubleTwistedLoftMethod · 0.64
testTwistedLoftMethod · 0.64
testCupMethod · 0.64
testSketchMethod · 0.64
test_loft_faceMethod · 0.64
test_loft_to_vertexMethod · 0.64