Skip to content

Commit 5af6171

Browse files
Added cq.Shape.split
1 parent c0aaa48 commit 5af6171

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cadquery/occ_impl/shapes.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@
125125
BRepAlgoAPI_Fuse,
126126
BRepAlgoAPI_Cut,
127127
BRepAlgoAPI_BooleanOperation,
128+
BRepAlgoAPI_Splitter,
129+
BRepAlgoAPI_BuilderAlgo,
128130
)
129131

130132
from OCP.Geom import (
@@ -945,7 +947,7 @@ def _bool_op(
945947
self,
946948
args: Iterable["Shape"],
947949
tools: Iterable["Shape"],
948-
op: BRepAlgoAPI_BooleanOperation,
950+
op: Union[BRepAlgoAPI_BooleanOperation, BRepAlgoAPI_Splitter],
949951
) -> "Shape":
950952
"""
951953
Generic boolean operation
@@ -1006,6 +1008,15 @@ def intersect(self, *toIntersect: "Shape") -> "Shape":
10061008

10071009
return self._bool_op((self,), toIntersect, intersect_op)
10081010

1011+
def split(self, *splitters: "Shape") -> "Shape":
1012+
"""
1013+
Split this shape with the positional arguments.
1014+
"""
1015+
1016+
split_op = BRepAlgoAPI_Splitter()
1017+
1018+
return self._bool_op((self,), splitters, split_op)
1019+
10091020
def mesh(self, tolerance: float, angularTolerance: float = 0.1):
10101021
"""
10111022
Generate traingulation if none exists.

0 commit comments

Comments
 (0)