Skip to content

Commit 8367298

Browse files
authored
Remove unneeded % pipeline substitution in kcl-samples (#7791)
* Remove unneeded % pipeline substitution in kcl-samples * Update output * Remove more percents * Update output and format
1 parent 05cd117 commit 8367298

File tree

118 files changed

+2067
-3826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+2067
-3826
lines changed

public/kcl-samples/ball-joint-rod-end/main.kcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ballProfile = startProfile(ballSketch, at = polar(angle = sketchStartAngle + 90,
3939
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
4040
|> close()
4141
ballRevolve = revolve(ballProfile, angle = 360, axis = X)
42-
|> appearance(%, color = "#519afb")
42+
|> appearance(color = "#519afb")
4343

4444
// next the retaining loop that keep the ball in place
4545
retainingLoopSketch = startSketchOn(YZ)

public/kcl-samples/bottle/main.kcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ bottleNeck = startSketchOn(bottleBody, face = END)
2929

3030
// Define a shell operation so that the entire body and neck are hollow, with only the top face opened
3131
bottleShell = shell(bottleNeck, faces = [END], thickness = wallThickness)
32-
|> appearance(%, color = "#0078c2")
32+
|> appearance(color = "#0078c2")

public/kcl-samples/bracket/main.kcl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ bracketBody = startSketchOn(XZ)
4040
|> xLine(length = thickness, tag = $seg05)
4141
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg06)
4242
|> close()
43-
|> extrude(%, length = width)
43+
|> extrude(length = width)
4444

4545
// Add mounting holes to mount to the shelf
4646
shelfMountingHoles = startSketchOn(bracketBody, face = seg03)
@@ -53,7 +53,7 @@ shelfMountingHoles = startSketchOn(bracketBody, face = seg03)
5353
)
5454
|> patternLinear2d(instances = 2, distance = -(extBendRadius + shelfMountingHolePlacementOffset) + shelfMountLength - shelfMountingHolePlacementOffset, axis = [-1, 0])
5555
|> patternLinear2d(instances = 2, distance = width - (shelfMountingHolePlacementOffset * 2), axis = [0, 1])
56-
|> extrude(%, length = -thickness - .01)
56+
|> extrude(length = -thickness - .01)
5757

5858
// Add mounting holes to mount to the wall
5959
wallMountingHoles = startSketchOn(bracketBody, face = seg04)
@@ -65,7 +65,7 @@ wallMountingHoles = startSketchOn(bracketBody, face = seg04)
6565
radius = wallMountingHoleDiameter / 2,
6666
)
6767
|> patternLinear2d(instances = 2, distance = width - (wallMountingHolePlacementOffset * 2), axis = [0, 1])
68-
|> extrude(%, length = -thickness - 0.1)
68+
|> extrude(length = -thickness - 0.1)
6969

7070
// Apply bends
7171
fillet(bracketBody, radius = extBendRadius, tags = [getNextAdjacentEdge(seg03)])

public/kcl-samples/brake-rotor/main.kcl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,27 +149,21 @@ bodyDiscBell = startProfile(
149149
tDiscHalf * 2 + tVent
150150
],
151151
)
152-
|> arc(
153-
%,
154-
angleStart = -180,
155-
angleEnd = 0,
156-
radius = wUndercut / 2,
157-
)
152+
|> arc(angleStart = -180, angleEnd = 0, radius = wUndercut / 2)
158153
|> line(end = [lDraftExterior, hBellAboveDiscFace])
159154
|> xLine(length = rOuter, tag = $seg04)
160155
|> yLine(length = -tBell)
161156
|> xLine(length = -rInner)
162157
|> line(end = [-lDraftInterior, -hBellAboveDiscFace])
163158
|> line(end = [0, -2]) // Wall thickness.
164159
|> xLine(length = -1 * (tBell + wUndercut))
165-
|> close(%)
160+
|> close()
166161
|> revolve(axis = Y)
167162

