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

Function hollow

cadquery/occ_impl/shapes.py:7590–7636  ·  view source on GitHub ↗

Make a hollow solid by removing faces and applying thickness t.

(
    s: Shape,
    faces: Shape | None,
    t: float,
    tol: float = 1e-3,
    kind: Literal["arc", "intersection"] = "intersection",
    history: History | None = None,
    name: str | None = None,
)

Source from the content-addressed store, hash-verified

7588
7589@multidispatch
7590def hollow(
7591 s: Shape,
7592 faces: Shape | None,
7593 t: float,
7594 tol: float = 1e-3,
7595 kind: Literal["arc", "intersection"] = "intersection",
7596 history: History | None = None,
7597 name: str | None = None,
7598):
7599 """
7600 Make a hollow solid by removing faces and applying thickness t.
7601 """
7602
7603 bldr = BRepOffsetAPI_MakeThickSolid()
7604 _faces = (
7605 _shapes_to_toptools_list(faces.Faces()) if faces else TopTools_ListOfShape()
7606 )
7607
7608 bldr.MakeThickSolidByJoin(
7609 s.solid().wrapped,
7610 _faces,
7611 t,
7612 tol,
7613 Intersection=True,
7614 Join=_offset_kind_dict[kind],
7615 )
7616 bldr.Build()
7617
7618 rv = _compound_or_shape(bldr.Shape())
7619
7620 # if no faces provided a watertight solid will be constructed
7621 if faces is None:
7622 sh1 = rv.shell().wrapped
7623 sh2 = s.shell().wrapped
7624
7625 # sh1 can be outer or inner shell depending on the thickness sign
7626 if t > 0:
7627 sol = BRepBuilderAPI_MakeSolid(sh1, sh2)
7628 else:
7629 sol = BRepBuilderAPI_MakeSolid(sh2, sh1)
7630
7631 # fix needed for the orientations
7632 rv = _compound_or_shape(sol.Shape()).fix()
7633
7634 _update_history(history, name, [s], bldr)
7635
7636 return rv
7637
7638
7639@multidispatch

Callers 2

test_hollowFunction · 0.85
test_hollow_openFunction · 0.85

Calls 7

_shapes_to_toptools_listFunction · 0.85
_compound_or_shapeFunction · 0.85
_update_historyFunction · 0.85
solidMethod · 0.80
fixMethod · 0.80
FacesMethod · 0.45
shellMethod · 0.45

Tested by 2

test_hollowFunction · 0.68
test_hollow_openFunction · 0.68