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

Function loft

cadquery/occ_impl/shapes.py:7375–7503  ·  view source on GitHub ↗

Loft edges, wires or faces. For faces cap has no effect. Do not mix faces with other types.

(
    s: Sequence[Shape],
    cap: bool = False,
    ruled: bool = False,
    continuity: Literal["C1", "C2", "C3"] = "C2",
    parametrization: Literal["uniform", "chordal", "centripetal"] = "uniform",
    degree: int = 3,
    compat: bool = True,
    smoothing: bool = False,
    weights: tuple[float, float, float] = (1, 1, 1),
    history: History | None = None,
    name: str | None = None,
)

Source from the content-addressed store, hash-verified

7373
7374@multidispatch
7375def loft(
7376 s: Sequence[Shape],
7377 cap: bool = False,
7378 ruled: bool = False,
7379 continuity: Literal["C1", "C2", "C3"] = "C2",
7380 parametrization: Literal["uniform", "chordal", "centripetal"] = "uniform",
7381 degree: int = 3,
7382 compat: bool = True,
7383 smoothing: bool = False,
7384 weights: tuple[float, float, float] = (1, 1, 1),
7385 history: History | None = None,
7386 name: str | None = None,
7387) -> Shape:
7388 """
7389 Loft edges, wires or faces. For faces cap has no effect. Do not mix faces with other types.
7390 """
7391
7392 results: list[TopoDS_Shape] = []
7393 builders = []
7394 # for history handling
7395 tops_hist = []
7396 bots_hist = []
7397 solid_hist = History()
7398
7399 def _make_builder(cap: bool) -> BRepOffsetAPI_ThruSections:
7400 rv = BRepOffsetAPI_ThruSections(cap, ruled)
7401 rv.SetMaxDegree(degree)
7402 rv.CheckCompatibility(compat)
7403 rv.SetContinuity(_to_geomabshape(continuity))
7404 rv.SetParType(_to_parametrization(parametrization))
7405 rv.SetSmoothing(smoothing)
7406 rv.SetCriteriumWeight(*weights)
7407
7408 return rv
7409
7410 # try to construct lofts using faces
7411 for el in _get_face_lists(s):
7412 # build outer part
7413 builder = _make_builder(True)
7414 builders.append(builder)
7415
7416 # used to check if building inner parts makes sense
7417 has_vertex = False
7418
7419 for f in el:
7420 if isinstance(f, Face):
7421 builder.AddWire(f.outerWire().wrapped)
7422 else:
7423 builder.AddVertex(f.wrapped)
7424 has_vertex = True
7425
7426 builder.Build()
7427 builder.Check()
7428
7429 # build inner parts
7430 builders_inner = []
7431 tops = []
7432 bots = []

Callers

nothing calls this directly

Calls 14

HistoryClass · 0.85
_get_face_listsFunction · 0.85
_make_builderFunction · 0.85
ShapeClass · 0.85
compoundFunction · 0.85
solidFunction · 0.85
_update_historyFunction · 0.85
_remap_history_valuesFunction · 0.85
_get_wire_listsFunction · 0.85
_compound_or_shapeFunction · 0.85
appendMethod · 0.80
outerWireMethod · 0.80

Tested by

no test coverage detected