168163
// Drill lug holes.
169164
sketchLugs = startSketchOn(bodyDiscBell, face = seg04)
170165
profileStud = circle(sketchLugs, center = [0, dPitchCircle / 2], radius = dStudDrilling / 2)
171166
|> patternCircular2d(
172-
%,
173167
instances = nStuds,
174168
center = [0, 0],
175169
arcDegrees = 360,

public/kcl-samples/car-wheel-assembly/car-rotor.kcl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ lugHoles = startSketchOn(rotorBump, face = END)
2424
instances = lugCount,
2525
rotateDuplicates = true,
2626
)
27-
|> extrude(%, length = -(rotorInnerDiameterThickness + rotorSinglePlateThickness))
27+
|> extrude(length = -(rotorInnerDiameterThickness + rotorSinglePlateThickness))
2828
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)
2929

3030
// (update when boolean is available)
3131
centerSpacer = startSketchOn(rotor, face = START)
32-
|> circle(%, center = [0, 0], radius = .25)
33-
|> extrude(%, length = spacerLength)
32+
|> circle(center = [0, 0], radius = .25)
33+
|> extrude(length = spacerLength)
3434

3535
secondaryRotorSketch = startSketchOn(centerSpacer, face = END)
3636
|> circle(center = [0, 0], radius = rotorDiameter / 2)

public/kcl-samples/clock/main.kcl

Lines changed: 62 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ clockRidge = extrude(profile002, length = ridgeThickness, tagEnd = $capEnd001)
6565
getCommonEdge(faces = [seg01, capEnd001])
6666
],
6767
)
68-
|> appearance(%, color = "#ab4321")
68+
|> appearance(color = "#ab4321")
6969

