Skip to content

Commit

Permalink
Update executor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchalmers committed Dec 17, 2024
1 parent 74ea8e9 commit b686ca2
Show file tree
Hide file tree
Showing 62 changed files with 2,369 additions and 2,369 deletions.
12 changes: 6 additions & 6 deletions src/wasm-lib/tests/executor/inputs/angled_line.kcl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const part001 = startSketchOn('XY')
|> startProfileAt([4.83, 12.56], %)
|> line([15.1, 2.48], %)
|> line([3.15, -9.85], %, $seg01)
|> line([-15.17, -4.1], %)
|> line(to = [15.1, 2.48])
|> line(to = [3.15, -9.85], tag = $seg01)
|> line(to = [-15.17, -4.1])
|> angledLine([segAng(seg01), 12.35], %)
|> line([-13.02, 10.03], %)
|> close(%)
|> extrude(4, %)
|> line(to = [-13.02, 10.03])
|> close()
|> extrude(length = 4)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const part001 = startSketchOn('XY')
|> startProfileAt([0,0], %)
|> line([0, 10], %, $thing)
|> line([10, 0], %)
|> line([0, -10], %, $thing2)
|> close(%, $thing3)
|> extrude(10, %)
|> line(to = [0, 10], tag = $thing)
|> line(to = [10, 0])
|> line(to = [0, -10], tag = $thing2)
|> close(tag = $thing3)
|> extrude(length = 10)
|> fillet({radius: 2, tags: [thing3, getOppositeEdge(thing3)]}, %)
10 changes: 5 additions & 5 deletions src/wasm-lib/tests/executor/inputs/basic_fillet_cube_end.kcl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const part001 = startSketchOn('XY')
|> startProfileAt([0,0], %)
|> line([0, 10], %, $thing)
|> line([10, 0], %)
|> line([0, -10], %, $thing2)
|> close(%)
|> extrude(10, %)
|> line(to = [0, 10], tag = $thing)
|> line(to = [10, 0])
|> line(to = [0, -10], tag = $thing2)
|> close()
|> extrude(length = 10)
|> fillet({radius: 2, tags: [thing, getOppositeEdge(thing)]}, %)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const part001 = startSketchOn('XY')
|> startProfileAt([0,0], %)
|> line([0, 10], %, $thing)
|> line([10, 0], %, $thing1)
|> line([0, -10], %, $thing2)
|> close(%, $thing3)
|> extrude(10, %)
|> line(to = [0, 10], tag = $thing)
|> line(to = [10, 0], tag = $thing1)
|> line(to = [0, -10], tag = $thing2)
|> close(tag = $thing3)
|> extrude(length = 10)
|> fillet({radius: 2, tags: [getNextAdjacentEdge(thing3)]}, %)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const part001 = startSketchOn('XY')
|> startProfileAt([0,0], %)
|> line([0, 10], %, $thing)
|> line([10, 0], %, $thing1)
|> line([0, -10], %, $thing2)
|> close(%, $thing3)
|> extrude(10, %)
|> line(to = [0, 10], tag = $thing)
|> line(to = [10, 0], tag = $thing1)
|> line(to = [0, -10], tag = $thing2)
|> close(tag = $thing3)
|> extrude(length = 10)
|> fillet({radius: 2, tags: [getPreviousAdjacentEdge(thing3)]}, %)
10 changes: 5 additions & 5 deletions src/wasm-lib/tests/executor/inputs/basic_fillet_cube_start.kcl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const part001 = startSketchOn('XY')
|> startProfileAt([0,0], %)
|> line([0, 10], %, $thing)
|> line([10, 0], %)
|> line([0, -10], %, $thing2)
|> close(%)
|> extrude(10, %)
|> line(to = [0, 10], tag = $thing)
|> line(to = [10, 0])
|> line(to = [0, -10], tag = $thing2)
|> close()
|> extrude(length = 10)
|> fillet({radius: 2, tags: [thing, thing2]}, %)

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([1, 3.82], %, $seg01)
|> line(to = [1, 3.82], tag = $seg01)
|> angledLineToX([
-angleToMatchLengthX(seg01, 3, %),
3
], %)
|> close(%)
|> extrude(10, %)
|> close()
|> extrude(length = 10)
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([1, 3.82], %, $seg01)
|> line(to = [1, 3.82], tag = $seg01)
|> angledLineToX([
-angleToMatchLengthY(seg01, 3, %),
3
], %)
|> close(%)
|> extrude(10, %)
|> close()
|> extrude(length = 10)
14 changes: 7 additions & 7 deletions src/wasm-lib/tests/executor/inputs/broken-code-test.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ const filletR = 0.25
// Sketch the bracket and extrude with fillets
const bracket = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([0, wallMountL], %, 'outerEdge')
|> line([-shelfMountL, 0], %)
|> line([0, -thickness], %)
|> line([shelfMountL - thickness, 0], %, 'innerEdge')
|> line([0, -wallMountL + thickness], %)
|> close(%)
|> extrude(width, %)
|> line(to = [0, wallMountL], tag = 'outerEdge')
|> line(to = [-shelfMountL, 0])
|> line(to = [0, -thickness])
|> line(to = [shelfMountL - thickness, 0], tag = 'innerEdge')
|> line(to = [0, -wallMountL + thickness])
|> close()
|> extrude(length = width)
|> fillet({
radius: filletR,
tags: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([0, 2], %)
|> line([3, 1], %)
|> line([0, -4], %)
|> close(%)
|> extrude(1, %)
|> line(to = [0, 2])
|> line(to = [3, 1])
|> line(to = [0, -4])
|> close()
|> extrude(length = 1)

pattn1 = patternLinear3d({
axis: [1, 0, 0],
Expand Down
4 changes: 2 additions & 2 deletions src/wasm-lib/tests/executor/inputs/close_arc.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ const height = 3
const body = startSketchOn('XY')
|> startProfileAt([center[0]+radius, center[1]], %)
|> arc({angle_end: 360, angle_start: 0, radius: radius}, %)
|> close(%)
|> extrude(height, %)
|> close()
|> extrude(length = height)
12 changes: 6 additions & 6 deletions src/wasm-lib/tests/executor/inputs/cube.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ fn cube(length, center) {
p3 = [ l + x, -l + y]

return startSketchAt(p0)
|> lineTo(p1, %)
|> lineTo(p2, %)
|> lineTo(p3, %)
|> lineTo(p0, %)
|> close(%)
|> extrude(length, %)
|> line(end = p1)
|> line(end = p2)
|> line(end = p3)
|> line(end = p0)
|> close()
|> extrude(length = length)
}

myCube = cube(40, [0,0])
2 changes: 1 addition & 1 deletion src/wasm-lib/tests/executor/inputs/cylinder.kcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const cylinder = startSketchOn('XY')
|> circle({ center: [0, 0], radius: 22 }, %)
|> extrude(14, %)
|> extrude(length = 14)
10 changes: 5 additions & 5 deletions src/wasm-lib/tests/executor/inputs/dimensions_match.kcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const part001 = startSketchOn('XY')
|> startProfileAt([-10, -10], %)
|> line([20, 0], %)
|> line([0, 20], %)
|> line([-20, 0], %)
|> close(%)
|> extrude(10, %)
|> line(to = [20, 0])
|> line(to = [0, 20])
|> line(to = [-20, 0])
|> close()
|> extrude(length = 10)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const sketch001 = startSketchOn('XZ')
|> startProfileAt([75.8, 317.2], %)
|> angledLine([0, 268.43], %, $rectangleSegmentA001)
|> angledline(to = [0, 268.43], tag = $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001) - 90,
217.26
Expand All @@ -9,9 +9,9 @@ const sketch001 = startSketchOn('XZ')
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $yo)
|> lineTo([profileStartX(%), profileStartY(%)], %, $seg02)
|> close(%)
const extrude001 = extrude(100, sketch001)
|> line(end = [profileStartX(%), profileStartY(%)])
|> close()
const extrude001 = extrude(sketch001, length = 100)
const chamf = chamfer({
length: 30,
tags: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const sketch001 = startSketchOn('XZ')
|> startProfileAt([75.8, 317.2], %) // [$startCapTag, $EndCapTag]
|> angledLine([0, 268.43], %, $rectangleSegmentA001)
|> angledline(to = [0, 268.43], tag = $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001) - 90,
217.26
Expand All @@ -9,9 +9,9 @@ const sketch001 = startSketchOn('XZ')
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $yo)
|> lineTo([profileStartX(%), profileStartY(%)], %, $seg02)
|> close(%)
const extrude001 = extrude(100, sketch001)
|> line(end = [profileStartX(%), profileStartY(%)])
|> close()
const extrude001 = extrude(sketch001, length = 100)
|> chamfer({
length = 30,
tags = [
Expand Down
16 changes: 8 additions & 8 deletions src/wasm-lib/tests/executor/inputs/extrude-custom-plane.kcl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// create a sketch with name sketch000
const sketch000 = startSketchOn('XY')
|> startProfileAt([0.0, 0.0], %)
|> line([1.0, 1.0], %, $line000)
|> line([0.0, -1.0], %, $line001)
|> line([-1.0, 0.0], %, $line002)
|> line(to = [1.0, 1.0], tag = $line000)
|> line(to = [0.0, -1.0], tag = $line001)
|> line(to = [-1.0, 0.0], tag = $line002)

// create an extrusion with name extrude000
const extrude000 = extrude(1.0, sketch000)
const extrude000 = extrude(sketch000, length = 1.0)

// define a plane with name plane005
const plane005 = {
Expand All @@ -21,9 +21,9 @@ const plane005 = {
// create a sketch with name sketch001
const sketch001 = startSketchOn(plane005)
|> startProfileAt([0.100000, 0.250000], %)
|> line([0.075545, 0.494260], %, $line003)
|> line([0.741390, -0.113317], %, $line004)
|> line([-0.816935, -0.380943], %, $line005)
|> line(to = [0.075545, 0.494260], tag = $line003)
|> line(to = [0.741390, -0.113317], tag = $line004)
|> line(to = [-0.816935, -0.380943], tag = $line005)

// create an extrusion with name extrude001
const extrude001 = extrude(1.0, sketch001)
const extrude001 = extrude(sketch001, length = 1.0)
36 changes: 18 additions & 18 deletions src/wasm-lib/tests/executor/inputs/extrude-inside-fn-with-tags.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ const tabThk = 4
fn rectShape = (pos, w, l) => {
const rr = startSketchOn('xy')
|> startProfileAt([pos[0] - (w / 2), pos[1] - (l / 2)], %)
|> lineTo([pos[0] + w / 2, pos[1] - (l / 2)], %, $edge01)
|> lineTo([pos[0] + w / 2, pos[1] + l / 2], %, $edge02)
|> lineTo([pos[0] - (w / 2), pos[1] + l / 2], %, $edge03)
|> close(%, $edge04)
|> line(end = [pos[0] + w / 2, pos[1] - (l / 2)])
|> line(end = [pos[0] + w / 2, pos[1] + l / 2])
|> line(end = [pos[0] - (w / 2), pos[1] + l / 2])
|> close(tag = $edge04)
return rr
}

Expand All @@ -38,15 +38,15 @@ const bracketPlane = {
fn bracketSketch = (w, d, t) => {
const s = startSketchOn(bracketPlane)
|> startProfileAt([-w / 2 - t, d + t], %)
|> lineTo([-w / 2 - t, -t], %, $edge1)
|> lineTo([w / 2 + t, -t], %, $edge2)
|> lineTo([w / 2 + t, d + t], %, $edge3)
|> lineTo([w / 2, d + t], %, $edge4)
|> lineTo([w / 2, 0], %, $edge5)
|> lineTo([-w / 2, 0], %, $edge6)
|> lineTo([-w / 2, d + t], %, $edge7)
|> close(%, $edge8)
|> extrude(length + 2 * thk, %)
|> line(end = [-w / 2 - t, -t], tag = $edge1)
|> line(end = [w / 2 + t, -t], tag = $edge2)
|> line(end = [w / 2 + t, d + t], tag = $edge3)
|> line(end = [w / 2, d + t], tag = $edge4)
|> line(end = [w / 2, 0], tag = $edge5)
|> line(end = [-w / 2, 0], tag = $edge6)
|> line(end = [-w / 2, d + t], tag = $edge7)
|> close(tag = $edge8)
|> extrude(length = length + 2 * thk)
return s
}

Expand All @@ -67,8 +67,8 @@ const bracketBody = bs
// sketch on the face
const retBack = startSketchOn(bs, bs.sketch.tags.edge4)
|> startProfileAt([length / 2 + thk, 0], %)
|> line([0, thk], %)
|> line([-thk, 0], %)
|> line([0, -thk], %)
|> close(%)
|> extrude(width - 40, %)
|> line(to = [0, thk])
|> line(to = [-thk, 0])
|> line(to = [0, -thk])
|> close()
|> extrude(length = width - 40)
14 changes: 7 additions & 7 deletions src/wasm-lib/tests/executor/inputs/fillet-and-shell.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ const miniHdmiHole = startSketchAt([
1,
border + miniHdmiDistance - (miniHdmiWidth / 2)
], %)
|> close(%)
|> close()

const case = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> lineTo([caseWidth, 0], %, $edge1)
|> lineTo([caseWidth, caseLength], %, $edge2)
|> lineTo([0, caseLength], %, $edge3)
|> close(%, $edge4)
|> extrude(caseHeight, %)
|> line(end = [caseWidth, 0])
|> line(end = [caseWidth, caseLength])
|> line(end = [0, caseLength])
|> close(tag = $edge4)
|> extrude(length = caseHeight)
|> fillet({
radius: 1,
tags: [
Expand All @@ -63,7 +63,7 @@ fn m25Screw = (x, y, height) => {
|> startProfileAt([0, 0], %)
|> circle({ center: [x, y], radius: 2.5 }, %)
|> hole(circle({ center: [x, y], radius: 1.25 }, %), %)
|> extrude(height, %)
|> extrude(length = height)
return screw
}

Expand Down
10 changes: 5 additions & 5 deletions src/wasm-lib/tests/executor/inputs/fillet_duplicate_tags.kcl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const part001 = startSketchOn('XY')
|> startProfileAt([0,0], %)
|> line([0, 10], %, $thing)
|> line([10, 0], %)
|> line([0, -10], %, $thing2)
|> close(%)
|> extrude(10, %)
|> line(to = [0, 10], tag = $thing)
|> line(to = [10, 0])
|> line(to = [0, -10], tag = $thing2)
|> close()
|> extrude(length = 10)
|> fillet({radius: 0.5, tags: [thing, thing]}, %)
Loading

0 comments on commit b686ca2

Please sign in to comment.