Skip to content

Commit de233e9

Browse files
Update KCL docs (#562)
YOYO NEW KCL DOCS!! Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 81dc549 commit de233e9

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

content/pages/docs/kcl-samples/bone-plate/main.kcl

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,27 @@ plateRevolve = startSketchOn(YZ)
2929
|> close()
3030
|> revolve(axis = Y, angle = 65, symmetric = true)
3131

32+
// Define a function to create and extrude holes
33+
fn holeFn(@center) {
34+
return startSketchOn(XZ)
35+
|> circle(center = center, diameter = boltSize)
36+
|> extrude(length = -100)
37+
}
38+
3239
// Create a hole sketch with the size and location of each bolt hole
33-
holeSketch = startSketchOn(XZ)
34-
hole01 = circle(holeSketch, center = [0, 12.25], radius = boltSize / 2)
35-
|> extrude(length = -100)
36-
hole02 = circle(holeSketch, center = [0, 29.5], radius = boltSize / 2)
37-
|> extrude(length = -100)
38-
hole03 = circle(holeSketch, center = [0, 46.25], radius = boltSize / 2)
39-
|> extrude(length = -100)
40-
hole04 = circle(holeSketch, center = [0, 77], radius = boltSize / 2)
41-
|> extrude(length = -100)
42-
hole05 = circle(holeSketch, center = [0, 100], radius = boltSize / 2)
43-
|> extrude(length = -100)
44-
hole06 = circle(holeSketch, center = [0, 130], radius = boltSize / 2)
45-
|> extrude(length = -100)
46-
hole07 = circle(holeSketch, center = [-20, 130], radius = boltSize / 2)
47-
|> extrude(length = -100)
48-
hole08 = circle(holeSketch, center = [20, 130], radius = boltSize / 2)
49-
|> extrude(length = -100)
40+
holeCenters = [
41+
[0, 12.25],
42+
[0, 29.5],
43+
[0, 46.25],
44+
[0, 77],
45+
[0, 100],
46+
[0, 130],
47+
[-20, 130],
48+
[20, 130]
49+
]
50+
51+
// Use map to apply the hole creation function to the list of center coordinates
52+
holes = map(holeCenters, f = holeFn)
5053

51-
// Cut each guiding clearance hole from the bone plate
52-
solid001 = subtract([plateRevolve], tools = union([hole01, hole02]))
53-
solid002 = subtract([solid001], tools = union([hole03, hole04]))
54-
solid003 = subtract([solid002], tools = union([hole05, hole06]))
55-
solid004 = subtract([solid003], tools = union([hole07, hole08]))
54+
// Cut each guiding clearance hole from the bone plate using a single subtract operation
55+
solid = subtract([plateRevolve], tools = holes)
5 Bytes
Loading

0 commit comments

Comments
 (0)