7070
// Create an object that has all of the x and y starting positions of every number
7171
numberObject = {
@@ -205,19 +205,16 @@ fn letterI(startX, startY) {
205205
iWidth = 8
206206
iLength = 40
207207
return startSketchOn(offsetPlane(XY, offset = 50))
208-
|> startProfile(
209-
%,
210-
at = [
211-
startX - (iWidth / 2),
212-
startY + iLength / 2
213-
],
214-
)
215-
|> xLine(%, length = iWidth)
216-
|> yLine(%, length = -iLength)
217-
|> xLine(%, length = -iWidth)
218-
|> close(%)
219-
|> extrude(%, length = numberThickness)
220-
|> appearance(%, color = "#140f0f")
208+
|> startProfile(at = [
209+
startX - (iWidth / 2),
210+
startY + iLength / 2
211+
])
212+
|> xLine(length = iWidth)
213+
|> yLine(length = -iLength)
214+
|> xLine(length = -iWidth)
215+
|> close()
216+
|> extrude(length = numberThickness)
217+
|> appearance(color = "#140f0f")
221218
}
222219

223220
// Function for the letter X
@@ -226,49 +223,43 @@ fn letterX(startX, startY) {
226223
xLength = 40
227224

228225
return startSketchOn(offsetPlane(XY, offset = 50))
229-
|> startProfile(
230-
%,
231-
at = [
232-
startX - (xWidth / 2),
233-
startY + xLength / 2
234-
],
235-
)
236-
|> xLine(%, length = xWidth / 6)
237-
|> angledLine(%, angle = -70, lengthY = xLength * 1 / 3)
238-
|> angledLine(%, angle = 70, lengthY = xLength * 1 / 3)
239-
|> xLine(%, length = xWidth / 6)
240-
|> angledLine(%, angle = 70 + 180, lengthY = xLength * 1 / 2)
241-
|> angledLine(%, angle = -70, lengthY = xLength * 1 / 2)
242-
|> xLine(%, length = -xWidth / 6)
243-
|> angledLine(%, angle = -70 - 180, lengthY = xLength * 1 / 3)
244-
|> angledLine(%, angle = 70 + 180, lengthY = xLength * 1 / 3)
245-
|> xLine(%, length = -xWidth / 6)
246-
|> angledLine(%, angle = 70, lengthY = xLength * 1 / 2)
247-
|> close(%)
248-
|> extrude(%, length = numberThickness)
249-
|> appearance(%, color = "#140f0f")
226+
|> startProfile(at = [
227+
startX - (xWidth / 2),
228+
startY + xLength / 2
229+
])
230+
|> xLine(length = xWidth / 6)
231+
|> angledLine(angle = -70, lengthY = xLength * 1 / 3)
232+
|> angledLine(angle = 70, lengthY = xLength * 1 / 3)
233+
|> xLine(length = xWidth / 6)
234+
|> angledLine(angle = 70 + 180, lengthY = xLength * 1 / 2)
235+
|> angledLine(angle = -70, lengthY = xLength * 1 / 2)
236+
|> xLine(length = -xWidth / 6)
237+
|> angledLine(angle = -70 - 180, lengthY = xLength * 1 / 3)
238+
|> angledLine(angle = 70 + 180, lengthY = xLength * 1 / 3)
239+
|> xLine(length = -xWidth / 6)
240+
|> angledLine(angle = 70, lengthY = xLength * 1 / 2)
241+
|> close()
242+
|> extrude(length = numberThickness)
243+
|> appearance(color = "#140f0f")
250244
}
251245

252246
// Function for the letter V
253247
fn letterV(startX, startY) {
254248
vWidth = 25
255249
vLength = 40
256250
return startSketchOn(offsetPlane(XY, offset = 50))
257-
|> startProfile(
258-
%,
259-
at = [
260-
startX - (vWidth / 2),
261-
startY + vLength / 2
262-
],
263-
)
264-
|> xLine(%, length = vWidth * 1 / 3)
265-
|> line(%, end = [vWidth / 6, -vLength / 2])
266-
|> line(%, end = [vWidth / 6, vLength / 2])
267-
|> xLine(%, length = vWidth * 1 / 3)
268-
|> line(%, end = [-vWidth * 1 / 2, -vLength])
269-
|> close(%)
270-
|> extrude(%, length = numberThickness)
271-
|> appearance(%, color = "#140f0f")
251+
|> startProfile(at = [
252+
startX - (vWidth / 2),
253+
startY + vLength / 2
254+
])
255+
|> xLine(length = vWidth * 1 / 3)
256+
|> line(end = [vWidth / 6, -vLength / 2])
257+
|> line(end = [vWidth / 6, vLength / 2])
258+
|> xLine(length = vWidth * 1 / 3)
259+
|> line(end = [-vWidth * 1 / 2, -vLength])
260+
|> close()
261+
|> extrude(length = numberThickness)
262+
|> appearance(color = "#140f0f")
272263
}
273264

274265
// Create the numbers on the face of the clock
@@ -326,7 +317,7 @@ letterI(startX = numberObject.twelve.i2[0], startY = numberObject.twelve.i2[1])
326317
// Create nub for the minute and hour hands
327318
startSketchOn(clockBody, face = END)
328319
|> circle(center = [0, 0], diameter = nubDiameter)
329-
|> extrude(%, length = numHeight)
320+
|> extrude(length = numHeight)
330321

331322
// Create the hour hand
332323
sketch005 = startSketchOn(offsetPlane(XY, offset = 55))
@@ -338,7 +329,6 @@ profile007 = startProfile(
338329
],
339330
)
340331
|> arc(
341-
%,
342332
interiorAbsolute = [
343333
nubDiameter / 2 * 1.375 * cos(hourHandAngle + 180),
344334
nubDiameter / 2 * 1.375 * sin(hourHandAngle + 180)
@@ -348,30 +338,24 @@ profile007 = startProfile(
348338
nubDiameter / 2 * 1.375 * sin(hourHandAngle + 340)
349339
],
350340
)
351-
|> angledLine(%, angle = hourHandAngle, length = hourHandArmLength)
352-
|> angledLine(
353-
%,
354-
angle = hourHandAngle - 90,
355-
length = hourHandWidth / 2,
356-
tag = $seg004,
357-
)
341+
|> angledLine(angle = hourHandAngle, length = hourHandArmLength)
342+
|> angledLine(angle = hourHandAngle - 90, length = hourHandWidth / 2, tag = $seg004)
358343
|> line(
359-
%,
360344
endAbsolute = [
361345
hourHandLargeDiameter / 2 * cos(hourHandAngle),
362346
hourHandLargeDiameter / 2 * sin(hourHandAngle)
363347
],
364348
tag = $seg002,
365349
)
366-
|> angledLine(%, angle = segAng(seg002) + 120, length = segLen(seg002))
367-
// |> angledLineThatIntersects(%, angle = segAng(seg002) + hourHandAngle - 90, intersectTag = seg004)
368-
|> angledLine(%, angle = hourHandAngle - 90, length = segLen(seg004))
369-
|> line(%, endAbsolute = [profileStartX(%), profileStartY(%)])
370-
|> close(%)
350+
|> angledLine(angle = segAng(seg002) + 120, length = segLen(seg002))
351+
// |> angledLineThatIntersects(angle = segAng(seg002) + hourHandAngle - 90, intersectTag = seg004)
352+
|> angledLine(angle = hourHandAngle - 90, length = segLen(seg004))
353+
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
354+
|> close()
371355
profile008 = circle(sketch005, center = [0, 0], diameter = nubDiameter)
372356
subtract2d(profile007, tool = profile008)
373-
|> extrude(%, length = 5)
374-
|> appearance(%, color = "#404040")
357+
|> extrude(length = 5)
358+
|> appearance(color = "#404040")
375359

376360
// create the minute hand
377361
sketch006 = startSketchOn(offsetPlane(XY, offset = 50))
@@ -383,7 +367,6 @@ profile009 = startProfile(
383367
],
384368
)
385369
|> arc(
386-
%,
387370
interiorAbsolute = [
388371
nubDiameter / 2 * 1.375 * cos(minuteHandAngle + 180),
389372
nubDiameter / 2 * 1.375 * sin(minuteHandAngle + 180)
@@ -393,29 +376,23 @@ profile009 = startProfile(
393376
nubDiameter / 2 * 1.375 * sin(minuteHandAngle + 340)
394377
],
395378
)
396-
|> angledLine(%, angle = minuteHandAngle, length = minuteHandArmLength)
397-
|> angledLine(
398-
%,
399-
angle = minuteHandAngle - 90,
400-
length = minuteHandWidth / 2,
401-
tag = $seg003,
402-
)
379+
|> angledLine(angle = minuteHandAngle, length = minuteHandArmLength)
380+
|> angledLine(angle = minuteHandAngle - 90, length = minuteHandWidth / 2, tag = $seg003)
403381
|> line(
404-
%,
405382
endAbsolute = [
406383
minuteHandLargeDiameter / 2 * cos(minuteHandAngle),
407384
minuteHandLargeDiameter / 2 * sin(minuteHandAngle)
408385
],
409386
tag = $seg005,
410387
)
411-
|> angledLine(%, angle = segAng(seg005) + 120, length = segLen(seg005))
412-
|> angledLine(%, angle = minuteHandAngle - 90, length = segLen(seg003))
413-
|> line(%, endAbsolute = [profileStartX(%), profileStartY(%)])
414-
|> close(%)
388+
|> angledLine(angle = segAng(seg005) + 120, length = segLen(seg005))
389+
|> angledLine(angle = minuteHandAngle - 90, length = segLen(seg003))
390+
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
391+
|> close()
415392
profile010 = circle(sketch006, center = [0, 0], diameter = 30)
416393
subtract2d(profile009, tool = profile010)
417-
|> extrude(%, length = 5)
418-
|> appearance(%, color = "#404040")
394+
|> extrude(length = 5)
395+
|> appearance(color = "#404040")
419396

420397
// Define parameters of the screw slot for hanging the clock
421398
screwHeadDiameter = 9.53
@@ -427,15 +404,10 @@ slotLength = 40
427404
sketch003 = startSketchOn(clockBody, face = START)
428405
profile004 = startProfile(sketch003, at = [-slotWidth / 2, 200])
429406
|> yLine(length = -slotLength)
430-
|> arc(
431-
%,
432-
radius = screwHeadDiameter / 2 + screwTolerance,
433-
angleStart = 120,
434-
angleEnd = 420,
435-
)
436-
|> yLine(%, length = slotLength)
407+
|> arc(radius = screwHeadDiameter / 2 + screwTolerance, angleStart = 120, angleEnd = 420)
408+
|> yLine(length = slotLength)
437409
|> tangentialArc(endAbsolute = [profileStartX(%), profileStartY(%)])
438410
|> close()
439-
|> extrude(%, length = -20)
411+
|> extrude(length = -20)
440412

441413
// todo: create cavity for the screw to slide into (need csg update)

public/kcl-samples/cold-plate/main.kcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ copperTubePath = startSketchOn(offsetPlane(XY, offset = tubeDiameter))
4444
// Create the profile for the inner and outer diameter of the hollow copper tube
4545
tubeWall = startSketchOn(offsetPlane(YZ, offset = -7.35))
4646
|> circle(center = [-bendRadius * 3, tubeDiameter], radius = tubeDiameter / 2)
47-
|> subtract2d(%, tool = circle(center = [-bendRadius * 3, tubeDiameter], radius = tubeDiameter / 2 - wallThickness))
47+
|> subtract2d(tool = circle(center = [-bendRadius * 3, tubeDiameter], radius = tubeDiameter / 2 - wallThickness))
4848
|> sweep(path = copperTubePath)
4949
|> appearance(color = "#b81b0a")
5050

public/kcl-samples/countersunk-plate/main.kcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ plateBody = startSketchOn(XY)
3333
|> tangentialArc(endAbsolute = [profileStartX(%), profileStartY(%)])
3434
|> close()
3535
|> subtract2d(tool = circle(center = [0, 0], radius = centerHoleDiameter / 2 * 1.5))
36-
|> extrude(%, length = plateThickness)
36+
|> extrude(length = plateThickness)
3737

3838
// Function to create a countersunk hole
3939
fn countersink(@holePosition) {

public/kcl-samples/cpu-cooler/fan.kcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * from "parameters.kcl"
1010
// Model the center of the fan
1111
fanCenter = startSketchOn(YZ)
1212
|> circle(center = [0, 0], radius = fanHeight / 2, tag = $centerBend)
13-
|> extrude(%, length = fanHeight)
13+
|> extrude(length = fanHeight)
1414
|> fillet(radius = 1.5, tags = [getOppositeEdge(centerBend)])
1515

1616
// Create a function for a lofted fan blade cross section that rotates about the center hub of the fan

public/kcl-samples/cpu-cooler/heat-sink.kcl

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ endTube = startSketchOn(offsetPlane(XY, offset = fanSize + 38))
2323
|> subtract2d(tool = circle(center = [-20, fanSize / 4], radius = 2.5))
2424
|> sweep(path = endTubePath)
2525
|> patternCircular3d(
26-
%,
2726
instances = 2,
2827
axis = [0, 0, 1],
2928
center = [0, 0, 0],
@@ -50,19 +49,13 @@ centerTube = startSketchOn(offsetPlane(XY, offset = fanSize + 38))
5049
|> subtract2d(tool = circle(center = [-4, fanSize / 2.67], radius = 2.5))
5150
|> sweep(path = centerTubePath)
5251
|> patternCircular3d(
53-
%,
5452
instances = 2,
5553
axis = [0, 0, 1],
5654
center = [-4 * 2, 0, 0],
5755
arcDegrees = 360,
5856
rotateDuplicates = true,
5957
)
60-
|> patternLinear3d(
61-
%,
62-
instances = 2,
63-
distance = 4 * 4,
64-
axis = [1, 0, 0],
65-
)
58+
|> patternLinear3d(instances = 2, distance = 4 * 4, axis = [1, 0, 0])
6659

6760
// Draw a heat fin with built-in clips to secure the mounting wire. Pattern the fin upwards by the height of the fan
6861
heatFins = startSketchOn(offsetPlane(XY, offset = 45))
@@ -80,12 +73,7 @@ heatFins = startSketchOn(offsetPlane(XY, offset = 45))
8073
|> mirror2d(axis = Y)
8174
|> close()
8275
|> extrude(length = 1)
83-
|> patternLinear3d(
84-
%,
85-
instances = 31,
86-
distance = (fanSize - 10) / 30,
87-
axis = [0, 0, 1],
88-
)
76+
|> patternLinear3d(instances = 31, distance = (fanSize - 10) / 30, axis = [0, 0, 1])
8977

9078
// Create the mounting base for the CPU cooler. The base should consist of two pieces that secure around each of the tubes at the bottom
9179
coolerBase = startSketchOn(-XZ)

0 commit comments

Comments
 (0)