Skip to content

Commit 47519f6

Browse files
committed
Mixin3D.shell: removed deprecated OCCT method
Will close #649
1 parent 8fccc0c commit 47519f6

File tree

1 file changed

+27
-32
lines changed

1 file changed

+27
-32
lines changed

cadquery/occ_impl/shapes.py

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,12 +2357,14 @@ def shell(
23572357
kind: Literal["arc", "intersection"] = "arc",
23582358
) -> Any:
23592359
"""
2360-
make a shelled solid of given by removing the list of faces
2360+
Make a shelled solid of self.
23612361
2362-
:param faceList: list of face objects, which must be part of the solid.
2363-
:param thickness: floating point thickness. positive shells outwards, negative shells inwards
2364-
:param tolerance: modelling tolerance of the method, default=0.0001
2365-
:return: a shelled solid
2362+
:param faceList: List of faces to be removed, which must be part of the solid. Can
2363+
be an empty list.
2364+
:param thickness: Floating point thickness. Positive shells outwards, negative
2365+
shells inwards.
2366+
:param tolerance: Modelling tolerance of the method, default=0.0001.
2367+
:return: A shelled solid.
23662368
"""
23672369

23682370
kind_dict = {
@@ -2371,45 +2373,38 @@ def shell(
23712373
}
23722374

23732375
occ_faces_list = TopTools_ListOfShape()
2376+
shell_builder = BRepOffsetAPI_MakeThickSolid()
23742377

2375-
if faceList:
2376-
for f in faceList:
2377-
occ_faces_list.Append(f.wrapped)
2378+
for f in faceList:
2379+
occ_faces_list.Append(f.wrapped)
23782380

2379-
shell_builder = BRepOffsetAPI_MakeThickSolid(
2380-
self.wrapped,
2381-
occ_faces_list,
2382-
thickness,
2383-
tolerance,
2384-
Intersection=True,
2385-
Join=kind_dict[kind],
2386-
)
2381+
shell_builder.MakeThickSolidByJoin(
2382+
self.wrapped,
2383+
occ_faces_list,
2384+
thickness,
2385+
tolerance,
2386+
Intersection=True,
2387+
Join=kind_dict[kind],
2388+
)
2389+
shell_builder.Build()
23872390

2388-
shell_builder.Build()
2389-
rv = shell_builder.Shape()
2391+
if faceList:
2392+
rv = self.__class__(shell_builder.Shape())
23902393

23912394
else: # if no faces provided a watertight solid will be constructed
2392-
shell_builder = BRepOffsetAPI_MakeThickSolid(
2393-
self.wrapped,
2394-
occ_faces_list,
2395-
thickness,
2396-
tolerance,
2397-
Intersection=True,
2398-
Join=kind_dict[kind],
2399-
)
2400-
2401-
shell_builder.Build()
24022395
s1 = self.__class__(shell_builder.Shape()).Shells()[0].wrapped
24032396
s2 = self.Shells()[0].wrapped
24042397

24052398
# s1 can be outer or inner shell depending on the thickness sign
24062399
if thickness > 0:
2407-
rv = BRepBuilderAPI_MakeSolid(s1, s2).Shape()
2400+
sol = BRepBuilderAPI_MakeSolid(s1, s2)
24082401
else:
2409-
rv = BRepBuilderAPI_MakeSolid(s2, s1).Shape()
2402+
sol = BRepBuilderAPI_MakeSolid(s2, s1)
24102403

2411-
# fix needed for the orientations
2412-
return self.__class__(rv) if faceList else self.__class__(rv).fix()
2404+
# fix needed for the orientations
2405+
rv = self.__class__(sol.Shape()).fix()
2406+
2407+
return rv
24132408

24142409
def isInside(
24152410
self: ShapeProtocol, point: VectorLike, tolerance: float = 1.0e-6

0 commit comments

Comments
 (0)