Skip to content

Commit 803a05e

Browse files
qwelytlorenzncode
andauthored
Update shell docstring, use fluent api + string selector (#1079)
* Update docstring, use fluent api + string selector Update the docstring for `shell` to use the string selector and fluent api to show how to create a three faced cube. Remove the note about shelling being a common use case for `Workplane.add` * Fix literal block, remove future note, minor docstring formatting Co-authored-by: Lorenz Neureuter <[email protected]>
1 parent fddf510 commit 803a05e

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

cadquery/cq.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def add(self, obj):
452452
then it is added.
453453
454454
Used in rare cases when you need to combine the results of several CQ
455-
results into a single Workplane object. Shelling is one common example.
455+
results into a single Workplane object.
456456
"""
457457
if isinstance(obj, list):
458458
self.objects.extend(obj)
@@ -1221,36 +1221,26 @@ def shell(
12211221
12221222
To shell, first create a solid, and *in the same chain* select the faces you wish to remove.
12231223
1224-
:param thickness: a positive float, representing the thickness of the desired shell.
1224+
:param thickness: thickness of the desired shell.
12251225
Negative values shell inwards, positive values shell outwards.
1226-
:param kind: kind of joints, intersection or arc (default: arc).
1226+
:param kind: kind of join, arc or intersection (default: arc).
12271227
:raises ValueError: if the current stack contains objects that are not faces of a solid
12281228
further up in the chain.
12291229
:returns: a CQ object with the resulting shelled solid selected.
12301230
12311231
This example will create a hollowed out unit cube, where the top most face is open,
12321232
and all other walls are 0.2 units thick::
12331233
1234-
Workplane().box(1,1,1).faces("+Z").shell(0.2)
1234+
Workplane().box(1, 1, 1).faces("+Z").shell(0.2)
12351235
1236-
Shelling is one of the cases where you may need to use the add method to select several
1237-
faces. For example, this example creates a 3-walled corner, by removing three faces
1238-
of a cube::
1236+
You can also select multiple faces at once. Here is an example that creates a three-walled
1237+
corner, by removing three faces of a cube::
12391238
1240-
s = Workplane().box(1,1,1)
1241-
s1 = s.faces("+Z")
1242-
s1.add(s.faces("+Y")).add(s.faces("+X"))
1243-
self.saveModel(s1.shell(0.2))
1244-
1245-
This fairly yucky syntax for selecting multiple faces is planned for improvement
1239+
Workplane().box(10, 10, 10).faces(">Z or >X or <Y").shell(1)
12461240
12471241
**Note**: When sharp edges are shelled inwards, they remain sharp corners, but **outward**
1248-
shells are automatically filleted, because an outward offset from a corner generates
1249-
a radius.
1250-
1251-
1252-
Future Enhancements:
1253-
Better selectors to make it easier to select multiple faces
1242+
shells are automatically filleted (unless kind="intersection"), because an outward offset
1243+
from a corner generates a radius.
12541244
"""
12551245
solidRef = self.findSolid()
12561246

0 commit comments

Comments
 (0)