Skip to content

Commit

Permalink
Mixin3D.shell: allow faceList=None
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus7070 committed Jul 29, 2021
1 parent 47519f6 commit 7afbb37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cadquery/occ_impl/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2351,7 +2351,7 @@ def chamfer(

def shell(
self: Any,
faceList: Iterable[Face],
faceList: Optional[Iterable[Face]],
thickness: float,
tolerance: float = 0.0001,
kind: Literal["arc", "intersection"] = "arc",
Expand All @@ -2375,8 +2375,9 @@ def shell(
occ_faces_list = TopTools_ListOfShape()
shell_builder = BRepOffsetAPI_MakeThickSolid()

for f in faceList:
occ_faces_list.Append(f.wrapped)
if faceList:
for f in faceList:
occ_faces_list.Append(f.wrapped)

shell_builder.MakeThickSolidByJoin(
self.wrapped,
Expand Down
8 changes: 8 additions & 0 deletions tests/test_cadquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -2290,6 +2290,14 @@ def testClosedShell(self):
s3 = Workplane().polyline(pts).close().extrude(1).shell(-0.05)
self.assertTrue(s3.val().isValid())

s4_shape = Workplane("XY").box(2, 2, 2).val()
# test that None and empty list both work and are equivalent
s4_shell_1 = s4_shape.shell(faceList=None, thickness=-0.1)
s4_shell_2 = s4_shape.shell(faceList=[], thickness=-0.1)
# this should be the same as the first shape
self.assertEqual(len(s4_shell_1.Faces()), s1.faces().size())
self.assertEqual(len(s4_shell_2.Faces()), s1.faces().size())

def testOpenCornerShell(self):
s = Workplane("XY").box(1, 1, 1)
s1 = s.faces("+Z")
Expand Down

0 comments on commit 7afbb37

Please sign in to comment.