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

Function cut

cadquery/occ_impl/shapes.py:6699–6724  ·  view source on GitHub ↗

Subtract two shapes.

(
    s1: Shape,
    s2: Shape,
    tol: float = 0.0,
    glue: GlueLiteral = None,
    history: History | None = None,
    name: str | None = None,
)

Source from the content-addressed store, hash-verified

6697
6698
6699def cut(
6700 s1: Shape,
6701 s2: Shape,
6702 tol: float = 0.0,
6703 glue: GlueLiteral = None,
6704 history: History | None = None,
6705 name: str | None = None,
6706) -> Shape:
6707 """
6708 Subtract two shapes.
6709 """
6710
6711 builder = BOPAlgo_BOP()
6712 builder.SetOperation(BOPAlgo_CUT)
6713
6714 _set_glue(builder, glue)
6715 _set_builder_options(builder, tol)
6716
6717 builder.AddArgument(s1.wrapped)
6718 builder.AddTool(s2.wrapped)
6719
6720 builder.Perform()
6721
6722 _update_history(history, name, [s1, s2], builder)
6723
6724 return _compound_or_shape(builder.Shape())
6725
6726
6727def intersect(

Callers 3

__sub__Method · 0.85
test_operatorsFunction · 0.85
test_history_boolFunction · 0.85

Calls 4

_set_glueFunction · 0.85
_set_builder_optionsFunction · 0.85
_update_historyFunction · 0.85
_compound_or_shapeFunction · 0.85

Tested by 2

test_operatorsFunction · 0.68
test_history_boolFunction · 0.68