Skip to content

Commit 2f5caf2

Browse files
authored
Format cboreHole(), cskHole(), and hole() example code (CadQuery#1062)
* Format with Black. * Complete truncated comment.
1 parent 9745762 commit 2f5caf2

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

cadquery/cq.py

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2784,6 +2784,7 @@ def cutEach(
27842784

27852785
return self.newObject([s])
27862786

2787+
# TODO: almost all code duplicated!
27872788
# but parameter list is different so a simple function pointer won't work
27882789
def cboreHole(
27892790
self: T,
@@ -2811,9 +2812,15 @@ def cboreHole(
28112812
One hole is created for each item on the stack. A very common use case is to use a
28122813
construction rectangle to define the centers of a set of holes, like so::
28132814
2814-
s = Workplane(Plane.XY()).box(2,4,0.5).faces(">Z").workplane()\
2815-
.rect(1.5,3.5,forConstruction=True)\
2816-
.vertices().cboreHole(0.125, 0.25,0.125,depth=None)
2815+
s = (
2816+
Workplane()
2817+
.box(2, 4, 0.5)
2818+
.faces(">Z")
2819+
.workplane()
2820+
.rect(1.5, 3.5, forConstruction=True)
2821+
.vertices()
2822+
.cboreHole(0.125, 0.25, 0.125, depth=None)
2823+
)
28172824
28182825
This sample creates a plate with a set of holes at the corners.
28192826
@@ -2866,9 +2873,15 @@ def cskHole(
28662873
One hole is created for each item on the stack. A very common use case is to use a
28672874
construction rectangle to define the centers of a set of holes, like so::
28682875
2869-
s = Workplane(Plane.XY()).box(2,4,0.5).faces(">Z").workplane()\
2870-
.rect(1.5,3.5,forConstruction=True)\
2871-
.vertices().cskHole(0.125, 0.25,82,depth=None)
2876+
s = (
2877+
Workplane()
2878+
.box(2, 4, 0.5)
2879+
.faces(">Z")
2880+
.workplane()
2881+
.rect(1.5, 3.5, forConstruction=True)
2882+
.vertices()
2883+
.cskHole(0.125, 0.25, 82, depth=None)
2884+
)
28722885
28732886
This sample creates a plate with a set of holes at the corners.
28742887
@@ -2914,9 +2927,15 @@ def hole(
29142927
One hole is created for each item on the stack. A very common use case is to use a
29152928
construction rectangle to define the centers of a set of holes, like so::
29162929
2917-
s = Workplane(Plane.XY()).box(2,4,0.5).faces(">Z").workplane()\
2918-
.rect(1.5,3.5,forConstruction=True)\
2919-
.vertices().hole(0.125, 0.25,82,depth=None)
2930+
s = (
2931+
Workplane()
2932+
.box(2, 4, 0.5)
2933+
.faces(">Z")
2934+
.workplane()
2935+
.rect(1.5, 3.5, forConstruction=True)
2936+
.vertices()
2937+
.hole(0.125, 0.25, 82, depth=None)
2938+
)
29202939
29212940
This sample creates a plate with a set of holes at the corners.
29222941

0 commit comments

Comments
 (0)