KCL: User-defined KCL functions in examples etc now use keywords (#6603)
Preparing for the removal of positional functions from the language. The first big step is to change all our KCL code examples, test code, public samples etc to all use keyword functions. Apologies for how large this PR is. Most of it is: - Changing example KCL that defined its own functions, so the functions now use keyword arguments rather than positional arguments. E.g. change `cube([20, 20])` to be `cube(center = [20, 20])`. - Some parts of the code assumed positional code and didn't handle keyword calls, e.g. the linter would only check for positional calls to startSketchOn. Now they should work with either positional or keyword. - Update all the artifacts This does _not_ remove support for positional calls. That will be in a follow-up PR.
This commit is contained in:
@ -72,9 +72,9 @@ fn cube(center) {
|
|||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
example0 = cube([0, 0])
|
example0 = cube(center = [0, 0])
|
||||||
example1 = cube([20, 0])
|
example1 = cube(center = [20, 0])
|
||||||
example2 = cube([40, 0])
|
example2 = cube(center = [40, 0])
|
||||||
|
|
||||||
appearance(
|
appearance(
|
||||||
[example0, example1],
|
[example0, example1],
|
||||||
|
@ -76,7 +76,7 @@ sg = startSketchOn(XY)
|
|||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
|
|
||||||
part001 = cube([0,0], 20)
|
part001 = cube(pos = [0,0], scale = 20)
|
||||||
|> close(tag = $line1)
|
|> close(tag = $line1)
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
// We tag the chamfer to reference it later.
|
// We tag the chamfer to reference it later.
|
||||||
|
@ -44,8 +44,8 @@ fn cube(center, size) {
|
|||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
part001 = cube([0, 0], 10)
|
part001 = cube(center = [0, 0], size = 10)
|
||||||
part002 = cube([7, 3], 5)
|
part002 = cube(center = [7, 3], size = 5)
|
||||||
|> translate(z = 1)
|
|> translate(z = 1)
|
||||||
|
|
||||||
intersectedPart = intersect([part001, part002])
|
intersectedPart = intersect([part001, part002])
|
||||||
@ -69,8 +69,8 @@ fn cube(center, size) {
|
|||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
part001 = cube([0, 0], 10)
|
part001 = cube(center = [0, 0], size = 10)
|
||||||
part002 = cube([7, 3], 5)
|
part002 = cube(center = [7, 3], size = 5)
|
||||||
|> translate(z = 1)
|
|> translate(z = 1)
|
||||||
|
|
||||||
// This is the equivalent of: intersect([part001, part002])
|
// This is the equivalent of: intersect([part001, part002])
|
||||||
|
@ -32,7 +32,7 @@ map(
|
|||||||
|
|
||||||
```kcl
|
```kcl
|
||||||
r = 10 // radius
|
r = 10 // radius
|
||||||
fn drawCircle(id) {
|
fn drawCircle(@id) {
|
||||||
return startSketchOn(XY)
|
return startSketchOn(XY)
|
||||||
|> circle(center = [id * 2 * r, 0], radius = r)
|
|> circle(center = [id * 2 * r, 0], radius = r)
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ to other modules.
|
|||||||
|
|
||||||
```kcl
|
```kcl
|
||||||
// util.kcl
|
// util.kcl
|
||||||
export fn increment(x) {
|
export fn increment(@x) {
|
||||||
return x + 1
|
return x + 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -37,11 +37,11 @@ Multiple functions can be exported in a file.
|
|||||||
|
|
||||||
```kcl
|
```kcl
|
||||||
// util.kcl
|
// util.kcl
|
||||||
export fn increment(x) {
|
export fn increment(@x) {
|
||||||
return x + 1
|
return x + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn decrement(x) {
|
export fn decrement(@x) {
|
||||||
return x - 1
|
return x - 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -81,7 +81,7 @@ fn cube(center) {
|
|||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
myCube = cube([0, 0])
|
myCube = cube(center = [0, 0])
|
||||||
```
|
```
|
||||||
|
|
||||||
*Pros*
|
*Pros*
|
||||||
|
File diff suppressed because one or more lines are too long
@ -36,7 +36,7 @@ patternTransform2d(
|
|||||||
|
|
||||||
```kcl
|
```kcl
|
||||||
// Each instance will be shifted along the X axis.
|
// Each instance will be shifted along the X axis.
|
||||||
fn transform(id) {
|
fn transform(@id) {
|
||||||
return { translate = [4 * id, 0] }
|
return { translate = [4 * id, 0] }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ fn add(a, b) {
|
|||||||
// This function adds an array of numbers.
|
// This function adds an array of numbers.
|
||||||
// It uses the `reduce` function, to call the `add` function on every
|
// It uses the `reduce` function, to call the `add` function on every
|
||||||
// element of the `arr` parameter. The starting value is 0.
|
// element of the `arr` parameter. The starting value is 0.
|
||||||
fn sum(arr) {
|
fn sum(@arr) {
|
||||||
return reduce(arr, initial = 0, f = add)
|
return reduce(arr, initial = 0, f = add)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ assert(
|
|||||||
|
|
||||||
```kcl
|
```kcl
|
||||||
// Declare a function that sketches a decagon.
|
// Declare a function that sketches a decagon.
|
||||||
fn decagon(radius) {
|
fn decagon(@radius) {
|
||||||
// Each side of the decagon is turned this many radians from the previous angle.
|
// Each side of the decagon is turned this many radians from the previous angle.
|
||||||
stepAngle = (1 / 10 * TAU): number(rad)
|
stepAngle = (1 / 10 * TAU): number(rad)
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -32507,7 +32507,7 @@
|
|||||||
"examples": [
|
"examples": [
|
||||||
"// Add color to an extruded solid.\nexampleSketch = startSketchOn(XZ)\n |> startProfile(at = [0, 0])\n |> line(endAbsolute = [10, 0])\n |> line(endAbsolute = [0, 10])\n |> line(endAbsolute = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)\n // There are other options besides 'color', but they're optional.\n |> appearance(color = '#ff0000')",
|
"// Add color to an extruded solid.\nexampleSketch = startSketchOn(XZ)\n |> startProfile(at = [0, 0])\n |> line(endAbsolute = [10, 0])\n |> line(endAbsolute = [0, 10])\n |> line(endAbsolute = [-10, 0])\n |> close()\n\nexample = extrude(exampleSketch, length = 5)\n // There are other options besides 'color', but they're optional.\n |> appearance(color = '#ff0000')",
|
||||||
"// Add color to a revolved solid.\nsketch001 = startSketchOn(XY)\n |> circle(center = [15, 0], radius = 5)\n |> revolve(angle = 360, axis = Y)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
|
"// Add color to a revolved solid.\nsketch001 = startSketchOn(XY)\n |> circle(center = [15, 0], radius = 5)\n |> revolve(angle = 360, axis = Y)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
|
||||||
"// Add color to different solids.\nfn cube(center) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] + 10])\n |> line(endAbsolute = [center[0] - 10, center[1] + 10])\n |> close()\n |> extrude(length = 10)\n}\n\nexample0 = cube([0, 0])\nexample1 = cube([20, 0])\nexample2 = cube([40, 0])\n\nappearance(\n [example0, example1],\n color = '#ff0000',\n metalness = 50,\n roughness = 50,\n)\nappearance(\n example2,\n color = '#00ff00',\n metalness = 50,\n roughness = 50,\n)",
|
"// Add color to different solids.\nfn cube(center) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] - 10])\n |> line(endAbsolute = [center[0] + 10, center[1] + 10])\n |> line(endAbsolute = [center[0] - 10, center[1] + 10])\n |> close()\n |> extrude(length = 10)\n}\n\nexample0 = cube(center = [0, 0])\nexample1 = cube(center = [20, 0])\nexample2 = cube(center = [40, 0])\n\nappearance(\n [example0, example1],\n color = '#ff0000',\n metalness = 50,\n roughness = 50,\n)\nappearance(\n example2,\n color = '#00ff00',\n metalness = 50,\n roughness = 50,\n)",
|
||||||
"// You can set the appearance before or after you shell it will yield the same result.\n// This example shows setting the appearance _after_ the shell.\nfirstSketch = startSketchOn(XY)\n |> startProfile(at = [-12, 12])\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n\nshell(firstSketch, faces = [END], thickness = 0.25)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
|
"// You can set the appearance before or after you shell it will yield the same result.\n// This example shows setting the appearance _after_ the shell.\nfirstSketch = startSketchOn(XY)\n |> startProfile(at = [-12, 12])\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n\nshell(firstSketch, faces = [END], thickness = 0.25)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
|
||||||
"// You can set the appearance before or after you shell it will yield the same result.\n// This example shows setting the appearance _before_ the shell.\nfirstSketch = startSketchOn(XY)\n |> startProfile(at = [-12, 12])\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)\n\nshell(firstSketch, faces = [END], thickness = 0.25)",
|
"// You can set the appearance before or after you shell it will yield the same result.\n// This example shows setting the appearance _before_ the shell.\nfirstSketch = startSketchOn(XY)\n |> startProfile(at = [-12, 12])\n |> line(end = [24, 0])\n |> line(end = [0, -24])\n |> line(end = [-24, 0])\n |> close()\n |> extrude(length = 6)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)\n\nshell(firstSketch, faces = [END], thickness = 0.25)",
|
||||||
"// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.\n// This example shows _before_ the pattern.\nexampleSketch = startSketchOn(XZ)\n |> startProfile(at = [0, 0])\n |> line(end = [0, 2])\n |> line(end = [3, 1])\n |> line(end = [0, -4])\n |> close()\n\nexample = extrude(exampleSketch, length = 1)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)\n |> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)",
|
"// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.\n// This example shows _before_ the pattern.\nexampleSketch = startSketchOn(XZ)\n |> startProfile(at = [0, 0])\n |> line(end = [0, 2])\n |> line(end = [3, 1])\n |> line(end = [0, -4])\n |> close()\n\nexample = extrude(exampleSketch, length = 1)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)\n |> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)",
|
||||||
@ -90118,8 +90118,8 @@
|
|||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"examples": [
|
"examples": [
|
||||||
"// Intersect two cubes using the stdlib functions.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0], 10)\npart002 = cube([7, 3], 5)\n |> translate(z = 1)\n\nintersectedPart = intersect([part001, part002])",
|
"// Intersect two cubes using the stdlib functions.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube(center = [0, 0], size = 10)\npart002 = cube(center = [7, 3], size = 5)\n |> translate(z = 1)\n\nintersectedPart = intersect([part001, part002])",
|
||||||
"// Intersect two cubes using operators.\n// NOTE: This will not work when using codemods through the UI.\n// Codemods will generate the stdlib function call instead.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0], 10)\npart002 = cube([7, 3], 5)\n |> translate(z = 1)\n\n// This is the equivalent of: intersect([part001, part002])\nintersectedPart = part001 & part002"
|
"// Intersect two cubes using operators.\n// NOTE: This will not work when using codemods through the UI.\n// Codemods will generate the stdlib function call instead.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube(center = [0, 0], size = 10)\npart002 = cube(center = [7, 3], size = 5)\n |> translate(z = 1)\n\n// This is the equivalent of: intersect([part001, part002])\nintersectedPart = part001 & part002"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -133614,7 +133614,7 @@
|
|||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"examples": [
|
"examples": [
|
||||||
"r = 10 // radius\nfn drawCircle(id) {\n return startSketchOn(XY)\n |> circle(center = [id * 2 * r, 0], radius = r)\n}\n\n// Call `drawCircle`, passing in each element of the array.\n// The outputs from each `drawCircle` form a new array,\n// which is the return value from `map`.\ncircles = map([1..3], f = drawCircle)",
|
"r = 10 // radius\nfn drawCircle(@id) {\n return startSketchOn(XY)\n |> circle(center = [id * 2 * r, 0], radius = r)\n}\n\n// Call `drawCircle`, passing in each element of the array.\n// The outputs from each `drawCircle` form a new array,\n// which is the return value from `map`.\ncircles = map([1..3], f = drawCircle)",
|
||||||
"r = 10 // radius\n// Call `map`, using an anonymous function instead of a named one.\ncircles = map(\n [1..3],\n f = fn(id) {\n return startSketchOn(XY)\n |> circle(center = [id * 2 * r, 0], radius = r)\n },\n)"
|
"r = 10 // radius\n// Call `map`, using an anonymous function instead of a named one.\ncircles = map(\n [1..3],\n f = fn(id) {\n return startSketchOn(XY)\n |> circle(center = [id * 2 * r, 0], radius = r)\n },\n)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -185080,12 +185080,12 @@
|
|||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"examples": [
|
"examples": [
|
||||||
"// Each instance will be shifted along the X axis.\nfn transform(id) {\n return { translate = [4 * id, 0, 0] }\n}\n\n// Sketch 4 cylinders.\nsketch001 = startSketchOn(XZ)\n |> circle(center = [0, 0], radius = 2)\n |> extrude(length = 5)\n |> patternTransform(instances = 4, transform = transform)",
|
"// Each instance will be shifted along the X axis.\nfn transform(@id) {\n return { translate = [4 * id, 0, 0] }\n}\n\n// Sketch 4 cylinders.\nsketch001 = startSketchOn(XZ)\n |> circle(center = [0, 0], radius = 2)\n |> extrude(length = 5)\n |> patternTransform(instances = 4, transform = transform)",
|
||||||
"// Each instance will be shifted along the X axis,\n// with a gap between the original (at x = 0) and the first replica\n// (at x = 8). This is because `id` starts at 1.\nfn transform(id) {\n return { translate = [4 * (1 + id), 0, 0] }\n}\n\nsketch001 = startSketchOn(XZ)\n |> circle(center = [0, 0], radius = 2)\n |> extrude(length = 5)\n |> patternTransform(instances = 4, transform = transform)",
|
"// Each instance will be shifted along the X axis,\n// with a gap between the original (at x = 0) and the first replica\n// (at x = 8). This is because `id` starts at 1.\nfn transform(@id) {\n return { translate = [4 * (1 + id), 0, 0] }\n}\n\nsketch001 = startSketchOn(XZ)\n |> circle(center = [0, 0], radius = 2)\n |> extrude(length = 5)\n |> patternTransform(instances = 4, transform = transform)",
|
||||||
"fn cube(length, center) {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchOn(XY)\n |> startProfile(at = p0)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> line(endAbsolute = p0)\n |> close()\n |> extrude(length = length)\n}\n\nwidth = 20\nfn transform(i) {\n return {\n // Move down each time.\n translate = [0, 0, -i * width],\n // Make the cube longer, wider and flatter each time.\n scale = [\n pow(1.1, exp = i),\n pow(1.1, exp = i),\n pow(0.9, exp = i)\n ],\n // Turn by 15 degrees each time.\n rotation = { angle = 15 * i, origin = \"local\" }\n }\n}\n\nmyCubes = cube(width, [100, 0])\n |> patternTransform(instances = 25, transform = transform)",
|
"fn cube(length, center) {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchOn(XY)\n |> startProfile(at = p0)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> line(endAbsolute = p0)\n |> close()\n |> extrude(length = length)\n}\n\nwidth = 20\nfn transform(@i) {\n return {\n // Move down each time.\n translate = [0, 0, -i * width],\n // Make the cube longer, wider and flatter each time.\n scale = [\n pow(1.1, exp = i),\n pow(1.1, exp = i),\n pow(0.9, exp = i)\n ],\n // Turn by 15 degrees each time.\n rotation = { angle = 15 * i, origin = \"local\" }\n }\n}\n\nmyCubes = cube(length = width, center = [100, 0])\n |> patternTransform(instances = 25, transform = transform)",
|
||||||
"fn cube(length, center) {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchOn(XY)\n |> startProfile(at = p0)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> line(endAbsolute = p0)\n |> close()\n |> extrude(length = length)\n}\n\nwidth = 20\nfn transform(i) {\n return {\n translate = [0, 0, -i * width],\n rotation = {\n angle = 90 * i,\n // Rotate around the overall scene's origin.\n origin = \"global\"\n }\n }\n}\nmyCubes = cube(width, [100, 100])\n |> patternTransform(instances = 4, transform = transform)",
|
"fn cube(length, center) {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchOn(XY)\n |> startProfile(at = p0)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> line(endAbsolute = p0)\n |> close()\n |> extrude(length = length)\n}\n\nwidth = 20\nfn transform(@i) {\n return {\n translate = [0, 0, -i * width],\n rotation = {\n angle = 90 * i,\n // Rotate around the overall scene's origin.\n origin = \"global\"\n }\n }\n}\nmyCubes = cube(length = width, center = [100, 100])\n |> patternTransform(instances = 4, transform = transform)",
|
||||||
"// Parameters\nr = 50 // base radius\nh = 10 // layer height\nt = 0.005 // taper factor [0-1)\n// Defines how to modify each layer of the vase.\n// Each replica is shifted up the Z axis, and has a smoothly-varying radius\nfn transform(replicaId) {\n scale = r * abs(1 - (t * replicaId)) * (5 + cos((replicaId / 8): number(rad)))\n return {\n translate = [0, 0, replicaId * 10],\n scale = [scale, scale, 0]\n }\n}\n// Each layer is just a pretty thin cylinder.\nfn layer() {\n return startSketchOn(XY)\n // or some other plane idk\n |> circle(center = [0, 0], radius = 1, tag = $tag1)\n |> extrude(length = h)\n}\n// The vase is 100 layers tall.\n// The 100 layers are replica of each other, with a slight transformation applied to each.\nvase = layer()\n |> patternTransform(instances = 100, transform = transform)",
|
"// Parameters\nr = 50 // base radius\nh = 10 // layer height\nt = 0.005 // taper factor [0-1)\n// Defines how to modify each layer of the vase.\n// Each replica is shifted up the Z axis, and has a smoothly-varying radius\nfn transform(@replicaId) {\n scale = r * abs(1 - (t * replicaId)) * (5 + cos((replicaId / 8): number(rad)))\n return {\n translate = [0, 0, replicaId * 10],\n scale = [scale, scale, 0]\n }\n}\n// Each layer is just a pretty thin cylinder.\nfn layer() {\n return startSketchOn(XY)\n // or some other plane idk\n |> circle(center = [0, 0], radius = 1, tag = $tag1)\n |> extrude(length = h)\n}\n// The vase is 100 layers tall.\n// The 100 layers are replica of each other, with a slight transformation applied to each.\nvase = layer()\n |> patternTransform(instances = 100, transform = transform)",
|
||||||
"fn transform(i) {\n // Transform functions can return multiple transforms. They'll be applied in order.\n return [\n { translate = [30 * i, 0, 0] },\n { rotation = { angle = 45 * i } }\n ]\n}\nstartSketchOn(XY)\n |> startProfile(at = [0, 0])\n |> polygon(\n radius = 10,\n numSides = 4,\n center = [0, 0],\n inscribed = false,\n )\n |> extrude(length = 4)\n |> patternTransform(instances = 3, transform = transform)"
|
"fn transform(@i) {\n // Transform functions can return multiple transforms. They'll be applied in order.\n return [\n { translate = [30 * i, 0, 0] },\n { rotation = { angle = 45 * i } }\n ]\n}\nstartSketchOn(XY)\n |> startProfile(at = [0, 0])\n |> polygon(\n radius = 10,\n numSides = 4,\n center = [0, 0],\n inscribed = false,\n )\n |> extrude(length = 4)\n |> patternTransform(instances = 3, transform = transform)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -193126,7 +193126,7 @@
|
|||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"examples": [
|
"examples": [
|
||||||
"// Each instance will be shifted along the X axis.\nfn transform(id) {\n return { translate = [4 * id, 0] }\n}\n\n// Sketch 4 circles.\nsketch001 = startSketchOn(XZ)\n |> circle(center = [0, 0], radius = 2)\n |> patternTransform2d(instances = 4, transform = transform)"
|
"// Each instance will be shifted along the X axis.\nfn transform(@id) {\n return { translate = [4 * id, 0] }\n}\n\n// Sketch 4 circles.\nsketch001 = startSketchOn(XZ)\n |> circle(center = [0, 0], radius = 2)\n |> patternTransform2d(instances = 4, transform = transform)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -232205,9 +232205,9 @@
|
|||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"examples": [
|
"examples": [
|
||||||
"// This function adds two numbers.\nfn add(a, b) {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(arr) {\n return reduce(arr, initial = 0, f = add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n sum([1, 2, 3]),\n isEqualTo = 6,\n tolerance = 0.1,\n error = \"1 + 2 + 3 summed is 6\",\n)",
|
"// This function adds two numbers.\nfn add(a, b) {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(@arr) {\n return reduce(arr, initial = 0, f = add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n sum([1, 2, 3]),\n isEqualTo = 6,\n tolerance = 0.1,\n error = \"1 + 2 + 3 summed is 6\",\n)",
|
||||||
"// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(\n arr,\n initial = 0,\n f = fn(i, result_so_far) {\n return i + result_so_far\n },\n)\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n sum,\n isEqualTo = 6,\n tolerance = 0.1,\n error = \"1 + 2 + 3 summed is 6\",\n)",
|
"// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(\n arr,\n initial = 0,\n f = fn(i, result_so_far) {\n return i + result_so_far\n },\n)\n\n// We use `assert` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassert(\n sum,\n isEqualTo = 6,\n tolerance = 0.1,\n error = \"1 + 2 + 3 summed is 6\",\n)",
|
||||||
"// Declare a function that sketches a decagon.\nfn decagon(radius) {\n // Each side of the decagon is turned this many radians from the previous angle.\n stepAngle = (1 / 10 * TAU): number(rad)\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchOn(XY)\n |> startProfile(at = [cos(0) * radius, sin(0) * radius])\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce(\n [1..10],\n initial = startOfDecagonSketch,\n f = fn(i, partialDecagon) {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return line(partialDecagon, end = [x, y])\n },\n )\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n stepAngle = ((1/10) * TAU): number(rad)\n plane = startSketchOn(XY)\n startOfDecagonSketch = startProfile(plane, at = [(cos(0)*radius), (sin(0) * radius)])\n\n // Here's the reduce part.\n partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n partialDecagon = line(partialDecagon, end = [x, y])\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close()"
|
"// Declare a function that sketches a decagon.\nfn decagon(@radius) {\n // Each side of the decagon is turned this many radians from the previous angle.\n stepAngle = (1 / 10 * TAU): number(rad)\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchOn(XY)\n |> startProfile(at = [cos(0) * radius, sin(0) * radius])\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce(\n [1..10],\n initial = startOfDecagonSketch,\n f = fn(i, partialDecagon) {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return line(partialDecagon, end = [x, y])\n },\n )\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n stepAngle = ((1/10) * TAU): number(rad)\n plane = startSketchOn(XY)\n startOfDecagonSketch = startProfile(plane, at = [(cos(0)*radius), (sin(0) * radius)])\n\n // Here's the reduce part.\n partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n partialDecagon = line(partialDecagon, end = [x, y])\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -255105,7 +255105,7 @@
|
|||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"examples": [
|
"examples": [
|
||||||
"w = 15\ncube = startSketchOn(XY)\n |> startProfile(at = [0, 0])\n |> line(end = [w, 0], tag = $line1)\n |> line(end = [0, w], tag = $line2)\n |> line(end = [-w, 0], tag = $line3)\n |> line(end = [0, -w], tag = $line4)\n |> close()\n |> extrude(length = 5)\n\nfn cylinder(radius, tag) {\n return startSketchOn(XY)\n |> startProfile(at = [0, 0])\n |> circle(radius = radius, center = segEnd(tag))\n |> extrude(length = radius)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)"
|
"w = 15\ncube = startSketchOn(XY)\n |> startProfile(at = [0, 0])\n |> line(end = [w, 0], tag = $line1)\n |> line(end = [0, w], tag = $line2)\n |> line(end = [-w, 0], tag = $line3)\n |> line(end = [0, -w], tag = $line4)\n |> close()\n |> extrude(length = 5)\n\nfn cylinder(radius, tag) {\n return startSketchOn(XY)\n |> startProfile(at = [0, 0])\n |> circle(radius = radius, center = segEnd(tag))\n |> extrude(length = radius)\n}\n\ncylinder(radius = 1, tag = line1)\ncylinder(radius = 2, tag = line2)\ncylinder(radius = 3, tag = line3)\ncylinder(radius = 4, tag = line4)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -255307,7 +255307,7 @@
|
|||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"examples": [
|
"examples": [
|
||||||
"w = 15\ncube = startSketchOn(XY)\n |> startProfile(at = [0, 0])\n |> line(end = [w, 0], tag = $line1)\n |> line(end = [0, w], tag = $line2)\n |> line(end = [-w, 0], tag = $line3)\n |> line(end = [0, -w], tag = $line4)\n |> close()\n |> extrude(length = 5)\n\nfn cylinder(radius, tag) {\n return startSketchOn(XY)\n |> startProfile(at = [0, 0])\n |> circle(radius = radius, center = segStart(tag))\n |> extrude(length = radius)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)"
|
"w = 15\ncube = startSketchOn(XY)\n |> startProfile(at = [0, 0])\n |> line(end = [w, 0], tag = $line1)\n |> line(end = [0, w], tag = $line2)\n |> line(end = [-w, 0], tag = $line3)\n |> line(end = [0, -w], tag = $line4)\n |> close()\n |> extrude(length = 5)\n\nfn cylinder(radius, tag) {\n return startSketchOn(XY)\n |> startProfile(at = [0, 0])\n |> circle(radius = radius, center = segStart(tag))\n |> extrude(length = radius)\n}\n\ncylinder(radius = 1, tag = line1)\ncylinder(radius = 2, tag = line2)\ncylinder(radius = 3, tag = line3)\ncylinder(radius = 4, tag = line4)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -273775,8 +273775,8 @@
|
|||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"examples": [
|
"examples": [
|
||||||
"// Subtract a cylinder from a cube using the stdlib functions.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0], 10)\npart002 = cube([7, 3], 5)\n |> translate(z = 1)\n\nsubtractedPart = subtract([part001], tools = [part002])",
|
"// Subtract a cylinder from a cube using the stdlib functions.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube(center = [0, 0], size = 10)\npart002 = cube(center = [7, 3], size = 5)\n |> translate(z = 1)\n\nsubtractedPart = subtract([part001], tools = [part002])",
|
||||||
"// Subtract a cylinder from a cube using operators.\n// NOTE: This will not work when using codemods through the UI.\n// Codemods will generate the stdlib function call instead.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0], 10)\npart002 = cube([7, 3], 5)\n |> translate(z = 1)\n\n// This is the equivalent of: subtract([part001], tools=[part002])\nsubtractedPart = part001 - part002"
|
"// Subtract a cylinder from a cube using operators.\n// NOTE: This will not work when using codemods through the UI.\n// Codemods will generate the stdlib function call instead.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube(center = [0, 0], size = 10)\npart002 = cube(center = [7, 3], size = 5)\n |> translate(z = 1)\n\n// This is the equivalent of: subtract([part001], tools=[part002])\nsubtractedPart = part001 - part002"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -311484,7 +311484,7 @@
|
|||||||
"// Move a pipe.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn(XZ)\n |> startProfile(at = [0.05, 0.05])\n |> line(end = [0, 7])\n |> tangentialArc(angle = 90, radius = 5)\n |> line(end = [-3, 0])\n |> tangentialArc(angle = -90, radius = 5)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 2)\n |> subtract2d(tool = pipeHole)\n |> sweep(path = sweepPath)\n |> translate(x = 1.0, y = 1.0, z = 2.5)",
|
"// Move a pipe.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn(XZ)\n |> startProfile(at = [0.05, 0.05])\n |> line(end = [0, 7])\n |> tangentialArc(angle = 90, radius = 5)\n |> line(end = [-3, 0])\n |> tangentialArc(angle = -90, radius = 5)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn(XY)\n |> circle(center = [0, 0], radius = 2)\n |> subtract2d(tool = pipeHole)\n |> sweep(path = sweepPath)\n |> translate(x = 1.0, y = 1.0, z = 2.5)",
|
||||||
"// Move an imported model.\n\n\nimport \"tests/inputs/cube.sldprt\" as cube\n\n// Circle so you actually see the move.\nstartSketchOn(XY)\n |> circle(center = [-10, -10], radius = 10)\n |> extrude(length = 10)\n\ncube\n |> translate(x = 10.0, y = 10.0, z = 2.5)",
|
"// Move an imported model.\n\n\nimport \"tests/inputs/cube.sldprt\" as cube\n\n// Circle so you actually see the move.\nstartSketchOn(XY)\n |> circle(center = [-10, -10], radius = 10)\n |> extrude(length = 10)\n\ncube\n |> translate(x = 10.0, y = 10.0, z = 2.5)",
|
||||||
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn(XY)\nrectangleSketch = startProfile(sketch001, at = [-200, 23.86])\n |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)\n |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 50.61)\n |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn(YZ)\nsweepPath = startProfile(sketch002, at = [0, 0])\n |> yLine(length = 231.81)\n |> tangentialArc(radius = 80, angle = -90)\n |> xLine(length = 384.93)\n\nparts = sweep([rectangleSketch, circleSketch], path = sweepPath)\n\n// Move the sweeps.\ntranslate(\n parts,\n x = 1.0,\n y = 1.0,\n z = 2.5,\n)",
|
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn(XY)\nrectangleSketch = startProfile(sketch001, at = [-200, 23.86])\n |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)\n |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 50.61)\n |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn(YZ)\nsweepPath = startProfile(sketch002, at = [0, 0])\n |> yLine(length = 231.81)\n |> tangentialArc(radius = 80, angle = -90)\n |> xLine(length = 384.93)\n\nparts = sweep([rectangleSketch, circleSketch], path = sweepPath)\n\n// Move the sweeps.\ntranslate(\n parts,\n x = 1.0,\n y = 1.0,\n z = 2.5,\n)",
|
||||||
"// Move a sketch.\n\n\nfn square(length) {\n l = length / 2\n p0 = [-l, -l]\n p1 = [-l, l]\n p2 = [l, l]\n p3 = [l, -l]\n\n return startSketchOn(XY)\n |> startProfile(at = p0)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> close()\n}\n\nsquare(10)\n |> translate(x = 5, y = 5)\n |> extrude(length = 10)",
|
"// Move a sketch.\n\n\nfn square(@length) {\n l = length / 2\n p0 = [-l, -l]\n p1 = [-l, l]\n p2 = [l, l]\n p3 = [l, -l]\n\n return startSketchOn(XY)\n |> startProfile(at = p0)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> close()\n}\n\nsquare(10)\n |> translate(x = 5, y = 5)\n |> extrude(length = 10)",
|
||||||
"// Translate and rotate a sketch to create a loft.\nsketch001 = startSketchOn(XY)\n\nfn square() {\n return startProfile(sketch001, at = [-10, 10])\n |> xLine(length = 20)\n |> yLine(length = -20)\n |> xLine(length = -20)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n}\n\nprofile001 = square()\n\nprofile002 = square()\n |> translate(z = 20)\n |> rotate(axis = [0, 0, 1.0], angle = 45)\n\nloft([profile001, profile002])"
|
"// Translate and rotate a sketch to create a loft.\nsketch001 = startSketchOn(XY)\n\nfn square() {\n return startProfile(sketch001, at = [-10, 10])\n |> xLine(length = 20)\n |> yLine(length = -20)\n |> xLine(length = -20)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n}\n\nprofile001 = square()\n\nprofile002 = square()\n |> translate(z = 20)\n |> rotate(axis = [0, 0, 1.0], angle = 45)\n\nloft([profile001, profile002])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -316320,9 +316320,9 @@
|
|||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"examples": [
|
"examples": [
|
||||||
"// Union two cubes using the stdlib functions.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0], 10)\npart002 = cube([7, 3], 5)\n |> translate(z = 1)\n\nunionedPart = union([part001, part002])",
|
"// Union two cubes using the stdlib functions.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube(center = [0, 0], size = 10)\npart002 = cube(center = [7, 3], size = 5)\n |> translate(z = 1)\n\nunionedPart = union([part001, part002])",
|
||||||
"// Union two cubes using operators.\n// NOTE: This will not work when using codemods through the UI.\n// Codemods will generate the stdlib function call instead.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0], 10)\npart002 = cube([7, 3], 5)\n |> translate(z = 1)\n\n// This is the equivalent of: union([part001, part002])\nunionedPart = part001 + part002",
|
"// Union two cubes using operators.\n// NOTE: This will not work when using codemods through the UI.\n// Codemods will generate the stdlib function call instead.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube(center = [0, 0], size = 10)\npart002 = cube(center = [7, 3], size = 5)\n |> translate(z = 1)\n\n// This is the equivalent of: union([part001, part002])\nunionedPart = part001 + part002",
|
||||||
"// Union two cubes using the more programmer-friendly operator.\n// NOTE: This will not work when using codemods through the UI.\n// Codemods will generate the stdlib function call instead.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube([0, 0], 10)\npart002 = cube([7, 3], 5)\n |> translate(z = 1)\n\n // This is the equivalent of: union([part001, part002])\n // Programmers will understand `|` as a union operation, but mechanical engineers\n// will understand `+`, we made both work.\nunionedPart = part001 | part002"
|
"// Union two cubes using the more programmer-friendly operator.\n// NOTE: This will not work when using codemods through the UI.\n// Codemods will generate the stdlib function call instead.\n\n\nfn cube(center, size) {\n return startSketchOn(XY)\n |> startProfile(at = [center[0] - size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] - size])\n |> line(endAbsolute = [center[0] + size, center[1] + size])\n |> line(endAbsolute = [center[0] - size, center[1] + size])\n |> close()\n |> extrude(length = 10)\n}\n\npart001 = cube(center = [0, 0], size = 10)\npart002 = cube(center = [7, 3], size = 5)\n |> translate(z = 1)\n\n // This is the equivalent of: union([part001, part002])\n // Programmers will understand `|` as a union operation, but mechanical engineers\n// will understand `+`, we made both work.\nunionedPart = part001 | part002"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -46,8 +46,8 @@ fn cube(center, size) {
|
|||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
part001 = cube([0, 0], 10)
|
part001 = cube(center = [0, 0], size = 10)
|
||||||
part002 = cube([7, 3], 5)
|
part002 = cube(center = [7, 3], size = 5)
|
||||||
|> translate(z = 1)
|
|> translate(z = 1)
|
||||||
|
|
||||||
subtractedPart = subtract([part001], tools = [part002])
|
subtractedPart = subtract([part001], tools = [part002])
|
||||||
@ -71,8 +71,8 @@ fn cube(center, size) {
|
|||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
part001 = cube([0, 0], 10)
|
part001 = cube(center = [0, 0], size = 10)
|
||||||
part002 = cube([7, 3], 5)
|
part002 = cube(center = [7, 3], size = 5)
|
||||||
|> translate(z = 1)
|
|> translate(z = 1)
|
||||||
|
|
||||||
// This is the equivalent of: subtract([part001], tools=[part002])
|
// This is the equivalent of: subtract([part001], tools=[part002])
|
||||||
|
@ -117,7 +117,7 @@ translate(
|
|||||||
// Move a sketch.
|
// Move a sketch.
|
||||||
|
|
||||||
|
|
||||||
fn square(length) {
|
fn square(@length) {
|
||||||
l = length / 2
|
l = length / 2
|
||||||
p0 = [-l, -l]
|
p0 = [-l, -l]
|
||||||
p1 = [-l, l]
|
p1 = [-l, l]
|
||||||
|
@ -249,8 +249,8 @@ fn rect(origin) {
|
|||||||
|> close()
|
|> close()
|
||||||
}
|
}
|
||||||
|
|
||||||
rect([0, 0])
|
rect(origin = [0, 0])
|
||||||
rect([20, 0])
|
rect(origin = [20, 0])
|
||||||
```
|
```
|
||||||
|
|
||||||
Those tags would only be available in the `rect` function and not globally.
|
Those tags would only be available in the `rect` function and not globally.
|
||||||
@ -279,8 +279,8 @@ fn rect(origin) {
|
|||||||
|> close()
|
|> close()
|
||||||
}
|
}
|
||||||
|
|
||||||
rect([0, 0])
|
rect(origin = [0, 0])
|
||||||
myRect = rect([20, 0])
|
myRect = rect(origin = [20, 0])
|
||||||
|
|
||||||
myRect
|
myRect
|
||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
|
@ -62,8 +62,8 @@ fn rect(origin) {
|
|||||||
|> close()
|
|> close()
|
||||||
}
|
}
|
||||||
|
|
||||||
rect([0, 0])
|
rect(origin = [0, 0])
|
||||||
rect([20, 0])
|
rect(origin = [20, 0])
|
||||||
```
|
```
|
||||||
|
|
||||||
Those tags would only be available in the `rect` function and not globally.
|
Those tags would only be available in the `rect` function and not globally.
|
||||||
@ -90,8 +90,8 @@ fn rect(origin) {
|
|||||||
|> close()
|
|> close()
|
||||||
}
|
}
|
||||||
|
|
||||||
rect([0, 0])
|
rect(origin = [0, 0])
|
||||||
myRect = rect([20, 0])
|
myRect = rect(origin = [20, 0])
|
||||||
|
|
||||||
myRect
|
myRect
|
||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
|
@ -44,8 +44,8 @@ fn cube(center, size) {
|
|||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
part001 = cube([0, 0], 10)
|
part001 = cube(center = [0, 0], size = 10)
|
||||||
part002 = cube([7, 3], 5)
|
part002 = cube(center = [7, 3], size = 5)
|
||||||
|> translate(z = 1)
|
|> translate(z = 1)
|
||||||
|
|
||||||
unionedPart = union([part001, part002])
|
unionedPart = union([part001, part002])
|
||||||
@ -69,8 +69,8 @@ fn cube(center, size) {
|
|||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
part001 = cube([0, 0], 10)
|
part001 = cube(center = [0, 0], size = 10)
|
||||||
part002 = cube([7, 3], 5)
|
part002 = cube(center = [7, 3], size = 5)
|
||||||
|> translate(z = 1)
|
|> translate(z = 1)
|
||||||
|
|
||||||
// This is the equivalent of: union([part001, part002])
|
// This is the equivalent of: union([part001, part002])
|
||||||
@ -95,8 +95,8 @@ fn cube(center, size) {
|
|||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
part001 = cube([0, 0], 10)
|
part001 = cube(center = [0, 0], size = 10)
|
||||||
part002 = cube([7, 3], 5)
|
part002 = cube(center = [7, 3], size = 5)
|
||||||
|> translate(z = 1)
|
|> translate(z = 1)
|
||||||
|
|
||||||
// This is the equivalent of: union([part001, part002])
|
// This is the equivalent of: union([part001, part002])
|
||||||
|
@ -139,4 +139,4 @@ fn rail8020(originStart, railHeight, railLength) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate one adjustable rail of 80/20
|
// Generate one adjustable rail of 80/20
|
||||||
rail8020([0, 0], 1.5, 48)
|
rail8020(originStart = [0, 0], railHeight = 1.5, railLength = 48)
|
||||||
|
@ -72,14 +72,14 @@ fn fanBlade(offsetHeight, startAngle: number(deg)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loft the fan blade cross sections into a single blade, then pattern them about the fan center
|
// Loft the fan blade cross sections into a single blade, then pattern them about the fan center
|
||||||
loft([
|
crossSections = [
|
||||||
fanBlade(4.5, 50),
|
fanBlade(offsetHeight = 4.5, startAngle = 50),
|
||||||
fanBlade((fanHeight - 2 - 4) / 2, 30),
|
fanBlade(offsetHeight = (fanHeight - 2 - 4) / 2, startAngle = 30),
|
||||||
fanBlade(fanHeight - 2, 0)
|
fanBlade(offsetHeight = fanHeight - 2, startAngle = 0)
|
||||||
])
|
]
|
||||||
|
loft(crossSections)
|
||||||
|> appearance(color = "#f3e2d8")
|
|> appearance(color = "#f3e2d8")
|
||||||
|> patternCircular3d(
|
|> patternCircular3d(
|
||||||
%,
|
|
||||||
instances = 9,
|
instances = 9,
|
||||||
axis = [0, 0, 1],
|
axis = [0, 0, 1],
|
||||||
center = [0, 0, 0],
|
center = [0, 0, 0],
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
export dividerThickness = 4
|
export dividerThickness = 4
|
||||||
|
|
||||||
fn dividerSketch(plane) {
|
fn dividerSketch(@plane) {
|
||||||
sketch000 = startSketchOn(plane)
|
sketch000 = startSketchOn(plane)
|
||||||
|> startProfile(at = [-16.82, 21.2])
|
|> startProfile(at = [-16.82, 21.2])
|
||||||
|> line(end = [-0.13, -1.27])
|
|> line(end = [-0.13, -1.27])
|
||||||
@ -33,7 +33,7 @@ fn dividerSketch(plane) {
|
|||||||
return sketch000
|
return sketch000
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn divider(plane) {
|
export fn divider(@plane) {
|
||||||
right = dividerSketch(plane)
|
right = dividerSketch(plane)
|
||||||
|> extrude(length = dividerThickness / 2)
|
|> extrude(length = dividerThickness / 2)
|
||||||
left = dividerSketch(plane)
|
left = dividerSketch(plane)
|
||||||
@ -43,7 +43,7 @@ export fn divider(plane) {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn connectorSketch(plane, start) {
|
fn connectorSketch(@plane, start) {
|
||||||
sketch001 = startSketchOn(plane)
|
sketch001 = startSketchOn(plane)
|
||||||
|> startProfile(at = start)
|
|> startProfile(at = start)
|
||||||
|> polygon(
|
|> polygon(
|
||||||
@ -55,15 +55,15 @@ fn connectorSketch(plane, start) {
|
|||||||
return sketch001
|
return sketch001
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn connector(plane, length) {
|
export fn connector(@plane, length) {
|
||||||
connectorSketch(plane, [-12, 8])
|
connectorSketch(plane, start = [-12, 8])
|
||||||
|> extrude(length = length)
|
|> extrude(length = length)
|
||||||
connectorSketch(plane, [16, 8])
|
connectorSketch(plane, start = [16, 8])
|
||||||
|> extrude(length = length)
|
|> extrude(length = length)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn seatSlatSketch(plane) {
|
fn seatSlatSketch(@plane) {
|
||||||
sketch003 = startSketchOn(plane)
|
sketch003 = startSketchOn(plane)
|
||||||
|> startProfile(at = [-7, 19])
|
|> startProfile(at = [-7, 19])
|
||||||
|> line(end = [-10, 0.5])
|
|> line(end = [-10, 0.5])
|
||||||
@ -77,13 +77,13 @@ fn seatSlatSketch(plane) {
|
|||||||
return sketch003
|
return sketch003
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn seatSlats(plane, length) {
|
export fn seatSlats(@plane, length) {
|
||||||
seatSlatSketch(plane)
|
seatSlatSketch(plane)
|
||||||
|> extrude(length = length)
|
|> extrude(length = length)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn backSlatsSketch(plane) {
|
fn backSlatsSketch(@plane) {
|
||||||
sketch004 = startSketchOn(plane)
|
sketch004 = startSketchOn(plane)
|
||||||
|> startProfile(at = [22, 38.5])
|
|> startProfile(at = [22, 38.5])
|
||||||
|> angledLine(angle = 173, length = 2)
|
|> angledLine(angle = 173, length = 2)
|
||||||
@ -97,13 +97,13 @@ fn backSlatsSketch(plane) {
|
|||||||
return sketch004
|
return sketch004
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn backSlats(plane, length) {
|
export fn backSlats(@plane, length) {
|
||||||
b = backSlatsSketch(plane)
|
b = backSlatsSketch(plane)
|
||||||
|> extrude(length = length)
|
|> extrude(length = length)
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
fn armRestPath(plane) {
|
fn armRestPath(@plane) {
|
||||||
sketch005 = startSketchOn(plane)
|
sketch005 = startSketchOn(plane)
|
||||||
|> startProfile(at = [20, 33])
|
|> startProfile(at = [20, 33])
|
||||||
|> xLine(length = -20)
|
|> xLine(length = -20)
|
||||||
@ -111,7 +111,7 @@ fn armRestPath(plane) {
|
|||||||
return sketch005
|
return sketch005
|
||||||
}
|
}
|
||||||
|
|
||||||
fn armRestProfile(plane, offset) {
|
fn armRestProfile(@plane, offset) {
|
||||||
sketch006 = startSketchOn(plane)
|
sketch006 = startSketchOn(plane)
|
||||||
|> startProfile(at = [offset, 32.4])
|
|> startProfile(at = [offset, 32.4])
|
||||||
|> xLine(length = 1.3)
|
|> xLine(length = 1.3)
|
||||||
@ -124,9 +124,9 @@ fn armRestProfile(plane, offset) {
|
|||||||
return sketch006
|
return sketch006
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn armRest(plane, offset) {
|
export fn armRest(@plane, offset) {
|
||||||
path = armRestPath( offsetPlane(plane, offset = offset))
|
path = armRestPath( offsetPlane(plane, offset = offset))
|
||||||
profile = armRestProfile( offsetPlane(-XZ, offset = 20), -offset)
|
profile = armRestProfile( offsetPlane(-XZ, offset = 20), offset = -offset)
|
||||||
sweep(profile, path = path)
|
sweep(profile, path = path)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -21,14 +21,14 @@ divider(offsetPlane(YZ, offset = benchLength / 2))
|
|||||||
divider(offsetPlane(YZ, offset = -benchLength / 2))
|
divider(offsetPlane(YZ, offset = -benchLength / 2))
|
||||||
|
|
||||||
// Create the connectors to join the dividers
|
// Create the connectors to join the dividers
|
||||||
connector(offsetPlane(YZ, offset = -benchLength / 2), benchLength)
|
connector(offsetPlane(YZ, offset = -benchLength / 2), length = benchLength)
|
||||||
|
|
||||||
// Create the seat slats
|
// Create the seat slats
|
||||||
seatSlats(offsetPlane(YZ, offset = -benchLength / 2 - (dividerThickness / 2)), benchLength + dividerThickness)
|
seatSlats(offsetPlane(YZ, offset = -benchLength / 2 - (dividerThickness / 2)), length = benchLength + dividerThickness)
|
||||||
|
|
||||||
// Create the back slats
|
// Create the back slats
|
||||||
backSlats(offsetPlane(YZ, offset = -benchLength / 2 - (dividerThickness / 2)), benchLength + dividerThickness)
|
backSlats(offsetPlane(YZ, offset = -benchLength / 2 - (dividerThickness / 2)), length = benchLength + dividerThickness)
|
||||||
|
|
||||||
// Create the arm rests
|
// Create the arm rests
|
||||||
armRest(YZ, benchLength / 2)
|
armRest(YZ, offset = benchLength / 2)
|
||||||
armRest(YZ, -benchLength / 2)
|
armRest(YZ, offset = -benchLength / 2)
|
||||||
|
@ -121,8 +121,8 @@ fn spoke(spokeGap, spokeAngle, spokeThickness) {
|
|||||||
return spokePattern
|
return spokePattern
|
||||||
}
|
}
|
||||||
|
|
||||||
spoke(spokeGap, spokeAngle, spokeThickness)
|
spoke(spokeGap = spokeGap, spokeAngle = spokeAngle, spokeThickness = spokeThickness)
|
||||||
spoke(-spokeGap, -spokeAngle, -spokeThickness)
|
spoke(spokeGap = -spokeGap, spokeAngle = -spokeAngle, spokeThickness = -spokeThickness)
|
||||||
|
|
||||||
// Define and revolve wheel exterior
|
// Define and revolve wheel exterior
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|
@ -31,4 +31,4 @@ fn lug(plane, length, diameter) {
|
|||||||
return lugSketch
|
return lugSketch
|
||||||
}
|
}
|
||||||
|
|
||||||
lugNut = lug(customPlane, lugLength, lugDiameter)
|
lugNut = lug(plane = customPlane, length = lugLength, diameter = lugDiameter)
|
||||||
|
@ -33,9 +33,9 @@ fn sketchRectangle(profile, color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sketch each side of the cube
|
// Sketch each side of the cube
|
||||||
sketchRectangle(bluePlane, '#0000FF')
|
sketchRectangle(profile = bluePlane, color = '#0000FF')
|
||||||
sketchRectangle(yellowPlane, '#FFFF00')
|
sketchRectangle(profile = yellowPlane, color = '#FFFF00')
|
||||||
sketchRectangle(greenPlane, '#00FF00')
|
sketchRectangle(profile = greenPlane, color = '#00FF00')
|
||||||
sketchRectangle(redPlane, '#FF0000')
|
sketchRectangle(profile = redPlane, color = '#FF0000')
|
||||||
sketchRectangle(tealPlane, '#00FFFF')
|
sketchRectangle(profile = tealPlane, color = '#00FFFF')
|
||||||
sketchRectangle(purplePlane, '#FF00FF')
|
sketchRectangle(profile = purplePlane, color = '#FF00FF')
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// Create a function for the cycloidal gear
|
// Create a function for the cycloidal gear
|
||||||
fn cycloidalGear(gearPitch, gearHeight, holeDiameter, helixAngle: number(deg)) {
|
fn cycloidalGear(gearPitch, gearHeight, holeDiameter, helixAngle: number(deg)) {
|
||||||
// Create a function to draw the gear profile as a sketch. Rotate each profile about the gear's axis by an helix angle proportional to the total gear height
|
// Create a function to draw the gear profile as a sketch. Rotate each profile about the gear's axis by an helix angle proportional to the total gear height
|
||||||
fn gearSketch(gHeight) {
|
fn gearSketch(@gHeight) {
|
||||||
helixAngleP = helixAngle * gHeight / gearHeight
|
helixAngleP = helixAngle * gHeight / gearHeight
|
||||||
gearProfile = startSketchOn(offsetPlane(XY, offset = gHeight))
|
gearProfile = startSketchOn(offsetPlane(XY, offset = gHeight))
|
||||||
|> startProfile(at = [
|
|> startProfile(at = [
|
||||||
@ -36,4 +36,9 @@ fn cycloidalGear(gearPitch, gearHeight, holeDiameter, helixAngle: number(deg)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call the cycloidal gear function
|
// Call the cycloidal gear function
|
||||||
cycloidalGear(.3, 1.5, 0.297, -80)
|
cycloidalGear(
|
||||||
|
gearPitch = .3,
|
||||||
|
gearHeight = 1.5,
|
||||||
|
holeDiameter = 0.297,
|
||||||
|
helixAngle = -80,
|
||||||
|
)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
dihedral = 116.565
|
dihedral = 116.565
|
||||||
|
|
||||||
// Create a face template function that makes a large thin cube
|
// Create a face template function that makes a large thin cube
|
||||||
fn createFaceTemplate(dither) {
|
fn createFaceTemplate(@dither) {
|
||||||
baseSketch = startSketchOn(XY)
|
baseSketch = startSketchOn(XY)
|
||||||
|> startProfile(at = [-1000 - dither, -1000 - dither])
|
|> startProfile(at = [-1000 - dither, -1000 - dither])
|
||||||
|> line(endAbsolute = [1000 + dither, -1000 - dither])
|
|> line(endAbsolute = [1000 + dither, -1000 - dither])
|
||||||
@ -62,7 +62,7 @@ dodecFaces = map(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
fn calculateArrayLength(arr) {
|
fn calculateArrayLength(@arr) {
|
||||||
return reduce(
|
return reduce(
|
||||||
arr,
|
arr,
|
||||||
initial = 0,
|
initial = 0,
|
||||||
@ -72,7 +72,7 @@ fn calculateArrayLength(arr) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn createIntersection(solids) {
|
fn createIntersection(@solids) {
|
||||||
fn reduceIntersect(previous, current) {
|
fn reduceIntersect(previous, current) {
|
||||||
return intersect([previous, current])
|
return intersect([previous, current])
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ extrude001 = extrude(sketch001, length = height)
|
|||||||
|> shell(faces = [END], thickness = wallThickness)
|
|> shell(faces = [END], thickness = wallThickness)
|
||||||
|
|
||||||
// Define a function to create the internal structure to secure a fastener at each corner
|
// Define a function to create the internal structure to secure a fastener at each corner
|
||||||
fn function001(originStart) {
|
fn function001(@originStart) {
|
||||||
// Create a plane to sketch on shell interior
|
// Create a plane to sketch on shell interior
|
||||||
plane001 = {
|
plane001 = {
|
||||||
origin = [0.0, 0.0, wallThickness],
|
origin = [0.0, 0.0, wallThickness],
|
||||||
|
@ -42,10 +42,34 @@ fn primaryTube(n, angle001, length001, length002, length003) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw a primary tube for each cylinder with specified lengths and angles
|
// Draw a primary tube for each cylinder with specified lengths and angles
|
||||||
primaryTube(0, 0, 3, 6, 5)
|
primaryTube(
|
||||||
primaryTube(1, 1, 3, 6, 5)
|
n = 0,
|
||||||
primaryTube(2, 24.3, 5, 5, 3)
|
angle001 = 0,
|
||||||
primaryTube(3, 25.2, 5, 5, 3)
|
length001 = 3,
|
||||||
|
length002 = 6,
|
||||||
|
length003 = 5,
|
||||||
|
)
|
||||||
|
primaryTube(
|
||||||
|
n = 1,
|
||||||
|
angle001 = 1,
|
||||||
|
length001 = 3,
|
||||||
|
length002 = 6,
|
||||||
|
length003 = 5,
|
||||||
|
)
|
||||||
|
primaryTube(
|
||||||
|
n = 2,
|
||||||
|
angle001 = 24.3,
|
||||||
|
length001 = 5,
|
||||||
|
length002 = 5,
|
||||||
|
length003 = 3,
|
||||||
|
)
|
||||||
|
primaryTube(
|
||||||
|
n = 3,
|
||||||
|
angle001 = 25.2,
|
||||||
|
length001 = 5,
|
||||||
|
length002 = 5,
|
||||||
|
length003 = 3,
|
||||||
|
)
|
||||||
|
|
||||||
// Create the mounting flange for the header
|
// Create the mounting flange for the header
|
||||||
flangeSketch = startSketchOn(XY)
|
flangeSketch = startSketchOn(XY)
|
||||||
|
@ -15,17 +15,6 @@ tabLength = 25
|
|||||||
tabWidth = 12
|
tabWidth = 12
|
||||||
tabThk = 4
|
tabThk = 4
|
||||||
|
|
||||||
// Define a rectangular shape func
|
|
||||||
fn rectShape(pos, w, l) {
|
|
||||||
rr = startSketchOn(XY)
|
|
||||||
|> startProfile(at = [pos[0] - (w / 2), pos[1] - (l / 2)])
|
|
||||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] - (l / 2)], tag = $edge01)
|
|
||||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] + l / 2], tag = $edge02)
|
|
||||||
|> line(endAbsolute = [pos[0] - (w / 2), pos[1] + l / 2], tag = $edge03)
|
|
||||||
|> close(tag = $edge04)
|
|
||||||
return rr
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define the bracket plane
|
// Define the bracket plane
|
||||||
bracketPlane = {
|
bracketPlane = {
|
||||||
origin = { x = 0, y = length / 2 + thk, z = 0 },
|
origin = { x = 0, y = length / 2 + thk, z = 0 },
|
||||||
@ -50,7 +39,7 @@ fn bracketSketch(w, d, t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build the body of the bracket
|
// Build the body of the bracket
|
||||||
bs = bracketSketch(width, depth, thk)
|
bs = bracketSketch(w = width, d = depth, t = thk)
|
||||||
bracketBody = bs
|
bracketBody = bs
|
||||||
|> extrude(length = length + 2 * thk)
|
|> extrude(length = length + 2 * thk)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
|
@ -55,13 +55,28 @@ flipperProfile = startProfile(flipperSketch, at = [-flipperLength, -32.0])
|
|||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
// Create a profile of the middle
|
// Create a profile of the middle
|
||||||
slotProfile000 = slot(flipperSketch, [-25, 0], [-55, 0], flipperSlotWidth)
|
slotProfile000 = slot(
|
||||||
|
sketch1 = flipperSketch,
|
||||||
|
start = [-25, 0],
|
||||||
|
end = [-55, 0],
|
||||||
|
width = flipperSlotWidth,
|
||||||
|
)
|
||||||
|
|
||||||
// Create a profile of the top slot
|
// Create a profile of the top slot
|
||||||
slotProfile001 = slot(flipperSketch, [-25, 18], [-55, 19], flipperSlotWidth)
|
slotProfile001 = slot(
|
||||||
|
sketch1 = flipperSketch,
|
||||||
|
start = [-25, 18],
|
||||||
|
end = [-55, 19],
|
||||||
|
width = flipperSlotWidth,
|
||||||
|
)
|
||||||
|
|
||||||
// Create a profile of the bottom slot
|
// Create a profile of the bottom slot
|
||||||
slotProfile002 = slot(flipperSketch, [-25, -18], [-55, -19], flipperSlotWidth)
|
slotProfile002 = slot(
|
||||||
|
sketch1 = flipperSketch,
|
||||||
|
start = [-25, -18],
|
||||||
|
end = [-55, -19],
|
||||||
|
width = flipperSlotWidth,
|
||||||
|
)
|
||||||
|
|
||||||
// Create a profile with slots for the spatula
|
// Create a profile with slots for the spatula
|
||||||
spatulaProfile = flipperProfile
|
spatulaProfile = flipperProfile
|
||||||
@ -138,7 +153,12 @@ grip = extrude(gripProfile, length = -gripLength)
|
|||||||
holeSketch = startSketchOn(grip, face = gripEdgeTop)
|
holeSketch = startSketchOn(grip, face = gripEdgeTop)
|
||||||
|
|
||||||
// Create a profile for the grip hole
|
// Create a profile for the grip hole
|
||||||
gripHoleProfile = slot(holeSketch, [0, 200], [0, 210], gripSlotWidth)
|
gripHoleProfile = slot(
|
||||||
|
sketch1 = holeSketch,
|
||||||
|
start = [0, 200],
|
||||||
|
end = [0, 210],
|
||||||
|
width = gripSlotWidth,
|
||||||
|
)
|
||||||
|
|
||||||
// Cut a hole in the grip
|
// Cut a hole in the grip
|
||||||
extrude(gripHoleProfile, length = -gripWidth - 20)
|
extrude(gripHoleProfile, length = -gripWidth - 20)
|
||||||
|
@ -22,7 +22,7 @@ countBinLength = 3
|
|||||||
height = firstStep + secondStep + thirdStep
|
height = firstStep + secondStep + thirdStep
|
||||||
|
|
||||||
// Define a function which builds the profile of the baseplate bin
|
// Define a function which builds the profile of the baseplate bin
|
||||||
fn face(plane) {
|
fn face(@plane) {
|
||||||
faceSketch = startSketchOn(plane)
|
faceSketch = startSketchOn(plane)
|
||||||
|> startProfile(at = [0, 0])
|
|> startProfile(at = [0, 0])
|
||||||
|> yLine(length = height)
|
|> yLine(length = height)
|
||||||
@ -84,7 +84,7 @@ basePlateCorners = patternLinear3d(
|
|||||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength)
|
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength)
|
||||||
|
|
||||||
// Create the center cutout for the magnet profile
|
// Create the center cutout for the magnet profile
|
||||||
fn magnetCenterCutout(plane) {
|
fn magnetCenterCutout(@plane) {
|
||||||
magnetSketch = startSketchOn(plane)
|
magnetSketch = startSketchOn(plane)
|
||||||
|> startProfile(at = [
|
|> startProfile(at = [
|
||||||
firstStep + thirdStep,
|
firstStep + thirdStep,
|
||||||
@ -111,7 +111,7 @@ fn magnetCenterCutout(plane) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the outside profile of the magnets
|
// Create the outside profile of the magnets
|
||||||
fn magnetBase(plane) {
|
fn magnetBase(@plane) {
|
||||||
magnetBaseSketch = startSketchOn(plane)
|
magnetBaseSketch = startSketchOn(plane)
|
||||||
|> startProfile(at = [0, 0])
|
|> startProfile(at = [0, 0])
|
||||||
|> xLine(length = binLength, tag = $line001)
|
|> xLine(length = binLength, tag = $line001)
|
||||||
|
@ -19,7 +19,7 @@ countBinLength = 3
|
|||||||
height = firstStep + secondStep + thirdStep
|
height = firstStep + secondStep + thirdStep
|
||||||
|
|
||||||
// Define a function which builds the profile of the baseplate bin
|
// Define a function which builds the profile of the baseplate bin
|
||||||
fn face(plane) {
|
fn face(@plane) {
|
||||||
faceSketch = startSketchOn(plane)
|
faceSketch = startSketchOn(plane)
|
||||||
|> startProfile(at = [0, 0])
|
|> startProfile(at = [0, 0])
|
||||||
|> yLine(length = height)
|
|> yLine(length = height)
|
||||||
|
@ -34,7 +34,7 @@ height = firstStep + secondStep + thirdStep
|
|||||||
lipHeight = lipStep1 + lipStep2 + lipStep3 + lipStep4 + lipStep5
|
lipHeight = lipStep1 + lipStep2 + lipStep3 + lipStep4 + lipStep5
|
||||||
|
|
||||||
// Define a function which builds the profile of the baseplate bin
|
// Define a function which builds the profile of the baseplate bin
|
||||||
fn face(plane) {
|
fn face(@plane) {
|
||||||
faceSketch = startSketchOn(plane)
|
faceSketch = startSketchOn(plane)
|
||||||
|> startProfile(at = [binBaseLength + binTol, 0])
|
|> startProfile(at = [binBaseLength + binTol, 0])
|
||||||
|> yLine(length = height)
|
|> yLine(length = height)
|
||||||
@ -174,7 +174,7 @@ binTop = startSketchOn(offsetPlane(XY, offset = height))
|
|||||||
|> shell(faces = [END], thickness = binThk)
|
|> shell(faces = [END], thickness = binThk)
|
||||||
|
|
||||||
// Define a function which builds the profile of the baseplate bin
|
// Define a function which builds the profile of the baseplate bin
|
||||||
fn lipFace(plane) {
|
fn lipFace(@plane) {
|
||||||
faceSketch = startSketchOn(plane)
|
faceSketch = startSketchOn(plane)
|
||||||
|> startProfile(at = [0, 0])
|
|> startProfile(at = [0, 0])
|
||||||
// |> yLine(length = lipHeight, tag = $line100)
|
// |> yLine(length = lipHeight, tag = $line100)
|
||||||
|
@ -27,7 +27,7 @@ countBinHeight = 2
|
|||||||
height = firstStep + secondStep + thirdStep
|
height = firstStep + secondStep + thirdStep
|
||||||
|
|
||||||
// Define a function which builds the profile of the baseplate bin
|
// Define a function which builds the profile of the baseplate bin
|
||||||
fn face(plane) {
|
fn face(@plane) {
|
||||||
faceSketch = startSketchOn(plane)
|
faceSketch = startSketchOn(plane)
|
||||||
|> startProfile(at = [binBaseLength + binTol, 0])
|
|> startProfile(at = [binBaseLength + binTol, 0])
|
||||||
|> yLine(length = height)
|
|> yLine(length = height)
|
||||||
|
@ -25,4 +25,4 @@ fn hexNut(start, thk, innerDia) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a hex nut
|
// Create a hex nut
|
||||||
hexNut([0, 0], thickness, diameter)
|
hexNut(start = [0, 0], thk = thickness, innerDia = diameter)
|
||||||
|
@ -88,37 +88,163 @@ fn keyFn(originStart, keyWidth, keyHeight, repeats, color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build the first row of keys
|
// Build the first row of keys
|
||||||
keyFn([0.3, row1], 1.1, keyHeight, 0, highlightColor2)
|
keyFn(
|
||||||
keyFn([1.5, row1], 0.8, keyHeight, 2, highlightColor1)
|
originStart = [0.3, row1],
|
||||||
keyFn([spacing * 7 + 3.5, row1], 5.2, keyHeight, 0, highlightColor2)
|
keyWidth = 1.1,
|
||||||
keyFn([spacing * 8 + 8.7, row1], 0.8, keyHeight, 0, highlightColor1)
|
keyHeight = keyHeight,
|
||||||
keyFn([spacing * 8 + 9.6, row1], 0.8, keyHeight, 0, highlightColor1)
|
repeats = 0,
|
||||||
keyFn([spacing * 10 + 10.3, row1], 1.1, keyHeight, 0, highlightColor1)
|
color = highlightColor2,
|
||||||
keyFn([spacing * 12 + 10.3 + 1, row1], 0.8, keyHeight, 0, highlightColor2)
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [1.5, row1],
|
||||||
|
keyWidth = 0.8,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 2,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 7 + 3.5, row1],
|
||||||
|
keyWidth = 5.2,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor2,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 8 + 8.7, row1],
|
||||||
|
keyWidth = 0.8,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 8 + 9.6, row1],
|
||||||
|
keyWidth = 0.8,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 10 + 10.3, row1],
|
||||||
|
keyWidth = 1.1,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 12 + 10.3 + 1, row1],
|
||||||
|
keyWidth = 0.8,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor2,
|
||||||
|
)
|
||||||
|
|
||||||
// Build the second row of keys
|
// Build the second row of keys
|
||||||
keyFn([spacing * 3, row2], 1.7, keyHeight, 0, highlightColor2)
|
keyFn(
|
||||||
keyFn([spacing * 4 + 1.7, row2], 0.8, keyHeight, 9, highlightColor1)
|
originStart = [spacing * 3, row2],
|
||||||
keyFn([spacing * 14 + 1.7 + 0.8 * 10, row2], 2.2, keyHeight, 0, highlightColor2)
|
keyWidth = 1.7,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor2,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 4 + 1.7, row2],
|
||||||
|
keyWidth = 0.8,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 9,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 14 + 1.7 + 0.8 * 10, row2],
|
||||||
|
keyWidth = 2.2,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor2,
|
||||||
|
)
|
||||||
|
|
||||||
// Build the third row of keys
|
// Build the third row of keys
|
||||||
keyFn([spacing * 3, row3], 1.1 + .1, keyHeight, 0, highlightColor1)
|
keyFn(
|
||||||
keyFn([spacing * 4 + 1.1 + .1, row3], 0.8, keyHeight, 10, highlightColor1)
|
originStart = [spacing * 3, row3],
|
||||||
keyFn([spacing * 3 + 11.1 + .1, row3], 1.4 + .4, keyHeight, 0, highlightColor2)
|
keyWidth = 1.1 + .1,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 4 + 1.1 + .1, row3],
|
||||||
|
keyWidth = 0.8,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 10,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 3 + 11.1 + .1, row3],
|
||||||
|
keyWidth = 1.4 + .4,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor2,
|
||||||
|
)
|
||||||
|
|
||||||
// Build the fourth row of keys
|
// Build the fourth row of keys
|
||||||
keyFn([spacing * 3, row4], 0.9, keyHeight, 0, highlightColor1)
|
keyFn(
|
||||||
keyFn([spacing * 4 + 0.9, row4], 0.8, keyHeight, 11, highlightColor1)
|
originStart = [spacing * 3, row4],
|
||||||
keyFn([spacing * 3 + 11.8, row4], 1.2, keyHeight, 0, highlightColor1)
|
keyWidth = 0.9,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 4 + 0.9, row4],
|
||||||
|
keyWidth = 0.8,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 11,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 3 + 11.8, row4],
|
||||||
|
keyWidth = 1.2,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
|
||||||
// Build the fifth row of keys
|
// Build the fifth row of keys
|
||||||
keyFn([spacing * 3, row5], 0.8, keyHeight, 12, highlightColor1)
|
keyFn(
|
||||||
keyFn([spacing * 3 + 11.7, row5], 1.3, keyHeight, 0, highlightColor2)
|
originStart = [spacing * 3, row5],
|
||||||
|
keyWidth = 0.8,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 12,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 3 + 11.7, row5],
|
||||||
|
keyWidth = 1.3,
|
||||||
|
keyHeight = keyHeight,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor2,
|
||||||
|
)
|
||||||
|
|
||||||
// Build the sixth row of keys
|
// Build the sixth row of keys
|
||||||
keyFn([spacing * 3, row6], 1.1, keyHeight * .6, 0, highlightColor2)
|
keyFn(
|
||||||
keyFn([spacing * 4 + 1.1, row6], 0.8, keyHeight * .6, 11, highlightColor1)
|
originStart = [spacing * 3, row6],
|
||||||
keyFn([spacing * 3 + 12, row6], 1, keyHeight * .6, 0, highlightColor2)
|
keyWidth = 1.1,
|
||||||
|
keyHeight = keyHeight * .6,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor2,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 4 + 1.1, row6],
|
||||||
|
keyWidth = 0.8,
|
||||||
|
keyHeight = keyHeight * .6,
|
||||||
|
repeats = 11,
|
||||||
|
color = highlightColor1,
|
||||||
|
)
|
||||||
|
keyFn(
|
||||||
|
originStart = [spacing * 3 + 12, row6],
|
||||||
|
keyWidth = 1,
|
||||||
|
keyHeight = keyHeight * .6,
|
||||||
|
repeats = 0,
|
||||||
|
color = highlightColor2,
|
||||||
|
)
|
||||||
|
|
||||||
// Create a plane to sketch ZOO brand letters on
|
// Create a plane to sketch ZOO brand letters on
|
||||||
plane002 = {
|
plane002 = {
|
||||||
@ -185,6 +311,6 @@ fn o(origin, scale, depth) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Place the Z logo on the Z key. Place the O logo on the O and P keys
|
// Place the Z logo on the Z key. Place the O logo on the O and P keys
|
||||||
z([2.3, 1.3], .4, 0.03)
|
z(origin = [2.3, 1.3], scale = .4, depth = 0.03)
|
||||||
o([8.71, row4 + .08], 0.4, 0.03)
|
o(origin = [8.71, row4 + .08], scale = 0.4, depth = 0.03)
|
||||||
o([8.71 + 0.9, row4 + .08], 0.4, 0.03)
|
o(origin = [8.71 + 0.9, row4 + .08], scale = 0.4, depth = 0.03)
|
||||||
|
@ -37,7 +37,15 @@ kitHeadElevation = kitBodyElevation + kitBodyHeight - kitHeadOffset - kitHeadHei
|
|||||||
|
|
||||||
kitHeadWidth = kitBodyWidth - (kitHeadOffset * 2)
|
kitHeadWidth = kitBodyWidth - (kitHeadOffset * 2)
|
||||||
kitHeadDepth = 3
|
kitHeadDepth = 3
|
||||||
kitHead = pixelBox(kitBody, END, -kitHeadWidth / 2, kitHeadElevation, kitHeadWidth, kitHeadHeight, kitHeadDepth)
|
kitHead = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = -kitHeadWidth / 2,
|
||||||
|
positionZ = kitHeadElevation,
|
||||||
|
width = kitHeadWidth,
|
||||||
|
height = kitHeadHeight,
|
||||||
|
depth = kitHeadDepth,
|
||||||
|
)
|
||||||
kitFaceElevation = kitHeadElevation + 2
|
kitFaceElevation = kitHeadElevation + 2
|
||||||
|
|
||||||
// 3. Kitty Face
|
// 3. Kitty Face
|
||||||
@ -67,17 +75,49 @@ kitFace = startSketchOn(kitHead, face = END)
|
|||||||
|
|
||||||
// 3.1.1 Kitty Left Eye
|
// 3.1.1 Kitty Left Eye
|
||||||
kitEyeDepth = 0.5
|
kitEyeDepth = 0.5
|
||||||
kitEyeHeihgt = kitFaceElevation + 7
|
kitEyeHeight = kitFaceElevation + 7
|
||||||
kitEyeOffset = 7
|
kitEyeOffset = 7
|
||||||
|
|
||||||
// 3.1.2 Kitty Right Eye
|
// 3.1.2 Kitty Right Eye
|
||||||
kitLeftEye1 = pixelBox(kitFace, START, -kitEyeOffset, kitEyeHeihgt, 1, 1, kitEyeDepth)
|
kitLeftEye1 = pixelBox(
|
||||||
|
kitExtrude = kitFace,
|
||||||
|
extrudeTag = START,
|
||||||
|
positionY = -kitEyeOffset,
|
||||||
|
positionZ = kitEyeHeight,
|
||||||
|
width = 1,
|
||||||
|
height = 1,
|
||||||
|
depth = kitEyeDepth,
|
||||||
|
)
|
||||||
|
|
||||||
// 3.2 Kitty Nose
|
// 3.2 Kitty Nose
|
||||||
kitLeftEye2 = pixelBox(kitFace, START, -kitEyeOffset + 1, kitEyeHeihgt + 1, 3, 1, kitEyeDepth)
|
kitLeftEye2 = pixelBox(
|
||||||
kitLeftEye3 = pixelBox(kitFace, START, -kitEyeOffset + 4, kitEyeHeihgt, 1, 1, kitEyeDepth)
|
kitExtrude = kitFace,
|
||||||
kitRightEye = pixelBox(kitFace, START, kitEyeOffset - 3, kitEyeHeihgt - 1, 2, 4, kitEyeDepth)
|
extrudeTag = START,
|
||||||
kitNoseElevation = kitEyeHeihgt - 5
|
positionY = -kitEyeOffset + 1,
|
||||||
|
positionZ = kitEyeHeight + 1,
|
||||||
|
width = 3,
|
||||||
|
height = 1,
|
||||||
|
depth = kitEyeDepth,
|
||||||
|
)
|
||||||
|
kitLeftEye3 = pixelBox(
|
||||||
|
kitExtrude = kitFace,
|
||||||
|
extrudeTag = START,
|
||||||
|
positionY = -kitEyeOffset + 4,
|
||||||
|
positionZ = kitEyeHeight,
|
||||||
|
width = 1,
|
||||||
|
height = 1,
|
||||||
|
depth = kitEyeDepth,
|
||||||
|
)
|
||||||
|
kitRightEye = pixelBox(
|
||||||
|
kitExtrude = kitFace,
|
||||||
|
extrudeTag = START,
|
||||||
|
positionY = kitEyeOffset - 3,
|
||||||
|
positionZ = kitEyeHeight - 1,
|
||||||
|
width = 2,
|
||||||
|
height = 4,
|
||||||
|
depth = kitEyeDepth,
|
||||||
|
)
|
||||||
|
kitNoseElevation = kitEyeHeight - 5
|
||||||
kitNose = startSketchOn(kitFace, face = START)
|
kitNose = startSketchOn(kitFace, face = START)
|
||||||
|> startProfile(at = [-2, kitNoseElevation]) // H V
|
|> startProfile(at = [-2, kitNoseElevation]) // H V
|
||||||
|> line(end = [0, 1]) // lower-left up
|
|> line(end = [0, 1]) // lower-left up
|
||||||
@ -97,13 +137,45 @@ kitNose = startSketchOn(kitFace, face = START)
|
|||||||
|
|
||||||
// 3.3 Kitty Mouth
|
// 3.3 Kitty Mouth
|
||||||
kitMouthOffset = 4
|
kitMouthOffset = 4
|
||||||
kitMouthHeight = kitEyeHeihgt - 3
|
kitMouthHeight = kitEyeHeight - 3
|
||||||
kitMouthUpLeft = pixelBox(kitFace, START, -kitMouthOffset, kitMouthHeight, 1, 1, kitEyeDepth)
|
kitMouthUpLeft = pixelBox(
|
||||||
|
kitExtrude = kitFace,
|
||||||
|
extrudeTag = START,
|
||||||
|
positionY = -kitMouthOffset,
|
||||||
|
positionZ = kitMouthHeight,
|
||||||
|
width = 1,
|
||||||
|
height = 1,
|
||||||
|
depth = kitEyeDepth,
|
||||||
|
)
|
||||||
|
|
||||||
// 4. Kitty Belly
|
// 4. Kitty Belly
|
||||||
kitMouthDownLeft = pixelBox(kitFace, START, -kitMouthOffset + 1, kitMouthHeight - 1, 1, 1, kitEyeDepth)
|
kitMouthDownLeft = pixelBox(
|
||||||
kitMouthUpRight = pixelBox(kitFace, START, kitMouthOffset, kitMouthHeight, 1, 1, kitEyeDepth)
|
kitExtrude = kitFace,
|
||||||
kitMouthDownRight = pixelBox(kitFace, START, kitMouthOffset - 1, kitMouthHeight - 1, 1, 1, kitEyeDepth)
|
extrudeTag = START,
|
||||||
|
positionY = -kitMouthOffset + 1,
|
||||||
|
positionZ = kitMouthHeight - 1,
|
||||||
|
width = 1,
|
||||||
|
height = 1,
|
||||||
|
depth = kitEyeDepth,
|
||||||
|
)
|
||||||
|
kitMouthUpRight = pixelBox(
|
||||||
|
kitExtrude = kitFace,
|
||||||
|
extrudeTag = START,
|
||||||
|
positionY = kitMouthOffset,
|
||||||
|
positionZ = kitMouthHeight,
|
||||||
|
width = 1,
|
||||||
|
height = 1,
|
||||||
|
depth = kitEyeDepth,
|
||||||
|
)
|
||||||
|
kitMouthDownRight = pixelBox(
|
||||||
|
kitExtrude = kitFace,
|
||||||
|
extrudeTag = START,
|
||||||
|
positionY = kitMouthOffset - 1,
|
||||||
|
positionZ = kitMouthHeight - 1,
|
||||||
|
width = 1,
|
||||||
|
height = 1,
|
||||||
|
depth = kitEyeDepth,
|
||||||
|
)
|
||||||
kitBellyElevation = kitBodyElevation + 1
|
kitBellyElevation = kitBodyElevation + 1
|
||||||
|
|
||||||
kitBellyHeight = kitHeadElevation - kitBellyElevation - 1
|
kitBellyHeight = kitHeadElevation - kitBellyElevation - 1
|
||||||
@ -111,7 +183,15 @@ kitBellyHeight = kitHeadElevation - kitBellyElevation - 1
|
|||||||
// 4.1 Kitty VHS
|
// 4.1 Kitty VHS
|
||||||
kitBellyWidth = kitHeadWidth
|
kitBellyWidth = kitHeadWidth
|
||||||
kitBellyDepth = kitHeadDepth
|
kitBellyDepth = kitHeadDepth
|
||||||
kitBelly = pixelBox(kitBody, END, -kitBellyWidth / 2, kitBellyElevation, kitBellyWidth, kitBellyHeight, kitBellyDepth)
|
kitBelly = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = -kitBellyWidth / 2,
|
||||||
|
positionZ = kitBellyElevation,
|
||||||
|
width = kitBellyWidth,
|
||||||
|
height = kitBellyHeight,
|
||||||
|
depth = kitBellyDepth,
|
||||||
|
)
|
||||||
kitVHSelevation = kitBellyElevation + 1
|
kitVHSelevation = kitBellyElevation + 1
|
||||||
|
|
||||||
kitVHSheight = 2
|
kitVHSheight = 2
|
||||||
@ -119,7 +199,15 @@ kitVHSheight = 2
|
|||||||
// 4.2 Kitty Floppy
|
// 4.2 Kitty Floppy
|
||||||
kitVHSwidth = 8
|
kitVHSwidth = 8
|
||||||
kitVHSdepth = 1
|
kitVHSdepth = 1
|
||||||
kitVHS = pixelBox(kitBelly, END, -kitVHSwidth / 2, kitVHSelevation, kitVHSwidth, kitVHSheight, kitVHSdepth)
|
kitVHS = pixelBox(
|
||||||
|
kitExtrude = kitBelly,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = -kitVHSwidth / 2,
|
||||||
|
positionZ = kitVHSelevation,
|
||||||
|
width = kitVHSwidth,
|
||||||
|
height = kitVHSheight,
|
||||||
|
depth = kitVHSdepth,
|
||||||
|
)
|
||||||
kitFloppyElevation = kitBellyElevation + 1
|
kitFloppyElevation = kitBellyElevation + 1
|
||||||
kitFloppyHeight = 1
|
kitFloppyHeight = 1
|
||||||
|
|
||||||
@ -128,9 +216,33 @@ kitFloppyOffset = kitBellyWidth / 2 - 1
|
|||||||
kitFloppyDepth = 2
|
kitFloppyDepth = 2
|
||||||
|
|
||||||
// 4.3 Kitty Belly Button
|
// 4.3 Kitty Belly Button
|
||||||
kitFloppy1 = pixelBox(kitBelly, END, -kitFloppyOffset, kitFloppyElevation, kitFloppyWidth, kitFloppyHeight, -kitFloppyDepth)
|
kitFloppy1 = pixelBox(
|
||||||
kitFloppy2 = pixelBox(kitBelly, END, -kitFloppyOffset, kitFloppyElevation + 2, kitFloppyWidth, kitFloppyHeight, -kitFloppyDepth)
|
kitExtrude = kitBelly,
|
||||||
kitFloppy3 = pixelBox(kitBelly, END, kitFloppyOffset, kitFloppyElevation, -kitFloppyWidth, kitFloppyHeight, -kitFloppyDepth)
|
extrudeTag = END,
|
||||||
|
positionY = -kitFloppyOffset,
|
||||||
|
positionZ = kitFloppyElevation,
|
||||||
|
width = kitFloppyWidth,
|
||||||
|
height = kitFloppyHeight,
|
||||||
|
depth = -kitFloppyDepth,
|
||||||
|
)
|
||||||
|
kitFloppy2 = pixelBox(
|
||||||
|
kitExtrude = kitBelly,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = -kitFloppyOffset,
|
||||||
|
positionZ = kitFloppyElevation + 2,
|
||||||
|
width = kitFloppyWidth,
|
||||||
|
height = kitFloppyHeight,
|
||||||
|
depth = -kitFloppyDepth,
|
||||||
|
)
|
||||||
|
kitFloppy3 = pixelBox(
|
||||||
|
kitExtrude = kitBelly,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = kitFloppyOffset,
|
||||||
|
positionZ = kitFloppyElevation,
|
||||||
|
width = -kitFloppyWidth,
|
||||||
|
height = kitFloppyHeight,
|
||||||
|
depth = -kitFloppyDepth,
|
||||||
|
)
|
||||||
kitBellyButtonOffset = kitHeadWidth / 2 - 3
|
kitBellyButtonOffset = kitHeadWidth / 2 - 3
|
||||||
kitBellyButtonElevation = kitHeadElevation - 1
|
kitBellyButtonElevation = kitHeadElevation - 1
|
||||||
|
|
||||||
@ -139,18 +251,50 @@ kitBellyButtonWidth = 2
|
|||||||
// 4.4 Kitty Buttons
|
// 4.4 Kitty Buttons
|
||||||
kitBellyButtonHeight = 1
|
kitBellyButtonHeight = 1
|
||||||
kitBellyButtonDepth = kitHeadDepth + 1
|
kitBellyButtonDepth = kitHeadDepth + 1
|
||||||
kitBellyButton = pixelBox(kitBody, END, -kitBellyButtonOffset, kitBellyButtonElevation, kitBellyButtonWidth, kitBellyButtonHeight, kitBellyButtonDepth)
|
kitBellyButton = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = -kitBellyButtonOffset,
|
||||||
|
positionZ = kitBellyButtonElevation,
|
||||||
|
width = kitBellyButtonWidth,
|
||||||
|
height = kitBellyButtonHeight,
|
||||||
|
depth = kitBellyButtonDepth,
|
||||||
|
)
|
||||||
|
|
||||||
kitButtonWidth = 1
|
kitButtonWidth = 1
|
||||||
kitButtonHeight = 2
|
kitButtonHeight = 2
|
||||||
kitButtonDepth = kitFloppyDepth
|
kitButtonDepth = kitFloppyDepth
|
||||||
kitButtonElevation = kitFloppyElevation + 2
|
kitButtonElevation = kitFloppyElevation + 2
|
||||||
|
|
||||||
kitButton1 = pixelBox(kitBelly, END, kitFloppyOffset, kitFloppyElevation + 2, -kitButtonWidth, kitButtonHeight, -kitButtonDepth)
|
kitButton1 = pixelBox(
|
||||||
|
kitExtrude = kitBelly,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = kitFloppyOffset,
|
||||||
|
positionZ = kitFloppyElevation + 2,
|
||||||
|
width = -kitButtonWidth,
|
||||||
|
height = kitButtonHeight,
|
||||||
|
depth = -kitButtonDepth,
|
||||||
|
)
|
||||||
|
|
||||||
// 5. Kitty Legs
|
// 5. Kitty Legs
|
||||||
kitButton2 = pixelBox(kitBelly, END, kitFloppyOffset - kitButtonWidth - 1, kitFloppyElevation + 2, -kitButtonWidth, kitButtonHeight, -kitButtonDepth)
|
kitButton2 = pixelBox(
|
||||||
kitButton3 = pixelBox(kitBelly, END, kitFloppyOffset - (2 * (kitButtonWidth + 1)), kitFloppyElevation + 2, -kitButtonWidth, kitButtonHeight, -kitButtonDepth)
|
kitExtrude = kitBelly,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = kitFloppyOffset - kitButtonWidth - 1,
|
||||||
|
positionZ = kitFloppyElevation + 2,
|
||||||
|
width = -kitButtonWidth,
|
||||||
|
height = kitButtonHeight,
|
||||||
|
depth = -kitButtonDepth,
|
||||||
|
)
|
||||||
|
kitButton3 = pixelBox(
|
||||||
|
kitExtrude = kitBelly,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = kitFloppyOffset - (2 * (kitButtonWidth + 1)),
|
||||||
|
positionZ = kitFloppyElevation + 2,
|
||||||
|
width = -kitButtonWidth,
|
||||||
|
height = kitButtonHeight,
|
||||||
|
depth = -kitButtonDepth,
|
||||||
|
)
|
||||||
|
|
||||||
kitShoeWidth = 7
|
kitShoeWidth = 7
|
||||||
kitShoeLength = 10
|
kitShoeLength = 10
|
||||||
@ -175,14 +319,22 @@ fn kitLeg(offsetFront, offsetSide) {
|
|||||||
kitPantsFrontWidth = kitPantsWidth
|
kitPantsFrontWidth = kitPantsWidth
|
||||||
kitPantsHeight = kitBodyElevation - kitShoeHeight
|
kitPantsHeight = kitBodyElevation - kitShoeHeight
|
||||||
|
|
||||||
kitPants = pixelBox(kitShoe, END, kitPantsOffsetSide, kitPantsOffsetFront, kitPantsFrontWidth, kitPantsWidth, kitPantsHeight)
|
kitPants = pixelBox(
|
||||||
|
kitExtrude = kitShoe,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = kitPantsOffsetSide,
|
||||||
|
positionZ = kitPantsOffsetFront,
|
||||||
|
width = kitPantsFrontWidth,
|
||||||
|
height = kitPantsWidth,
|
||||||
|
depth = kitPantsHeight,
|
||||||
|
)
|
||||||
|
|
||||||
return kitShoe
|
return kitShoe
|
||||||
}
|
}
|
||||||
kitLegOffset = 3
|
kitLegOffset = 3
|
||||||
|
|
||||||
kitRightLeg = kitLeg(0, kitLegOffset)
|
kitRightLeg = kitLeg(offsetFront = 0, offsetSide = kitLegOffset)
|
||||||
kitLeftLeg = kitLeg(0, -kitLegOffset - kitShoeWidth)
|
kitLeftLeg = kitLeg(offsetFront = 0, offsetSide = -kitLegOffset - kitShoeWidth)
|
||||||
|
|
||||||
// 6. Kitty Ears
|
// 6. Kitty Ears
|
||||||
kitEarWidth = 8
|
kitEarWidth = 8
|
||||||
@ -192,24 +344,56 @@ kitEarHeight = 2
|
|||||||
fn kitEar(earOffsetFront, earOffsetSide) {
|
fn kitEar(earOffsetFront, earOffsetSide) {
|
||||||
kitNewEarOffsetFront = kitBodyDepth - earOffsetFront
|
kitNewEarOffsetFront = kitBodyDepth - earOffsetFront
|
||||||
kitNewEarOffsetSide = -(kitBodyWidth / 2 - earOffsetSide)
|
kitNewEarOffsetSide = -(kitBodyWidth / 2 - earOffsetSide)
|
||||||
baseVolume = pixelBox(kitBody, seg01, kitNewEarOffsetSide, kitNewEarOffsetFront, kitEarWidth, -kitEarDepth, kitEarHeight)
|
baseVolume = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = seg01,
|
||||||
|
positionY = kitNewEarOffsetSide,
|
||||||
|
positionZ = kitNewEarOffsetFront,
|
||||||
|
width = kitEarWidth,
|
||||||
|
height = -kitEarDepth,
|
||||||
|
depth = kitEarHeight,
|
||||||
|
)
|
||||||
|
|
||||||
secondOffset = 1
|
secondOffset = 1
|
||||||
secondLevel = pixelBox(baseVolume, END, kitNewEarOffsetSide + secondOffset, kitNewEarOffsetFront - 0.01, kitEarWidth - (secondOffset * 2), -kitEarDepth + secondOffset * 2, kitEarHeight)
|
secondLevel = pixelBox(
|
||||||
|
kitExtrude = baseVolume,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = kitNewEarOffsetSide + secondOffset,
|
||||||
|
positionZ = kitNewEarOffsetFront - 0.01,
|
||||||
|
width = kitEarWidth - (secondOffset * 2),
|
||||||
|
height = -kitEarDepth + secondOffset * 2,
|
||||||
|
depth = kitEarHeight,
|
||||||
|
)
|
||||||
|
|
||||||
thirdOffset = 2
|
thirdOffset = 2
|
||||||
thirdLevel = pixelBox(secondLevel, END, kitNewEarOffsetSide + thirdOffset, kitNewEarOffsetFront - 0.02, kitEarWidth - (thirdOffset * 2), -kitEarDepth + thirdOffset * 2, kitEarHeight)
|
thirdLevel = pixelBox(
|
||||||
|
kitExtrude = secondLevel,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = kitNewEarOffsetSide + thirdOffset,
|
||||||
|
positionZ = kitNewEarOffsetFront - 0.02,
|
||||||
|
width = kitEarWidth - (thirdOffset * 2),
|
||||||
|
height = -kitEarDepth + thirdOffset * 2,
|
||||||
|
depth = kitEarHeight,
|
||||||
|
)
|
||||||
|
|
||||||
fourthOffset = 3
|
fourthOffset = 3
|
||||||
fourthLevel = pixelBox(thirdLevel, END, kitNewEarOffsetSide + fourthOffset, kitNewEarOffsetFront - 0.03, kitEarWidth - (fourthOffset * 2), -kitEarDepth + fourthOffset * 2, kitEarHeight)
|
fourthLevel = pixelBox(
|
||||||
|
kitExtrude = thirdLevel,
|
||||||
|
extrudeTag = END,
|
||||||
|
positionY = kitNewEarOffsetSide + fourthOffset,
|
||||||
|
positionZ = kitNewEarOffsetFront - 0.03,
|
||||||
|
width = kitEarWidth - (fourthOffset * 2),
|
||||||
|
height = -kitEarDepth + fourthOffset * 2,
|
||||||
|
depth = kitEarHeight,
|
||||||
|
)
|
||||||
|
|
||||||
return baseVolume
|
return baseVolume
|
||||||
}
|
}
|
||||||
kitEarOffsetFront = 4
|
kitEarOffsetFront = 4
|
||||||
kitEarOffsetSide = 1
|
kitEarOffsetSide = 1
|
||||||
|
|
||||||
kitRightEar = kitEar(kitEarOffsetFront, kitEarOffsetSide)
|
kitRightEar = kitEar(earOffsetFront = kitEarOffsetFront, earOffsetSide = kitEarOffsetSide)
|
||||||
kitLeftEar = kitEar(kitEarOffsetFront, kitBodyWidth - kitEarWidth - kitEarOffsetSide)
|
kitLeftEar = kitEar(earOffsetFront = kitEarOffsetFront, earOffsetSide = kitBodyWidth - kitEarWidth - kitEarOffsetSide)
|
||||||
|
|
||||||
// 7. Kitty Side
|
// 7. Kitty Side
|
||||||
// 7.1 Grill
|
// 7.1 Grill
|
||||||
@ -228,19 +412,75 @@ grillColumnE = grillColumnA - 4
|
|||||||
grillHoleSize = 1
|
grillHoleSize = 1
|
||||||
grillHoleDepth = -2
|
grillHoleDepth = -2
|
||||||
|
|
||||||
grillHoleAB = pixelBox(kitBody, seg02, grillRowA, grillColumnB, grillHoleSize, grillHoleSize, grillHoleDepth)
|
grillHoleAB = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = seg02,
|
||||||
|
positionY = grillRowA,
|
||||||
|
positionZ = grillColumnB,
|
||||||
|
width = grillHoleSize,
|
||||||
|
height = grillHoleSize,
|
||||||
|
depth = grillHoleDepth,
|
||||||
|
)
|
||||||
|
|
||||||
grillHoleAD = pixelBox(kitBody, seg02, grillRowA, grillColumnD, grillHoleSize, grillHoleSize, grillHoleDepth)
|
grillHoleAD = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = seg02,
|
||||||
|
positionY = grillRowA,
|
||||||
|
positionZ = grillColumnD,
|
||||||
|
width = grillHoleSize,
|
||||||
|
height = grillHoleSize,
|
||||||
|
depth = grillHoleDepth,
|
||||||
|
)
|
||||||
|
|
||||||
grillHoleBA = pixelBox(kitBody, seg02, grillRowB, grillColumnA, grillHoleSize, grillHoleSize, grillHoleDepth)
|
grillHoleBA = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = seg02,
|
||||||
|
positionY = grillRowB,
|
||||||
|
positionZ = grillColumnA,
|
||||||
|
width = grillHoleSize,
|
||||||
|
height = grillHoleSize,
|
||||||
|
depth = grillHoleDepth,
|
||||||
|
)
|
||||||
|
|
||||||
grillHoleBC = pixelBox(kitBody, seg02, grillRowB, grillColumnC, grillHoleSize, grillHoleSize, grillHoleDepth)
|
grillHoleBC = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = seg02,
|
||||||
|
positionY = grillRowB,
|
||||||
|
positionZ = grillColumnC,
|
||||||
|
width = grillHoleSize,
|
||||||
|
height = grillHoleSize,
|
||||||
|
depth = grillHoleDepth,
|
||||||
|
)
|
||||||
|
|
||||||
grillHoleBE = pixelBox(kitBody, seg02, grillRowB, grillColumnE, grillHoleSize, grillHoleSize, grillHoleDepth)
|
grillHoleBE = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = seg02,
|
||||||
|
positionY = grillRowB,
|
||||||
|
positionZ = grillColumnE,
|
||||||
|
width = grillHoleSize,
|
||||||
|
height = grillHoleSize,
|
||||||
|
depth = grillHoleDepth,
|
||||||
|
)
|
||||||
|
|
||||||
grillHoleCB = pixelBox(kitBody, seg02, grillRowC, grillColumnB, grillHoleSize, grillHoleSize, grillHoleDepth)
|
grillHoleCB = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = seg02,
|
||||||
|
positionY = grillRowC,
|
||||||
|
positionZ = grillColumnB,
|
||||||
|
width = grillHoleSize,
|
||||||
|
height = grillHoleSize,
|
||||||
|
depth = grillHoleDepth,
|
||||||
|
)
|
||||||
|
|
||||||
grillHoleCD = pixelBox(kitBody, seg02, grillRowC, grillColumnD, grillHoleSize, grillHoleSize, grillHoleDepth)
|
grillHoleCD = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = seg02,
|
||||||
|
positionY = grillRowC,
|
||||||
|
positionZ = grillColumnD,
|
||||||
|
width = grillHoleSize,
|
||||||
|
height = grillHoleSize,
|
||||||
|
depth = grillHoleDepth,
|
||||||
|
)
|
||||||
|
|
||||||
// 7.2 Kitty Vent
|
// 7.2 Kitty Vent
|
||||||
kitVentElevation = kitBodyElevation + 1
|
kitVentElevation = kitBodyElevation + 1
|
||||||
@ -249,8 +489,32 @@ kitVentHoleWidth = 1
|
|||||||
kitVentHoleHeight = 4
|
kitVentHoleHeight = 4
|
||||||
kitVentHoleDepth = grillHoleDepth
|
kitVentHoleDepth = grillHoleDepth
|
||||||
|
|
||||||
kitVentA = pixelBox(kitBody, seg02, kitVentElevation, kitVentOffset, kitVentHoleHeight, kitVentHoleWidth, kitVentHoleDepth)
|
kitVentA = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = seg02,
|
||||||
|
positionY = kitVentElevation,
|
||||||
|
positionZ = kitVentOffset,
|
||||||
|
width = kitVentHoleHeight,
|
||||||
|
height = kitVentHoleWidth,
|
||||||
|
depth = kitVentHoleDepth,
|
||||||
|
)
|
||||||
|
|
||||||
kitVentB = pixelBox(kitBody, seg02, kitVentElevation, kitVentOffset + 2, kitVentHoleHeight, kitVentHoleWidth, kitVentHoleDepth)
|
kitVentB = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = seg02,
|
||||||
|
positionY = kitVentElevation,
|
||||||
|
positionZ = kitVentOffset + 2,
|
||||||
|
width = kitVentHoleHeight,
|
||||||
|
height = kitVentHoleWidth,
|
||||||
|
depth = kitVentHoleDepth,
|
||||||
|
)
|
||||||
|
|
||||||
kitVentC = pixelBox(kitBody, seg02, kitVentElevation, kitVentOffset + 4, kitVentHoleHeight, kitVentHoleWidth, kitVentHoleDepth)
|
kitVentC = pixelBox(
|
||||||
|
kitExtrude = kitBody,
|
||||||
|
extrudeTag = seg02,
|
||||||
|
positionY = kitVentElevation,
|
||||||
|
positionZ = kitVentOffset + 4,
|
||||||
|
width = kitVentHoleHeight,
|
||||||
|
height = kitVentHoleWidth,
|
||||||
|
depth = kitVentHoleDepth,
|
||||||
|
)
|
||||||
|
@ -29,15 +29,15 @@ fn hingeFn(x, y, z) {
|
|||||||
return hingeBody
|
return hingeBody
|
||||||
}
|
}
|
||||||
|
|
||||||
hingePartA1 = hingeFn(0, 0, 0)
|
hingePartA1 = hingeFn(x = 0, y = 0, z = 0)
|
||||||
hingePartA2 = hingeFn(0, 0, hingeHeight + hingeGap)
|
hingePartA2 = hingeFn(x = 0, y = 0, z = hingeHeight + hingeGap)
|
||||||
hingePartA3 = hingeFn(0, 0, hingeHeight * 2 + hingeGap * 2)
|
hingePartA3 = hingeFn(x = 0, y = 0, z = hingeHeight * 2 + hingeGap * 2)
|
||||||
|
|
||||||
hingePartB2 = hingeFn(armLength, 0, hingeHeight + hingeGap)
|
hingePartB2 = hingeFn(x = armLength, y = 0, z = hingeHeight + hingeGap)
|
||||||
hingePartB3 = hingeFn(armLength, 0, hingeHeight * 2 + hingeGap * 2)
|
hingePartB3 = hingeFn(x = armLength, y = 0, z = hingeHeight * 2 + hingeGap * 2)
|
||||||
|
|
||||||
hingePartC2 = hingeFn(armLength, -armLength, hingeHeight * 2 + hingeGap * 2)
|
hingePartC2 = hingeFn(x = armLength, y = -armLength, z = hingeHeight * 2 + hingeGap * 2)
|
||||||
hingePartC3 = hingeFn(armLength, -armLength, hingeHeight * 3 + hingeGap * 3)
|
hingePartC3 = hingeFn(x = armLength, y = -armLength, z = hingeHeight * 3 + hingeGap * 3)
|
||||||
|
|
||||||
// Add a function to create the arm
|
// Add a function to create the arm
|
||||||
fn armFn(plane, offset, altitude) {
|
fn armFn(plane, offset, altitude) {
|
||||||
@ -47,8 +47,8 @@ fn armFn(plane, offset, altitude) {
|
|||||||
return armBody
|
return armBody
|
||||||
}
|
}
|
||||||
|
|
||||||
armPartA = armFn(YZ, 0, hingeHeight * 1.5 + hingeGap)
|
armPartA = armFn(plane = YZ, offset = 0, altitude = hingeHeight * 1.5 + hingeGap)
|
||||||
armPartB = armFn(XZ, armLength, hingeHeight * 2.5 + hingeGap * 2)
|
armPartB = armFn(plane = XZ, offset = armLength, altitude = hingeHeight * 2.5 + hingeGap * 2)
|
||||||
|
|
||||||
// Add a function to create the mirror
|
// Add a function to create the mirror
|
||||||
fn mirrorFn(plane, offsetX, offsetY, altitude, radius, tiefe, gestellR, gestellD) {
|
fn mirrorFn(plane, offsetX, offsetY, altitude, radius, tiefe, gestellR, gestellD) {
|
||||||
@ -72,4 +72,13 @@ fn mirrorFn(plane, offsetX, offsetY, altitude, radius, tiefe, gestellR, gestellD
|
|||||||
return armBody
|
return armBody
|
||||||
}
|
}
|
||||||
|
|
||||||
mirror = mirrorFn(XZ, armLength, armLength, hingeHeight * 4 + hingeGap * 3 + mirrorRadius + archToMirrorGap + archThickness, mirrorRadius, mirrorThickness, archRadius, archThickness)
|
mirror = mirrorFn(
|
||||||
|
plane = XZ,
|
||||||
|
offsetX = armLength,
|
||||||
|
offsetY = armLength,
|
||||||
|
altitude = hingeHeight * 4 + hingeGap * 3 + mirrorRadius + archToMirrorGap + archThickness,
|
||||||
|
radius = mirrorRadius,
|
||||||
|
tiefe = mirrorThickness,
|
||||||
|
gestellR = archRadius,
|
||||||
|
gestellD = archThickness,
|
||||||
|
)
|
||||||
|
@ -27,7 +27,7 @@ holeRadius = .25
|
|||||||
holeIndex = .75
|
holeIndex = .75
|
||||||
|
|
||||||
// Create the mounting plate extrusion, holes, and fillets
|
// Create the mounting plate extrusion, holes, and fillets
|
||||||
rs = rectShape([0, 0], plateWidth, plateLength)
|
rs = rectShape(pos = [0, 0], w = plateWidth, l = plateLength)
|
||||||
part = rs
|
part = rs
|
||||||
|> subtract2d(tool = circle(
|
|> subtract2d(tool = circle(
|
||||||
center = [
|
center = [
|
||||||
|
@ -62,10 +62,10 @@ case = startSketchOn(XZ)
|
|||||||
|> subtract2d(tool = squareHolePatternSketch)
|
|> subtract2d(tool = squareHolePatternSketch)
|
||||||
|
|
||||||
// Create the Zoo logo
|
// Create the Zoo logo
|
||||||
|> subtract2d(tool = zLogo(startSketchOn(XZ), [-.30, -1.825], .20))
|
|> subtract2d(tool = zLogo(surface = startSketchOn(XZ), origin = [-.30, -1.825], scale = .20))
|
||||||
|> subtract2d(tool = oLogo(startSketchOn(XZ), [-.075, -1.825], .20))
|
|> subtract2d(tool = oLogo(surface = startSketchOn(XZ), origin = [-.075, -1.825], scale = .20))
|
||||||
|> subtract2d(tool = oLogo2(startSketchOn(XZ), [-.075, -1.825], .20))
|
|> subtract2d(tool = oLogo2(surface = startSketchOn(XZ), origin = [-.075, -1.825], scale = .20))
|
||||||
|> subtract2d(tool = oLogo(startSketchOn(XZ), [.175, -1.825], .20))
|
|> subtract2d(tool = oLogo(surface = startSketchOn(XZ), origin = [.175, -1.825], scale = .20))
|
||||||
|> subtract2d(tool = oLogo2(startSketchOn(XZ), [.175, -1.825], .20))
|
|> subtract2d(tool = oLogo2(surface = startSketchOn(XZ), origin = [.175, -1.825], scale = .20))
|
||||||
extrude(case, length = -0.0625)
|
extrude(case, length = -0.0625)
|
||||||
|> appearance(color = '#D0FF01', metalness = 0, roughness = 50)
|
|> appearance(color = '#D0FF01', metalness = 0, roughness = 50)
|
||||||
|
@ -17,4 +17,4 @@ fn cube(length, center) {
|
|||||||
|> extrude(length = length)
|
|> extrude(length = length)
|
||||||
}
|
}
|
||||||
|
|
||||||
myCube = cube(40, [0,0])
|
myCube = cube(length=40, center=[0,0])
|
||||||
|
@ -48,7 +48,7 @@ fn bracketSketch(w, d, t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// build the body of the bracket
|
// build the body of the bracket
|
||||||
bs = bracketSketch(width, depth, thk)
|
bs = bracketSketch(w = width, d = depth, t = thk)
|
||||||
bracketBody = bs
|
bracketBody = bs
|
||||||
|> fillet(
|
|> fillet(
|
||||||
radius = radius,
|
radius = radius,
|
||||||
|
@ -40,9 +40,9 @@ miniHdmiHole = startSketchOn(XY)
|
|||||||
|
|
||||||
case = startSketchOn(XY)
|
case = startSketchOn(XY)
|
||||||
|> startProfile(at = [0, 0])
|
|> startProfile(at = [0, 0])
|
||||||
|> line(endAbsolute = [caseWidth, 0], $edge1)
|
|> line(endAbsolute = [caseWidth, 0], tag = $edge1)
|
||||||
|> line(endAbsolute = [caseWidth, caseLength], $edge2)
|
|> line(endAbsolute = [caseWidth, caseLength], tag = $edge2)
|
||||||
|> line(endAbsolute = [0, caseLength], $edge3)
|
|> line(endAbsolute = [0, caseLength], tag = $edge3)
|
||||||
|> close(tag = $edge4)
|
|> close(tag = $edge4)
|
||||||
|> extrude(length = caseHeight)
|
|> extrude(length = caseHeight)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
@ -65,15 +65,15 @@ fn m25Screw(x, y, height) {
|
|||||||
return screw
|
return screw
|
||||||
}
|
}
|
||||||
|
|
||||||
m25Screw(border + rpizWidth / 2 - (widthBetweenScrews / 2), 0 + border + rpizLength / 2 - (lengthBetweenScrews / 2), screwHeight)
|
m25Screw(x = border + rpizWidth / 2 - (widthBetweenScrews / 2), y = 0 + border + rpizLength / 2 - (lengthBetweenScrews / 2), height = screwHeight)
|
||||||
|
|
||||||
m25Screw(border + rpizWidth / 2 - (widthBetweenScrews / 2), 0 + border + rpizLength / 2 + lengthBetweenScrews / 2, screwHeight)
|
m25Screw(x = border + rpizWidth / 2 - (widthBetweenScrews / 2), y = 0 + border + rpizLength / 2 + lengthBetweenScrews / 2, height = screwHeight)
|
||||||
|
|
||||||
m25Screw(border + rpizWidth / 2 + widthBetweenScrews / 2, 0 + border + rpizLength / 2 + lengthBetweenScrews / 2, screwHeight)
|
m25Screw(x = border + rpizWidth / 2 + widthBetweenScrews / 2, y = 0 + border + rpizLength / 2 + lengthBetweenScrews / 2, height = screwHeight)
|
||||||
|
|
||||||
m25Screw(border + rpizWidth / 2 + widthBetweenScrews / 2, 0 + border + rpizLength / 2 - (lengthBetweenScrews / 2), screwHeight)
|
m25Screw(x = border + rpizWidth / 2 + widthBetweenScrews / 2, y = 0 + border + rpizLength / 2 - (lengthBetweenScrews / 2), height = screwHeight)
|
||||||
|
|
||||||
shell(
|
shell(
|
||||||
faces = ['end'],
|
faces = [END],
|
||||||
thickness = caseThickness
|
thickness = caseThickness
|
||||||
)
|
)
|
||||||
|
@ -48,7 +48,7 @@ fn bracketSketch(w, d, t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// build the body of the bracket
|
// build the body of the bracket
|
||||||
bs = bracketSketch(width, depth, thk)
|
bs = bracketSketch(w = width, d = depth, t = thk)
|
||||||
bracketBody = bs
|
bracketBody = bs
|
||||||
|> extrude(length = length + 2 * thk)
|
|> extrude(length = length + 2 * thk)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
|
@ -10,4 +10,4 @@ fn box(h, l, w) {
|
|||||||
return myBox
|
return myBox
|
||||||
}
|
}
|
||||||
|
|
||||||
fnBox = box(3, 6, 10)
|
fnBox = box(h = 3, l = 6, w = 10)
|
||||||
|
@ -10,4 +10,4 @@ fn box(p, h, l, w) {
|
|||||||
return myBox
|
return myBox
|
||||||
}
|
}
|
||||||
|
|
||||||
thing = box([0,0], 3, 6, 10)
|
thing = box(p = [0,0], h = 3, l = 6, w = 10)
|
||||||
|
@ -48,7 +48,7 @@ fn bracketSketch(w, d, t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// build the body of the bracket
|
// build the body of the bracket
|
||||||
bs = bracketSketch(width, depth, thk)
|
bs = bracketSketch(w = width, d = depth, t = thk)
|
||||||
bracketBody = bs
|
bracketBody = bs
|
||||||
|> extrude(length = length + 2 * thk)
|
|> extrude(length = length + 2 * thk)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
|
|
||||||
// Comparators
|
// Comparators
|
||||||
|
|
||||||
fn cond(bools) {
|
fn cond(@bools) {
|
||||||
return fn(a, b) {
|
return fn(a, b) {
|
||||||
x = min([max([-1, a-b]), 1]) + 1
|
x = min([max([-1, a-b]), 1]) + 1
|
||||||
return bools[x]
|
return bools[x]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Not(b) { return if b { false } else { true } }
|
fn Not(@b) { return if b { false } else { true } }
|
||||||
fn And(a, b) { return if a { if b { true } else { false } } else { false }}
|
fn And(a, b) { return if a { if b { true } else { false } } else { false }}
|
||||||
fn Or(a, b) { return if a { true } else { if b { true } else { false }}}
|
fn Or(a, b) { return if a { true } else { if b { true } else { false }}}
|
||||||
|
|
||||||
@ -18,14 +18,14 @@ Eq = cond([false, true, false])
|
|||||||
Lt = cond([true, false, false])
|
Lt = cond([true, false, false])
|
||||||
Gt = cond([false, false, true])
|
Gt = cond([false, false, true])
|
||||||
|
|
||||||
fn Lte(a, b) { return Not(Gt(a, b)) }
|
fn Lte(a, b) { return Not(Gt(a = a, b = b)) }
|
||||||
fn Gte(a, b) { return Not(Lt(a, b)) }
|
fn Gte(a, b) { return Not(Lt(a = a, b = b)) }
|
||||||
|
|
||||||
// L-system
|
// L-system
|
||||||
// Note: it was most concise to encode productions directly in axioms.
|
// Note: it was most concise to encode productions directly in axioms.
|
||||||
// Change them as you need.
|
// Change them as you need.
|
||||||
|
|
||||||
fn setSketch(state, q) {
|
fn setSketch(@state, q) {
|
||||||
return {
|
return {
|
||||||
depthMax = state.depthMax,
|
depthMax = state.depthMax,
|
||||||
depth = state.depth + 1,
|
depth = state.depth + 1,
|
||||||
@ -37,7 +37,7 @@ fn setSketch(state, q) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setDepth(state, q) {
|
fn setDepth(@state, q) {
|
||||||
return {
|
return {
|
||||||
depthMax = state.depthMax,
|
depthMax = state.depthMax,
|
||||||
depth = q,
|
depth = q,
|
||||||
@ -49,7 +49,7 @@ fn setDepth(state, q) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setAngle(state, q) {
|
fn setAngle(@state, q) {
|
||||||
return {
|
return {
|
||||||
depthMax = state.depthMax,
|
depthMax = state.depthMax,
|
||||||
depth = state.depth,
|
depth = state.depth,
|
||||||
@ -61,7 +61,7 @@ fn setAngle(state, q) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setLength(state, q) {
|
fn setLength(@state, q) {
|
||||||
return {
|
return {
|
||||||
depthMax = state.depthMax,
|
depthMax = state.depthMax,
|
||||||
depth = state.depth,
|
depth = state.depth,
|
||||||
@ -73,31 +73,31 @@ fn setLength(state, q) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Gt2(state) { return setLength(state, state.currentLength * state.factor) }
|
fn Gt2(@state) { return setLength(state, q = state.currentLength * state.factor) }
|
||||||
fn Lt2(state) { return setLength(state, state.currentLength / state.factor) }
|
fn Lt2(@state) { return setLength(state, q = state.currentLength / state.factor) }
|
||||||
fn Add(state) { return setAngle(state, rem(state.currentAngle - state.angle, divisor = 360)) }
|
fn Add(@state) { return setAngle(state, q = rem(state.currentAngle - state.angle, divisor = 360)) }
|
||||||
fn Sub(state) { return setAngle(state, rem(state.currentAngle + state.angle, divisor = 360)) }
|
fn Sub(@state) { return setAngle(state, q = rem(state.currentAngle + state.angle, divisor = 360)) }
|
||||||
|
|
||||||
// Only necessary to get around recursion limitations...
|
// Only necessary to get around recursion limitations...
|
||||||
fn F(state, F) {
|
fn F(@state, F) {
|
||||||
return if Lt(state.depth, state.depthMax) {
|
return if Lt(a = state.depth, b = state.depthMax) {
|
||||||
stateNext = state |> setDepth(%, state.depth + 1)
|
stateNext = state |> setDepth(%, q = state.depth + 1)
|
||||||
|
|
||||||
// Produce
|
// Produce
|
||||||
// Note:if you need [ and ], just save state to a variable.
|
// Note:if you need [ and ], just save state to a variable.
|
||||||
stateNext
|
stateNext
|
||||||
|> F(%, F) |> Sub(%) |> F(%, F)
|
|> F(%, F = F) |> Sub(%) |> F(%, F = F)
|
||||||
|> Add(%) |> Add(%)
|
|> Add(%) |> Add(%)
|
||||||
|> F(%, F) |> Sub(%) |> F(%, F)
|
|> F(%, F = F) |> Sub(%) |> F(%, F = F)
|
||||||
|> setDepth(%, stateNext.depth - 1)
|
|> setDepth(%, q = stateNext.depth - 1)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Pass onto the next instruction
|
// Pass onto the next instruction
|
||||||
state |> setSketch(%, angledLine(state.q, angle = state.currentAngle, length = state.currentLength))
|
state |> setSketch(%, q = angledLine(state.q, angle = state.currentAngle, length = state.currentLength))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn LSystem(args, axioms) {
|
fn LSystem(@args, axioms) {
|
||||||
myThing = startSketchOn(XY)
|
myThing = startSketchOn(XY)
|
||||||
|> startProfile(at = [0, 0])
|
|> startProfile(at = [0, 0])
|
||||||
return axioms({
|
return axioms({
|
||||||
@ -115,7 +115,8 @@ LSystem({
|
|||||||
iterations = 1,
|
iterations = 1,
|
||||||
factor = 1.36,
|
factor = 1.36,
|
||||||
angle = 60,
|
angle = 60,
|
||||||
}, fn(q) {
|
}, axioms = fn(@q) {
|
||||||
result = q |> F(%, F) |> Add(%) |> Add(%) |> F(%, F) |> Add(%) |> Add(%) |> F(%, F)
|
result = q |> F(%, F = F) |> Add(%) |> Add(%) |> F(%, F = F) |> Add(%) |> Add(%) |> F(%, F = F)
|
||||||
return result.q
|
return result.q
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ fn square(pos, scale) {
|
|||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
|
|
||||||
sq = square([0,0], 10)
|
sq = square(pos = [0,0], scale = 10)
|
||||||
cb = square([3,3], 4)
|
cb = square(pos = [3,3], scale = 4)
|
||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
|
|
||||||
// pt1 = sq.paths[0]
|
// pt1 = sq.paths[0]
|
||||||
|
@ -13,7 +13,7 @@ fn box(sk1, sk2, scale) {
|
|||||||
return boxSketch
|
return boxSketch
|
||||||
}
|
}
|
||||||
|
|
||||||
box(0, 0, 5)
|
box(sk1 = 0, sk2 = 0, scale = 5)
|
||||||
box(10, 23, 8)
|
box(sk1 = 10, sk2 = 23, scale = 8)
|
||||||
thing = box(-12, -15, 10)
|
thing = box(sk1 = -12, sk2 = -15, scale = 10)
|
||||||
box(-20, -5, 10)
|
box(sk1 = -20, sk2 = -5, scale = 10)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
export fn identity(x) {
|
export fn identity(@x) {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
export fn increment(x) {
|
export fn increment(@x) {
|
||||||
return x + 1
|
return x + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn decrement(x) {
|
export fn decrement(@x) {
|
||||||
return x - 1
|
return x - 1
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Make sure pipe value doesn't leak into the function call.
|
// Make sure pipe value doesn't leak into the function call.
|
||||||
fn f(ignored) {
|
fn f(@ignored) {
|
||||||
return %
|
return %
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ h = 10 // layer height
|
|||||||
t = 0.005 // taper factor [0-1)
|
t = 0.005 // taper factor [0-1)
|
||||||
// Defines how to modify each layer of the vase.
|
// Defines how to modify each layer of the vase.
|
||||||
// Each replica is shifted up the Z axis, and has a smoothly-varying radius
|
// Each replica is shifted up the Z axis, and has a smoothly-varying radius
|
||||||
fn transform(replicaId) {
|
fn transform(@replicaId) {
|
||||||
scale = r * abs(1 - (t * replicaId)) * (5 + cos((replicaId / 8): number(rad)))
|
scale = r * abs(1 - (t * replicaId)) * (5 + cos((replicaId / 8): number(rad)))
|
||||||
return {
|
return {
|
||||||
translate = [0, 0, replicaId * 10],
|
translate = [0, 0, replicaId * 10],
|
||||||
|
@ -10,7 +10,7 @@ p = startSketchOn(XY)
|
|||||||
|> angledLine(angle = 300, length = triangleLen, tag = $c)
|
|> angledLine(angle = 300, length = triangleLen, tag = $c)
|
||||||
|> extrude(length = triangleHeight)
|
|> extrude(length = triangleHeight)
|
||||||
|
|
||||||
fn circl(x, face) {
|
fn circl(@x, face) {
|
||||||
return startSketchOn(p, face = face)
|
return startSketchOn(p, face = face)
|
||||||
|> startProfile(at = [x + radius, triangleHeight/2])
|
|> startProfile(at = [x + radius, triangleHeight/2])
|
||||||
|> arc(
|
|> arc(
|
||||||
@ -22,7 +22,7 @@ return startSketchOn(p, face = face)
|
|||||||
|> close()
|
|> close()
|
||||||
}
|
}
|
||||||
|
|
||||||
c1 = circl(-200,c)
|
c1 = circl(-200, face = c)
|
||||||
plumbus1 =
|
plumbus1 =
|
||||||
c1
|
c1
|
||||||
|> extrude(length = plumbusLen)
|
|> extrude(length = plumbusLen)
|
||||||
@ -30,7 +30,7 @@ plumbus1 =
|
|||||||
radius = 5,
|
radius = 5,
|
||||||
tags = [c1.tags.arc_tag, getOppositeEdge(c1.tags.arc_tag)]
|
tags = [c1.tags.arc_tag, getOppositeEdge(c1.tags.arc_tag)]
|
||||||
)
|
)
|
||||||
c2 = circl(200, a)
|
c2 = circl(200, face = a)
|
||||||
plumbus0 =
|
plumbus0 =
|
||||||
c2
|
c2
|
||||||
|> extrude(length = plumbusLen)
|
|> extrude(length = plumbusLen)
|
||||||
|
@ -17,7 +17,7 @@ fn cube(length, center) {
|
|||||||
|> extrude(length = length)
|
|> extrude(length = length)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn double(x) { return x * 2}
|
fn double(@x) { return x * 2}
|
||||||
fn width() { return 200 }
|
fn width() { return 200 }
|
||||||
|
|
||||||
myCube = cube(200 |> double(%), [0,0])
|
myCube = cube(length = 200 |> double(), center = [0,0])
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
ANSWER = 41803
|
ANSWER = 41803
|
||||||
|
|
||||||
fn t(s) {
|
fn t(@s) {
|
||||||
return (ANSWER * s + 12345) % 214748
|
return (ANSWER * s + 12345) % 214748
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
fn rect(origin) {
|
fn rect(@origin) {
|
||||||
return startSketchOn(XZ)
|
return startSketchOn(XZ)
|
||||||
|> startProfile(at = origin)
|
|> startProfile(at = origin)
|
||||||
|> angledLine(
|
|> angledLine(
|
||||||
|
@ -9,7 +9,7 @@ serverDepth = 31
|
|||||||
width = 21.53
|
width = 21.53
|
||||||
|
|
||||||
// simple caster model at each corner
|
// simple caster model at each corner
|
||||||
fn caster(originStart) {
|
fn caster(@originStart) {
|
||||||
plane001c = {
|
plane001c = {
|
||||||
origin = [
|
origin = [
|
||||||
-(3.543 - 2.756) / 2 + originStart[0],
|
-(3.543 - 2.756) / 2 + originStart[0],
|
||||||
@ -1330,7 +1330,7 @@ extrude012rl = extrude(sketch012rl, length = -thickness)
|
|||||||
|
|
||||||
// GENERATE SERVER MODELS
|
// GENERATE SERVER MODELS
|
||||||
// Define planes so the server can be moved
|
// Define planes so the server can be moved
|
||||||
fn streamServer(serverPos) {
|
fn streamServer(@serverPos) {
|
||||||
planeXYs = {
|
planeXYs = {
|
||||||
origin = [0, 0 + 2, 4.114 + 1 + serverPos * 1.75],
|
origin = [0, 0 + 2, 4.114 + 1 + serverPos * 1.75],
|
||||||
xAxis = [1.0, 0.0, 0.0],
|
xAxis = [1.0, 0.0, 0.0],
|
||||||
|
@ -7,7 +7,7 @@ serverDepth = 31
|
|||||||
width = 21.53
|
width = 21.53
|
||||||
|
|
||||||
// simple caster model at each corner
|
// simple caster model at each corner
|
||||||
fn caster(originStart) {
|
fn caster(@originStart) {
|
||||||
plane001c = {
|
plane001c = {
|
||||||
origin = [
|
origin = [
|
||||||
-(3.543 - 2.756) / 2 + originStart[0],
|
-(3.543 - 2.756) / 2 + originStart[0],
|
||||||
@ -967,7 +967,7 @@ sketch012rl = startSketchOn(extrude001rl, face = 'START')
|
|||||||
extrude012rl = extrude(sketch012rl, length = -thickness)
|
extrude012rl = extrude(sketch012rl, length = -thickness)
|
||||||
|
|
||||||
// Define planes so the server can be moved
|
// Define planes so the server can be moved
|
||||||
fn streamServer(serverPos) {
|
fn streamServer(@serverPos) {
|
||||||
planeXYs = {
|
planeXYs = {
|
||||||
origin = [0, 0 + 2, 4.114 + 1 + serverPos * 1.75],
|
origin = [0, 0 + 2, 4.114 + 1 + serverPos * 1.75],
|
||||||
xAxis = [1.0, 0.0, 0.0],
|
xAxis = [1.0, 0.0, 0.0],
|
||||||
|
@ -7,10 +7,10 @@ fn cube(pos, scale) {
|
|||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
part001 = cube([0,0], 20)
|
part001 = cube(pos = [0,0], scale = 20)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|
|
||||||
part002 = startSketchOn(part001, face = "end")
|
part002 = startSketchOn(part001, face = "end")
|
||||||
|> circle(center: [0, 0], radius: 5, tag =$myCircle)
|
|> circle(center = [0, 0], radius = 5, tag = $myCircle)
|
||||||
|> extrude(length = 5)
|
|> extrude(length = 5)
|
||||||
|
@ -7,7 +7,7 @@ fn cube(pos, scale) {
|
|||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
part001 = cube([0,0], 20)
|
part001 = cube(pos = [0,0], scale = 20)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ fn cube(pos, scale) {
|
|||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
part001 = cube([0,0], 20)
|
part001 = cube(pos = [0,0], scale = 20)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ fn cube(pos, scale) {
|
|||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
part001 = cube([0,0], 20)
|
part001 = cube(pos = [0,0], scale = 20)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|
|
||||||
|
@ -197,11 +197,11 @@ fn box(sk1, sk2, scale, plane) {
|
|||||||
return boxsketch
|
return boxsketch
|
||||||
}
|
}
|
||||||
|
|
||||||
box(0, 0, 5, XY)
|
box(sk1 = 0, sk2 = 0, scale = 5, plane = XY)
|
||||||
box(10, 23, 8, XZ)
|
box(sk1 = 10, sk2 = 23, scale = 8, plane = XZ)
|
||||||
box(30, 43, 18, -XY)
|
box(sk1 = 30, sk2 = 43, scale = 18, plane = -XY)
|
||||||
thing = box(-12, -15, 10, YZ)
|
thing = box(sk1 = -12, sk2 = -15, scale = 10, plane = YZ)
|
||||||
box(-20, -5, 10, XY)"#;
|
box(sk1 = -20, sk2 = -5, scale = 10, plane = XY)"#;
|
||||||
|
|
||||||
let result = execute_and_snapshot(code, None).await.unwrap();
|
let result = execute_and_snapshot(code, None).await.unwrap();
|
||||||
assert_out("different_planes_same_drawing", &result);
|
assert_out("different_planes_same_drawing", &result);
|
||||||
@ -295,7 +295,7 @@ async fn optional_params() {
|
|||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
|
|
||||||
thing = other_circle([2, 2], 20)
|
thing = other_circle(pos = [2, 2], radius = 20)
|
||||||
"#;
|
"#;
|
||||||
let result = execute_and_snapshot(code, None).await.unwrap();
|
let result = execute_and_snapshot(code, None).await.unwrap();
|
||||||
assert_out("optional_params", &result);
|
assert_out("optional_params", &result);
|
||||||
@ -303,7 +303,7 @@ thing = other_circle([2, 2], 20)
|
|||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn kcl_test_rounded_with_holes() {
|
async fn kcl_test_rounded_with_holes() {
|
||||||
let code = r#"fn tarc(to, sktch, tag?) {
|
let code = r#"fn tarc(@to, sktch, tag?) {
|
||||||
return tangentialArc(sktch, endAbsolute = to, tag = tag)
|
return tangentialArc(sktch, endAbsolute = to, tag = tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,13 +311,13 @@ fn roundedRectangle(pos, w, l, cornerRadius) {
|
|||||||
rr = startSketchOn(XY)
|
rr = startSketchOn(XY)
|
||||||
|> startProfile(at = [pos[0] - w/2, 0])
|
|> startProfile(at = [pos[0] - w/2, 0])
|
||||||
|> line(endAbsolute = [pos[0] - w/2, pos[1] - l/2 + cornerRadius])
|
|> line(endAbsolute = [pos[0] - w/2, pos[1] - l/2 + cornerRadius])
|
||||||
|> tarc([pos[0] - w/2 + cornerRadius, pos[1] - l/2], %, $arc0)
|
|> tarc([pos[0] - w/2 + cornerRadius, pos[1] - l/2], sktch=%, tag=$arc0)
|
||||||
|> line(endAbsolute = [pos[0] + w/2 - cornerRadius, pos[1] - l/2])
|
|> line(endAbsolute = [pos[0] + w/2 - cornerRadius, pos[1] - l/2])
|
||||||
|> tarc([pos[0] + w/2, pos[1] - l/2 + cornerRadius], %)
|
|> tarc([pos[0] + w/2, pos[1] - l/2 + cornerRadius], sktch=%)
|
||||||
|> line(endAbsolute = [pos[0] + w/2, pos[1] + l/2 - cornerRadius])
|
|> line(endAbsolute = [pos[0] + w/2, pos[1] + l/2 - cornerRadius])
|
||||||
|> tarc([pos[0] + w/2 - cornerRadius, pos[1] + l/2], %, $arc2)
|
|> tarc([pos[0] + w/2 - cornerRadius, pos[1] + l/2], sktch=%, tag=$arc2)
|
||||||
|> line(endAbsolute = [pos[0] - w/2 + cornerRadius, pos[1] + l/2])
|
|> line(endAbsolute = [pos[0] - w/2 + cornerRadius, pos[1] + l/2])
|
||||||
|> tarc([pos[0] - w/2, pos[1] + l/2 - cornerRadius], %)
|
|> tarc([pos[0] - w/2, pos[1] + l/2 - cornerRadius], sktch=%)
|
||||||
|> close()
|
|> close()
|
||||||
return rr
|
return rr
|
||||||
}
|
}
|
||||||
@ -325,11 +325,11 @@ fn roundedRectangle(pos, w, l, cornerRadius) {
|
|||||||
holeRadius = 1
|
holeRadius = 1
|
||||||
holeIndex = 6
|
holeIndex = 6
|
||||||
|
|
||||||
part = roundedRectangle([0, 0], 20, 20, 4)
|
part = roundedRectangle(pos=[0, 0], w=20, l=20, cornerRadius=4)
|
||||||
|> subtract2d(tool = circle(center = [-holeIndex, holeIndex], radius= holeRadius))
|
|> subtract2d(tool = circle(center = [-holeIndex, holeIndex], radius = holeRadius))
|
||||||
|> subtract2d(tool = circle(center = [holeIndex, holeIndex], radius= holeRadius))
|
|> subtract2d(tool = circle(center = [holeIndex, holeIndex], radius = holeRadius))
|
||||||
|> subtract2d(tool = circle(center = [-holeIndex, -holeIndex], radius= holeRadius))
|
|> subtract2d(tool = circle(center = [-holeIndex, -holeIndex], radius = holeRadius))
|
||||||
|> subtract2d(tool = circle(center = [holeIndex, -holeIndex], radius= holeRadius))
|
|> subtract2d(tool = circle(center = [holeIndex, -holeIndex], radius = holeRadius))
|
||||||
|> extrude(length = 2)
|
|> extrude(length = 2)
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
@ -581,7 +581,7 @@ async fn kcl_test_cube_mm() {
|
|||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
|
|
||||||
myCube = cube([0,0], 10)
|
myCube = cube(pos = [0,0], scale = 10)
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let result = execute_and_snapshot(code, None).await.unwrap();
|
let result = execute_and_snapshot(code, None).await.unwrap();
|
||||||
@ -603,7 +603,7 @@ fn cube(pos, scale) {
|
|||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
|
|
||||||
myCube = cube([0,0], 10)
|
myCube = cube(pos = [0,0], scale = 10)
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let result = execute_and_snapshot(code, None).await.unwrap();
|
let result = execute_and_snapshot(code, None).await.unwrap();
|
||||||
@ -625,7 +625,7 @@ fn cube(pos, scale) {
|
|||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
|
|
||||||
myCube = cube([0,0], 10)
|
myCube = cube(pos = [0,0], scale = 10)
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let result = execute_and_snapshot(code, None).await.unwrap();
|
let result = execute_and_snapshot(code, None).await.unwrap();
|
||||||
@ -647,7 +647,7 @@ fn cube(pos, scale) {
|
|||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
|
|
||||||
myCube = cube([0,0], 10)
|
myCube = cube(pos = [0,0], scale = 10)
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let result = execute_and_snapshot(code, None).await.unwrap();
|
let result = execute_and_snapshot(code, None).await.unwrap();
|
||||||
@ -669,7 +669,7 @@ fn cube(pos, scale) {
|
|||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
|
|
||||||
myCube = cube([0,0], 10)
|
myCube = cube(pos = [0,0], scale = 10)
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let result = execute_and_snapshot(code, None).await.unwrap();
|
let result = execute_and_snapshot(code, None).await.unwrap();
|
||||||
@ -691,7 +691,7 @@ fn cube(pos, scale) {
|
|||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
|
|
||||||
myCube = cube([0,0], 10)
|
myCube = cube(pos = [0,0], scale = 10)
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let result = execute_and_snapshot(code, None).await.unwrap();
|
let result = execute_and_snapshot(code, None).await.unwrap();
|
||||||
@ -709,7 +709,7 @@ async fn kcl_test_error_sketch_on_arc_face() {
|
|||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
part001 = cube([0, 0], 20)
|
part001 = cube(pos = [0, 0], scale = 20)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|
|
||||||
@ -745,7 +745,7 @@ async fn kcl_test_sketch_on_face_of_face() {
|
|||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
part001 = cube([0,0], 20)
|
part001 = cube(pos = [0,0], scale = 20)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|
|
||||||
@ -805,7 +805,7 @@ async fn kcl_test_sketch_on_face_circle() {
|
|||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
part001 = cube([0,0], 20)
|
part001 = cube(pos = [0,0], scale = 20)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|
|
||||||
@ -1151,7 +1151,7 @@ async fn kcl_test_plumbus_fillets() {
|
|||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pentagon(len) {
|
fn pentagon(@len) {
|
||||||
sg = startSketchOn(XY)
|
sg = startSketchOn(XY)
|
||||||
|> startProfile(at = [-len / 2, -len / 2])
|
|> startProfile(at = [-len / 2, -len / 2])
|
||||||
|> angledLine(angle = 0, length = len, tag = $a)
|
|> angledLine(angle = 0, length = len, tag = $a)
|
||||||
@ -1181,7 +1181,7 @@ fn pentagon(len) {
|
|||||||
p = pentagon(32)
|
p = pentagon(32)
|
||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
|
|
||||||
circle0 = make_circle(p, p.sketch.tags.a, [0, 0], 2.5)
|
circle0 = make_circle(ext=p, face=p.sketch.tags.a, pos=[0, 0], radius=2.5)
|
||||||
plumbus0 = circle0
|
plumbus0 = circle0
|
||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
@ -1189,7 +1189,7 @@ plumbus0 = circle0
|
|||||||
tags = [circle0.tags.arc1, getOppositeEdge(circle0.tags.arc1)]
|
tags = [circle0.tags.arc1, getOppositeEdge(circle0.tags.arc1)]
|
||||||
)
|
)
|
||||||
|
|
||||||
circle1 = make_circle(p, p.sketch.tags.b, [0, 0], 2.5)
|
circle1 = make_circle(ext=p, face=p.sketch.tags.b, pos=[0, 0], radius=2.5)
|
||||||
plumbus1 = circle1
|
plumbus1 = circle1
|
||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
@ -1231,7 +1231,7 @@ async fn kcl_test_member_expression_in_params() {
|
|||||||
return screw
|
return screw
|
||||||
}
|
}
|
||||||
|
|
||||||
capScrew([0, 0.5, 0], 50, 37.5, 50, 25)
|
capScrew(originStart = [0, 0.5, 0], length=50, dia=37.5, capDia=50, capHeadLength=25)
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let result = execute_and_snapshot(code, None).await.unwrap();
|
let result = execute_and_snapshot(code, None).await.unwrap();
|
||||||
@ -1327,13 +1327,13 @@ fn squareHole(l, w) {
|
|||||||
|
|
||||||
extrusion = startSketchOn(XY)
|
extrusion = startSketchOn(XY)
|
||||||
|> circle(center = [0, 0], radius= dia/2 )
|
|> circle(center = [0, 0], radius= dia/2 )
|
||||||
|> subtract2d(tool = squareHole(length, width, height))
|
|> subtract2d(tool = squareHole(l = length, w = width, h = height))
|
||||||
|> extrude(length = height)
|
|> extrude(length = height)
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let result = execute_and_snapshot(code, None).await;
|
let result = execute_and_snapshot(code, None).await;
|
||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
let expected_msg = "semantic: Expected 2 arguments, got 3";
|
let expected_msg = "semantic: `h` is not an argument of `squareHole`";
|
||||||
let err = result.unwrap_err().as_kcl_error().unwrap().get_message();
|
let err = result.unwrap_err().as_kcl_error().unwrap().get_message();
|
||||||
assert_eq!(err, expected_msg);
|
assert_eq!(err, expected_msg);
|
||||||
}
|
}
|
||||||
@ -1531,7 +1531,7 @@ async fn kcl_test_linear_pattern3d_filleted_sketch() {
|
|||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
part001 = cube([0,0], 20)
|
part001 = cube(pos = [0,0], scale = 20)
|
||||||
|> close(tag = $line1)
|
|> close(tag = $line1)
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
@ -1562,7 +1562,7 @@ async fn kcl_test_circular_pattern3d_filleted_sketch() {
|
|||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
part001 = cube([0,0], 20)
|
part001 = cube(pos = [0,0], scale = 20)
|
||||||
|> close(tag = $line1)
|
|> close(tag = $line1)
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
@ -1589,7 +1589,7 @@ async fn kcl_test_circular_pattern3d_chamfered_sketch() {
|
|||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
part001 = cube([0,0], 20)
|
part001 = cube(pos = [0,0], scale = 20)
|
||||||
|> close(tag = $line1)
|
|> close(tag = $line1)
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|> chamfer(
|
|> chamfer(
|
||||||
@ -1615,7 +1615,7 @@ async fn kcl_test_tag_chamfer_with_more_than_one_edge_should_fail() {
|
|||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
part001 = cube([0,0], 20)
|
part001 = cube(pos = [0,0], scale = 20)
|
||||||
|> close(tag = $line1)
|
|> close(tag = $line1)
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|> chamfer(
|
|> chamfer(
|
||||||
@ -1640,7 +1640,7 @@ part001 = cube([0,0], 20)
|
|||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn kcl_test_duplicate_tags_should_error() {
|
async fn kcl_test_duplicate_tags_should_error() {
|
||||||
let code = r#"fn triangle(len) {
|
let code = r#"fn triangle(@len) {
|
||||||
return startSketchOn(XY)
|
return startSketchOn(XY)
|
||||||
|> startProfile(at = [-len / 2, -len / 2])
|
|> startProfile(at = [-len / 2, -len / 2])
|
||||||
|> angledLine(angle = 0, length = len , tag = $a)
|
|> angledLine(angle = 0, length = len , tag = $a)
|
||||||
@ -1926,7 +1926,7 @@ example = extrude(exampleSketch, length = 10)
|
|||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn kcl_test_error_inside_fn_also_has_source_range_of_call_site() {
|
async fn kcl_test_error_inside_fn_also_has_source_range_of_call_site() {
|
||||||
let code = r#"fn someFunction(something) {
|
let code = r#"fn someFunction(@something) {
|
||||||
startSketchOn(something)
|
startSketchOn(something)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1937,14 +1937,14 @@ someFunction('INVALID')
|
|||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.err().unwrap().to_string(),
|
result.err().unwrap().to_string(),
|
||||||
r#"semantic: KclErrorDetails { source_ranges: [SourceRange([45, 54, 0]), SourceRange([59, 82, 0])], message: "This function expected the input argument to be Solid or Plane but it's actually of type string (text)" }"#
|
r#"semantic: KclErrorDetails { source_ranges: [SourceRange([46, 55, 0]), SourceRange([60, 83, 0])], message: "This function expected the input argument to be Solid or Plane but it's actually of type string (text)" }"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn kcl_test_error_inside_fn_also_has_source_range_of_call_site_recursive() {
|
async fn kcl_test_error_inside_fn_also_has_source_range_of_call_site_recursive() {
|
||||||
let code = r#"fn someFunction(something) {
|
let code = r#"fn someFunction(@something) {
|
||||||
fn someNestedFunction(something2) {
|
fn someNestedFunction(@something2) {
|
||||||
startSketchOn(something2)
|
startSketchOn(something2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1958,7 +1958,7 @@ someFunction('INVALID')
|
|||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.err().unwrap().to_string(),
|
result.err().unwrap().to_string(),
|
||||||
r#"semantic: KclErrorDetails { source_ranges: [SourceRange([91, 101, 0]), SourceRange([114, 143, 0]), SourceRange([147, 170, 0])], message: "This function expected the input argument to be Solid or Plane but it's actually of type string (text)" }"#
|
r#"semantic: KclErrorDetails { source_ranges: [SourceRange([93, 103, 0]), SourceRange([116, 145, 0]), SourceRange([149, 172, 0])], message: "This function expected the input argument to be Solid or Plane but it's actually of type string (text)" }"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2038,6 +2038,17 @@ async fn kcl_test_ensure_nothing_left_in_batch_multi_file() {
|
|||||||
|
|
||||||
ctx.close().await;
|
ctx.close().await;
|
||||||
}
|
}
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn kcl_test_default_param_for_unlabeled() {
|
||||||
|
let code = r#"fn myExtrude(@sk, len) {
|
||||||
|
return extrude(sk, length = len)
|
||||||
|
}
|
||||||
|
|
||||||
|
sketch001 = startSketchOn(XY)
|
||||||
|
|> circle(center = [0, 0], radius = 93.75)
|
||||||
|
|> myExtrude(len = 40)"#;
|
||||||
|
let _ = execute_and_snapshot(code, None).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn kcl_test_better_type_names() {
|
async fn kcl_test_better_type_names() {
|
||||||
|
@ -2187,7 +2187,15 @@ fn assign_args_to_params_kw(
|
|||||||
.mut_stack()
|
.mut_stack()
|
||||||
.add(param.identifier.name.clone(), arg_val, (¶m.identifier).into())?;
|
.add(param.identifier.name.clone(), arg_val, (¶m.identifier).into())?;
|
||||||
} else {
|
} else {
|
||||||
let Some(unlabeled) = args.unlabeled.take() else {
|
// TODO: Get the actual source range.
|
||||||
|
// Part of https://github.com/KittyCAD/modeling-app/issues/6613
|
||||||
|
let pipe_value_source_range = Default::default();
|
||||||
|
let default_unlabeled = exec_state
|
||||||
|
.mod_local
|
||||||
|
.pipe_value
|
||||||
|
.clone()
|
||||||
|
.map(|val| Arg::new(val, pipe_value_source_range));
|
||||||
|
let Some(unlabeled) = args.unlabeled.take().or(default_unlabeled) else {
|
||||||
let param_name = ¶m.identifier.name;
|
let param_name = ¶m.identifier.name;
|
||||||
return Err(if args.labeled.contains_key(param_name) {
|
return Err(if args.labeled.contains_key(param_name) {
|
||||||
KclError::Semantic(KclErrorDetails {
|
KclError::Semantic(KclErrorDetails {
|
||||||
|
@ -1298,16 +1298,16 @@ mod tests {
|
|||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn test_execute_fn_definitions() {
|
async fn test_execute_fn_definitions() {
|
||||||
let ast = r#"fn def(x) {
|
let ast = r#"fn def(@x) {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
fn ghi(x) {
|
fn ghi(@x) {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
fn jkl(x) {
|
fn jkl(@x) {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
fn hmm(x) {
|
fn hmm(@x) {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1408,7 +1408,7 @@ firstExtrude = startSketchOn(XY)
|
|||||||
l = 8
|
l = 8
|
||||||
h = 10
|
h = 10
|
||||||
|
|
||||||
fn thing(x) {
|
fn thing(@x) {
|
||||||
return -x
|
return -x
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1429,7 +1429,7 @@ firstExtrude = startSketchOn(XY)
|
|||||||
l = 8
|
l = 8
|
||||||
h = 10
|
h = 10
|
||||||
|
|
||||||
fn thing(x) {
|
fn thing(@x) {
|
||||||
return [0, -x]
|
return [0, -x]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1450,11 +1450,11 @@ firstExtrude = startSketchOn(XY)
|
|||||||
l = 8
|
l = 8
|
||||||
h = 10
|
h = 10
|
||||||
|
|
||||||
fn other_thing(y) {
|
fn other_thing(@y) {
|
||||||
return -y
|
return -y
|
||||||
}
|
}
|
||||||
|
|
||||||
fn thing(x) {
|
fn thing(@x) {
|
||||||
return other_thing(x)
|
return other_thing(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1483,14 +1483,14 @@ firstExtrude = startSketchOn(XY)
|
|||||||
return myBox
|
return myBox
|
||||||
}
|
}
|
||||||
|
|
||||||
fnBox = box(3, 6, 10)"#;
|
fnBox = box(h = 3, l = 6, w = 10)"#;
|
||||||
|
|
||||||
parse_execute(ast).await.unwrap();
|
parse_execute(ast).await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn test_get_member_of_object_with_function_period() {
|
async fn test_get_member_of_object_with_function_period() {
|
||||||
let ast = r#"fn box(obj) {
|
let ast = r#"fn box(@obj) {
|
||||||
myBox = startSketchOn(XY)
|
myBox = startSketchOn(XY)
|
||||||
|> startProfile(at = obj.start)
|
|> startProfile(at = obj.start)
|
||||||
|> line(end = [0, obj.l])
|
|> line(end = [0, obj.l])
|
||||||
@ -1577,7 +1577,7 @@ for var in [[3, 6, 10, [0,0]], [1.5, 3, 5, [-10,-10]]] {
|
|||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn test_get_member_of_array_with_function() {
|
async fn test_get_member_of_array_with_function() {
|
||||||
let ast = r#"fn box(arr) {
|
let ast = r#"fn box(@arr) {
|
||||||
myBox =startSketchOn(XY)
|
myBox =startSketchOn(XY)
|
||||||
|> startProfile(at = arr[0])
|
|> startProfile(at = arr[0])
|
||||||
|> line(end = [0, arr[1]])
|
|> line(end = [0, arr[1]])
|
||||||
@ -1623,7 +1623,7 @@ answer = returnX()"#;
|
|||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn type_aliases() {
|
async fn type_aliases() {
|
||||||
let text = r#"type MyTy = [number; 2]
|
let text = r#"type MyTy = [number; 2]
|
||||||
fn foo(x: MyTy) {
|
fn foo(@x: MyTy) {
|
||||||
return x[0]
|
return x[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1783,7 +1783,7 @@ fn check(x) {
|
|||||||
assertIs(!x, error = "expected argument to be false")
|
assertIs(!x, error = "expected argument to be false")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
check(false)
|
check(x = false)
|
||||||
"#;
|
"#;
|
||||||
let result = parse_execute(ast).await.unwrap();
|
let result = parse_execute(ast).await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -1961,7 +1961,7 @@ bracket = startSketchOn(XY)
|
|||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn test_execute_function_no_return() {
|
async fn test_execute_function_no_return() {
|
||||||
let ast = r#"fn test(origin) {
|
let ast = r#"fn test(@origin) {
|
||||||
origin
|
origin
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2154,7 +2154,7 @@ w = f() + f()
|
|||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn read_tag_version() {
|
async fn read_tag_version() {
|
||||||
let ast = r#"fn bar(t) {
|
let ast = r#"fn bar(@t) {
|
||||||
return startSketchOn(XY)
|
return startSketchOn(XY)
|
||||||
|> startProfile(at = [0,0])
|
|> startProfile(at = [0,0])
|
||||||
|> angledLine(
|
|> angledLine(
|
||||||
|
@ -5,7 +5,10 @@ use crate::{
|
|||||||
errors::Suggestion,
|
errors::Suggestion,
|
||||||
execution::{types::UnitLen, PlaneInfo, Point3d},
|
execution::{types::UnitLen, PlaneInfo, Point3d},
|
||||||
lint::rule::{def_finding, Discovered, Finding},
|
lint::rule::{def_finding, Discovered, Finding},
|
||||||
parsing::ast::types::{BinaryPart, Expr, LiteralValue, Node as AstNode, ObjectExpression, Program, UnaryOperator},
|
parsing::ast::types::{
|
||||||
|
BinaryPart, CallExpression, CallExpressionKw, Expr, LiteralValue, Node as AstNode, ObjectExpression, Program,
|
||||||
|
UnaryOperator,
|
||||||
|
},
|
||||||
walk::Node,
|
walk::Node,
|
||||||
SourceRange,
|
SourceRange,
|
||||||
};
|
};
|
||||||
@ -124,10 +127,16 @@ fn get_offset(info: &PlaneInfo) -> Option<f64> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn start_sketch_on_check_specific_plane(node: Node) -> Result<Option<(SourceRange, PlaneName, f64)>> {
|
pub fn start_sketch_on_check_specific_plane(node: Node) -> Result<Option<(SourceRange, PlaneName, f64)>> {
|
||||||
let Node::CallExpression(call) = node else {
|
match node {
|
||||||
return Ok(None);
|
Node::CallExpression(node) => start_sketch_on_check_specific_plane_pos(node),
|
||||||
};
|
Node::CallExpressionKw(node) => start_sketch_on_check_specific_plane_kw(node),
|
||||||
|
_ => Ok(None),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn start_sketch_on_check_specific_plane_pos(
|
||||||
|
call: &AstNode<CallExpression>,
|
||||||
|
) -> Result<Option<(SourceRange, PlaneName, f64)>> {
|
||||||
if call.inner.callee.inner.name.name != "startSketchOn" {
|
if call.inner.callee.inner.name.name != "startSketchOn" {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
@ -147,7 +156,34 @@ pub fn start_sketch_on_check_specific_plane(node: Node) -> Result<Option<(Source
|
|||||||
let Expr::ObjectExpression(arg) = &call.arguments[0] else {
|
let Expr::ObjectExpression(arg) = &call.arguments[0] else {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
|
common(arg, call_source_range)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn start_sketch_on_check_specific_plane_kw(
|
||||||
|
call: &AstNode<CallExpressionKw>,
|
||||||
|
) -> Result<Option<(SourceRange, PlaneName, f64)>> {
|
||||||
|
if call.inner.callee.inner.name.name != "startSketchOn" {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some(ref unlabeled) = call.inner.unlabeled else {
|
||||||
|
// we only look for single-argument object patterns, if there's more
|
||||||
|
// than that we don't have a plane decl
|
||||||
|
return Ok(None);
|
||||||
|
};
|
||||||
|
|
||||||
|
let call_source_range = SourceRange::new(unlabeled.start(), unlabeled.end(), unlabeled.module_id());
|
||||||
|
|
||||||
|
let Expr::ObjectExpression(arg) = &unlabeled else {
|
||||||
|
return Ok(None);
|
||||||
|
};
|
||||||
|
common(arg, call_source_range)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn common(
|
||||||
|
arg: &AstNode<ObjectExpression>,
|
||||||
|
call_source_range: SourceRange,
|
||||||
|
) -> Result<Option<(SourceRange, PlaneName, f64)>> {
|
||||||
let mut origin: Option<Point3d> = None;
|
let mut origin: Option<Point3d> = None;
|
||||||
let mut x_vec: Option<Point3d> = None;
|
let mut x_vec: Option<Point3d> = None;
|
||||||
let mut y_vec: Option<Point3d> = None;
|
let mut y_vec: Option<Point3d> = None;
|
||||||
|
@ -533,6 +533,23 @@ impl Backend {
|
|||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
crate::walk::Node::CallExpressionKw(call_expr) => {
|
||||||
|
let sr: SourceRange = (&call_expr.callee).into();
|
||||||
|
if sr.contains(source_range.start()) {
|
||||||
|
let mut ti = token_index.lock().map_err(|_| anyhow::anyhow!("mutex"))?;
|
||||||
|
*ti = match self.get_semantic_token_type_index(&SemanticTokenType::FUNCTION) {
|
||||||
|
Some(index) => index,
|
||||||
|
None => token_type_index,
|
||||||
|
};
|
||||||
|
|
||||||
|
if self.stdlib_completions.contains_key(&call_expr.callee.name.name) {
|
||||||
|
// This is a stdlib function.
|
||||||
|
return get_modifier(vec![SemanticTokenModifier::DEFAULT_LIBRARY]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
Ok(true)
|
Ok(true)
|
||||||
|
@ -895,7 +895,7 @@ async fn test_kcl_lsp_on_hover() {
|
|||||||
foo = 42
|
foo = 42
|
||||||
foo
|
foo
|
||||||
|
|
||||||
fn bar(x: string): string {
|
fn bar(@x: string): string {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,7 +971,7 @@ startSketchOn(XY)
|
|||||||
|
|
||||||
match hover.unwrap().contents {
|
match hover.unwrap().contents {
|
||||||
tower_lsp::lsp_types::HoverContents::Markup(tower_lsp::lsp_types::MarkupContent { value, .. }) => {
|
tower_lsp::lsp_types::HoverContents::Markup(tower_lsp::lsp_types::MarkupContent { value, .. }) => {
|
||||||
assert!(value.contains("bar(x: string): string"));
|
assert!(value.contains("bar(@x: string): string"));
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
@ -2027,7 +2027,7 @@ insideRevolve = startSketchOn(XZ)
|
|||||||
|> line(end = [0, -thickness])
|
|> line(end = [0, -thickness])
|
||||||
|> line(end = [-overHangLength, 0])
|
|> line(end = [-overHangLength, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = Y }, %)
|
|> revolve(axis = Y)
|
||||||
|
|
||||||
// Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis)
|
// Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis)
|
||||||
sphere = startSketchOn(XZ)
|
sphere = startSketchOn(XZ)
|
||||||
@ -2035,7 +2035,7 @@ sphere = startSketchOn(XZ)
|
|||||||
|> line(end = [sphereDia - 0.1, 0])
|
|> line(end = [sphereDia - 0.1, 0])
|
||||||
|> arc(angle_start = 0, angle_end = -180, radius = sphereDia / 2 - 0.05)
|
|> arc(angle_start = 0, angle_end = -180, radius = sphereDia / 2 - 0.05)
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = X }, %)
|
|> revolve(axis = X)
|
||||||
|> patternCircular3d(
|
|> patternCircular3d(
|
||||||
axis = [0, 0, 1],
|
axis = [0, 0, 1],
|
||||||
center = [0, 0, 0],
|
center = [0, 0, 0],
|
||||||
@ -2056,7 +2056,7 @@ outsideRevolve = startSketchOn(XZ)
|
|||||||
|> line(end = [0, thickness])
|
|> line(end = [0, thickness])
|
||||||
|> line(end = [overHangLength - thickness, 0])
|
|> line(end = [overHangLength - thickness, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = Y }, %)"#
|
|> revolve(axis = Y)"#
|
||||||
.to_string(),
|
.to_string(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -2090,7 +2090,7 @@ outsideRevolve = startSketchOn(XZ)
|
|||||||
start: tower_lsp::lsp_types::Position { line: 0, character: 0 },
|
start: tower_lsp::lsp_types::Position { line: 0, character: 0 },
|
||||||
end: tower_lsp::lsp_types::Position {
|
end: tower_lsp::lsp_types::Position {
|
||||||
line: 50,
|
line: 50,
|
||||||
character: 29
|
character: 22
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -2117,7 +2117,7 @@ insideRevolve = startSketchOn(XZ)
|
|||||||
|> line(end = [0, -thickness])
|
|> line(end = [0, -thickness])
|
||||||
|> line(end = [-overHangLength, 0])
|
|> line(end = [-overHangLength, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = Y }, %)
|
|> revolve(axis = Y)
|
||||||
|
|
||||||
// Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis)
|
// Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis)
|
||||||
sphere = startSketchOn(XZ)
|
sphere = startSketchOn(XZ)
|
||||||
@ -2128,7 +2128,7 @@ sphere = startSketchOn(XZ)
|
|||||||
|> line(end = [sphereDia - 0.1, 0])
|
|> line(end = [sphereDia - 0.1, 0])
|
||||||
|> arc(angle_start = 0, angle_end = -180, radius = sphereDia / 2 - 0.05)
|
|> arc(angle_start = 0, angle_end = -180, radius = sphereDia / 2 - 0.05)
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = X }, %)
|
|> revolve(axis = X)
|
||||||
|> patternCircular3d(
|
|> patternCircular3d(
|
||||||
axis = [0, 0, 1],
|
axis = [0, 0, 1],
|
||||||
center = [0, 0, 0],
|
center = [0, 0, 0],
|
||||||
@ -2152,7 +2152,7 @@ outsideRevolve = startSketchOn(XZ)
|
|||||||
|> line(end = [0, thickness])
|
|> line(end = [0, thickness])
|
||||||
|> line(end = [overHangLength - thickness, 0])
|
|> line(end = [overHangLength - thickness, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = Y }, %)"#
|
|> revolve(axis = Y)"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3891,7 +3891,7 @@ async fn test_kcl_lsp_on_hover_untitled_file_scheme() {
|
|||||||
foo = 42
|
foo = 42
|
||||||
foo
|
foo
|
||||||
|
|
||||||
fn bar(x: string): string {
|
fn bar(@x: string): string {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3967,7 +3967,7 @@ startSketchOn(XY)
|
|||||||
|
|
||||||
match hover.unwrap().contents {
|
match hover.unwrap().contents {
|
||||||
tower_lsp::lsp_types::HoverContents::Markup(tower_lsp::lsp_types::MarkupContent { value, .. }) => {
|
tower_lsp::lsp_types::HoverContents::Markup(tower_lsp::lsp_types::MarkupContent { value, .. }) => {
|
||||||
assert!(value.contains("bar(x: string): string"));
|
assert!(value.contains("bar(@x: string): string"));
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
@ -529,13 +529,13 @@ mod test {
|
|||||||
async fn test_parse_digest() {
|
async fn test_parse_digest() {
|
||||||
let prog1_string = r#"startSketchOn(XY)
|
let prog1_string = r#"startSketchOn(XY)
|
||||||
|> startProfile(at = [0, 0])
|
|> startProfile(at = [0, 0])
|
||||||
|> line([5, 5], %)
|
|> line([5, 5])
|
||||||
"#;
|
"#;
|
||||||
let prog1_digest = crate::parsing::top_level_parse(prog1_string).unwrap().compute_digest();
|
let prog1_digest = crate::parsing::top_level_parse(prog1_string).unwrap().compute_digest();
|
||||||
|
|
||||||
let prog2_string = r#"startSketchOn(XY)
|
let prog2_string = r#"startSketchOn(XY)
|
||||||
|> startProfile(at = [0, 2])
|
|> startProfile(at = [0, 2])
|
||||||
|> line([5, 5], %)
|
|> line([5, 5])
|
||||||
"#;
|
"#;
|
||||||
let prog2_digest = crate::parsing::top_level_parse(prog2_string).unwrap().compute_digest();
|
let prog2_digest = crate::parsing::top_level_parse(prog2_string).unwrap().compute_digest();
|
||||||
|
|
||||||
@ -543,7 +543,7 @@ mod test {
|
|||||||
|
|
||||||
let prog3_string = r#"startSketchOn(XY)
|
let prog3_string = r#"startSketchOn(XY)
|
||||||
|> startProfile(at = [0, 0])
|
|> startProfile(at = [0, 0])
|
||||||
|> line([5, 5], %)
|
|> line([5, 5])
|
||||||
"#;
|
"#;
|
||||||
let prog3_digest = crate::parsing::top_level_parse(prog3_string).unwrap().compute_digest();
|
let prog3_digest = crate::parsing::top_level_parse(prog3_string).unwrap().compute_digest();
|
||||||
|
|
||||||
|
@ -3739,11 +3739,11 @@ mod tests {
|
|||||||
fn test_get_lsp_folding_ranges() {
|
fn test_get_lsp_folding_ranges() {
|
||||||
let code = r#"part001 = startSketchOn(XY)
|
let code = r#"part001 = startSketchOn(XY)
|
||||||
|> startProfile(at = [0.0000000000, 5.0000000000])
|
|> startProfile(at = [0.0000000000, 5.0000000000])
|
||||||
|> line([0.4900857016, -0.0240763666], %)
|
|> line([0.4900857016, -0.0240763666])
|
||||||
|
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|> startProfile(at = [0.0000000000, 5.0000000000])
|
|> startProfile(at = [0.0000000000, 5.0000000000])
|
||||||
|> line([0.4900857016, -0.0240763666], %)
|
|> line([0.4900857016, -0.0240763666])
|
||||||
|
|
||||||
part002 = "part002"
|
part002 = "part002"
|
||||||
things = [part001, 0.0]
|
things = [part001, 0.0]
|
||||||
@ -3751,7 +3751,7 @@ blah = 1
|
|||||||
foo = false
|
foo = false
|
||||||
baz = {a = 1, b = "thing"}
|
baz = {a = 1, b = "thing"}
|
||||||
|
|
||||||
fn ghi(x) {
|
fn ghi(@x) {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3761,24 +3761,24 @@ ghi("things")
|
|||||||
let folding_ranges = program.get_lsp_folding_ranges();
|
let folding_ranges = program.get_lsp_folding_ranges();
|
||||||
assert_eq!(folding_ranges.len(), 3);
|
assert_eq!(folding_ranges.len(), 3);
|
||||||
assert_eq!(folding_ranges[0].start_line, 27);
|
assert_eq!(folding_ranges[0].start_line, 27);
|
||||||
assert_eq!(folding_ranges[0].end_line, 126);
|
assert_eq!(folding_ranges[0].end_line, 123);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
folding_ranges[0].collapsed_text,
|
folding_ranges[0].collapsed_text,
|
||||||
Some("part001 = startSketchOn(XY)".to_string())
|
Some("part001 = startSketchOn(XY)".to_string())
|
||||||
);
|
);
|
||||||
assert_eq!(folding_ranges[1].start_line, 145);
|
assert_eq!(folding_ranges[1].start_line, 142);
|
||||||
assert_eq!(folding_ranges[1].end_line, 244);
|
assert_eq!(folding_ranges[1].end_line, 238);
|
||||||
assert_eq!(folding_ranges[1].collapsed_text, Some("startSketchOn(XY)".to_string()));
|
assert_eq!(folding_ranges[1].collapsed_text, Some("startSketchOn(XY)".to_string()));
|
||||||
assert_eq!(folding_ranges[2].start_line, 350);
|
assert_eq!(folding_ranges[2].start_line, 345);
|
||||||
assert_eq!(folding_ranges[2].end_line, 363);
|
assert_eq!(folding_ranges[2].end_line, 358);
|
||||||
assert_eq!(folding_ranges[2].collapsed_text, Some("fn ghi(x) {".to_string()));
|
assert_eq!(folding_ranges[2].collapsed_text, Some("fn ghi(@x) {".to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_lsp_symbols() {
|
fn test_get_lsp_symbols() {
|
||||||
let code = r#"part001 = startSketchOn(XY)
|
let code = r#"part001 = startSketchOn(XY)
|
||||||
|> startProfile(at = [0.0000000000, 5.0000000000])
|
|> startProfile(at = [0.0000000000, 5.0000000000])
|
||||||
|> line([0.4900857016, -0.0240763666], %)
|
|> line([0.4900857016, -0.0240763666])
|
||||||
|
|
||||||
part002 = "part002"
|
part002 = "part002"
|
||||||
things = [part001, 0.0]
|
things = [part001, 0.0]
|
||||||
@ -3804,12 +3804,12 @@ h = 30
|
|||||||
|
|
||||||
cylinder = startSketchOn(-XZ)
|
cylinder = startSketchOn(-XZ)
|
||||||
|> startProfile(at = [50, 0])
|
|> startProfile(at = [50, 0])
|
||||||
|> arc({
|
|> arc(
|
||||||
angle_end = 360,
|
angle_end = 360,
|
||||||
angle_start = 0,
|
angle_start = 0,
|
||||||
radius = r
|
radius = r
|
||||||
}, %)
|
)
|
||||||
|> extrude(h, %)
|
|> extrude(h)
|
||||||
"#;
|
"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
@ -3825,12 +3825,12 @@ h = 30
|
|||||||
cylinder = startSketchOn(-XZ)
|
cylinder = startSketchOn(-XZ)
|
||||||
|> startProfile(at = [50, 0])
|
|> startProfile(at = [50, 0])
|
||||||
// comment
|
// comment
|
||||||
|> arc({
|
|> arc(
|
||||||
angle_end= 360,
|
angle_end= 360,
|
||||||
angle_start= 0,
|
angle_start= 0,
|
||||||
radius= r
|
radius= r
|
||||||
}, %)
|
)
|
||||||
|> extrude(h, %)
|
|> extrude(h)
|
||||||
"#;
|
"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
@ -4105,7 +4105,7 @@ cylinder = startSketchOn(-XZ)
|
|||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn test_parse_object_bool() {
|
async fn test_parse_object_bool() {
|
||||||
let some_program_string = r#"some_func({thing: true, other_thing: false})"#;
|
let some_program_string = r#"some_func({thing = true, other_thing = false})"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
// We want to get the bool and verify it is a bool.
|
// We want to get the bool and verify it is a bool.
|
||||||
@ -4123,14 +4123,22 @@ cylinder = startSketchOn(-XZ)
|
|||||||
panic!("expected a function!");
|
panic!("expected a function!");
|
||||||
};
|
};
|
||||||
|
|
||||||
let Expr::CallExpression(ce) = expression else {
|
let oe = match expression {
|
||||||
panic!("expected a function!");
|
Expr::CallExpressionKw(ce) => {
|
||||||
};
|
assert!(ce.unlabeled.is_some());
|
||||||
|
|
||||||
assert!(!ce.arguments.is_empty());
|
let Expr::ObjectExpression(oe) = ce.unlabeled.as_ref().unwrap() else {
|
||||||
|
panic!("expected a object!");
|
||||||
let Expr::ObjectExpression(oe) = ce.arguments.first().unwrap() else {
|
};
|
||||||
panic!("expected a object!");
|
oe
|
||||||
|
}
|
||||||
|
Expr::CallExpression(ce) => {
|
||||||
|
let Expr::ObjectExpression(ref oe) = (ce.arguments).first().unwrap() else {
|
||||||
|
panic!("expected an object!");
|
||||||
|
};
|
||||||
|
oe
|
||||||
|
}
|
||||||
|
other => panic!("expected a Call or CallKw, found {other:?}"),
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_eq!(oe.properties.len(), 2);
|
assert_eq!(oe.properties.len(), 2);
|
||||||
|
@ -14,7 +14,7 @@ use winnow::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
ast::types::{AscribedExpression, ImportPath, LabelledExpression},
|
ast::types::{AscribedExpression, CallExpression, ImportPath, LabelledExpression},
|
||||||
token::{NumericSuffix, RESERVED_WORDS},
|
token::{NumericSuffix, RESERVED_WORDS},
|
||||||
DeprecationKind,
|
DeprecationKind,
|
||||||
};
|
};
|
||||||
@ -24,13 +24,12 @@ use crate::{
|
|||||||
parsing::{
|
parsing::{
|
||||||
ast::types::{
|
ast::types::{
|
||||||
Annotation, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem,
|
Annotation, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem,
|
||||||
BoxNode, CallExpression, CallExpressionKw, CommentStyle, DefaultParamVal, ElseIf, Expr,
|
BoxNode, CallExpressionKw, CommentStyle, DefaultParamVal, ElseIf, Expr, ExpressionStatement,
|
||||||
ExpressionStatement, FunctionExpression, Identifier, IfExpression, ImportItem, ImportSelector,
|
FunctionExpression, Identifier, IfExpression, ImportItem, ImportSelector, ImportStatement, ItemVisibility,
|
||||||
ImportStatement, ItemVisibility, LabeledArg, Literal, LiteralIdentifier, LiteralValue, MemberExpression,
|
LabeledArg, Literal, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject, Name, Node, NodeList,
|
||||||
MemberObject, Name, Node, NodeList, NonCodeMeta, NonCodeNode, NonCodeValue, ObjectExpression,
|
NonCodeMeta, NonCodeNode, NonCodeValue, ObjectExpression, ObjectProperty, Parameter, PipeExpression,
|
||||||
ObjectProperty, Parameter, PipeExpression, PipeSubstitution, PrimitiveType, Program, ReturnStatement,
|
PipeSubstitution, PrimitiveType, Program, ReturnStatement, Shebang, TagDeclarator, Type, TypeDeclaration,
|
||||||
Shebang, TagDeclarator, Type, TypeDeclaration, UnaryExpression, UnaryOperator, VariableDeclaration,
|
UnaryExpression, UnaryOperator, VariableDeclaration, VariableDeclarator, VariableKind,
|
||||||
VariableDeclarator, VariableKind,
|
|
||||||
},
|
},
|
||||||
math::BinaryExpressionToken,
|
math::BinaryExpressionToken,
|
||||||
token::{Token, TokenSlice, TokenType},
|
token::{Token, TokenSlice, TokenType},
|
||||||
@ -3047,6 +3046,46 @@ fn fn_call_kw(i: &mut TokenSlice) -> PResult<Node<CallExpressionKw>> {
|
|||||||
let _ = open_paren.parse_next(i)?;
|
let _ = open_paren.parse_next(i)?;
|
||||||
ignore_whitespace(i);
|
ignore_whitespace(i);
|
||||||
|
|
||||||
|
// Special case: no args
|
||||||
|
let early_close = peek(close_paren).parse_next(i);
|
||||||
|
if early_close.is_ok() {
|
||||||
|
let cl = close_paren.parse_next(i)?;
|
||||||
|
let result = Node::new_node(
|
||||||
|
fn_name.start,
|
||||||
|
cl.end,
|
||||||
|
fn_name.module_id,
|
||||||
|
CallExpressionKw {
|
||||||
|
callee: fn_name,
|
||||||
|
unlabeled: Default::default(),
|
||||||
|
arguments: Default::default(),
|
||||||
|
digest: None,
|
||||||
|
non_code_meta: Default::default(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Special case: one arg (unlabeled)
|
||||||
|
let early_close = peek((expression, opt(whitespace), close_paren)).parse_next(i);
|
||||||
|
if early_close.is_ok() {
|
||||||
|
let first_expression = expression.parse_next(i)?;
|
||||||
|
ignore_whitespace(i);
|
||||||
|
let end = close_paren.parse_next(i)?.end;
|
||||||
|
let result = Node::new_node(
|
||||||
|
fn_name.start,
|
||||||
|
end,
|
||||||
|
fn_name.module_id,
|
||||||
|
CallExpressionKw {
|
||||||
|
callee: fn_name,
|
||||||
|
unlabeled: Some(first_expression),
|
||||||
|
arguments: Default::default(),
|
||||||
|
digest: None,
|
||||||
|
non_code_meta: Default::default(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
enum ArgPlace {
|
enum ArgPlace {
|
||||||
NonCode(Node<NonCodeNode>),
|
NonCode(Node<NonCodeNode>),
|
||||||
@ -3834,7 +3873,7 @@ mySk1 = startSketchOn(XY)
|
|||||||
#[test]
|
#[test]
|
||||||
fn pipes_on_pipes_minimal() {
|
fn pipes_on_pipes_minimal() {
|
||||||
let test_program = r#"startSketchOn(XY)
|
let test_program = r#"startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(endAbsolute = [0, -0]) // MoveRelative
|
|> line(endAbsolute = [0, -0]) // MoveRelative
|
||||||
|
|
||||||
"#;
|
"#;
|
||||||
@ -4105,7 +4144,7 @@ mySk1 = startSketchOn(XY)
|
|||||||
fn test_parse_half_pipe_small() {
|
fn test_parse_half_pipe_small() {
|
||||||
assert_err_contains(
|
assert_err_contains(
|
||||||
"secondExtrude = startSketchOn(XY)
|
"secondExtrude = startSketchOn(XY)
|
||||||
|> startProfileAt([0,0], %)
|
|> startProfile(at = [0,0])
|
||||||
|",
|
|",
|
||||||
"Unexpected token: |",
|
"Unexpected token: |",
|
||||||
);
|
);
|
||||||
@ -4169,7 +4208,7 @@ height = [obj["a"] -1, 0]"#;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_anon_fn() {
|
fn test_anon_fn() {
|
||||||
crate::parsing::top_level_parse("foo(42, fn(x) { return x + 1 })").unwrap();
|
crate::parsing::top_level_parse("foo(num=42, closure=fn(x) { return x + 1 })").unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -4198,15 +4237,15 @@ height = [obj["a"] -1, 0]"#;
|
|||||||
let code = "height = 10
|
let code = "height = 10
|
||||||
|
|
||||||
firstExtrude = startSketchOn(XY)
|
firstExtrude = startSketchOn(XY)
|
||||||
|> startProfileAt([0,0], %)
|
|> startProfile(at = [0,0])
|
||||||
|> line([0, 8], %)
|
|> line(at = [0, 8])
|
||||||
|> line([20, 0], %)
|
|> line(at = [20, 0])
|
||||||
|> line([0, -8], %)
|
|> line(at = [0, -8])
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length=2)
|
|> extrude(length=2)
|
||||||
|
|
||||||
secondExtrude = startSketchOn(XY)
|
secondExtrude = startSketchOn(XY)
|
||||||
|> startProfileAt([0,0], %)
|
|> startProfile(at = [0,0])
|
||||||
|";
|
|";
|
||||||
assert_err_contains(code, "Unexpected token: |");
|
assert_err_contains(code, "Unexpected token: |");
|
||||||
}
|
}
|
||||||
@ -4477,7 +4516,7 @@ e
|
|||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// exampleSketch = startSketchOn(XZ)
|
/// exampleSketch = startSketchOn(XZ)
|
||||||
/// |> startProfileAt([0, 0], %)
|
/// |> startProfile(at = [0, 0])
|
||||||
/// |> angledLine(
|
/// |> angledLine(
|
||||||
/// angle = 30,
|
/// angle = 30,
|
||||||
/// length = 3 / cos(toRadians(30)),
|
/// length = 3 / cos(toRadians(30)),
|
||||||
@ -4517,7 +4556,7 @@ export fn cos(num: number(rad)): number(_) {}"#;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn error_underscore() {
|
fn error_underscore() {
|
||||||
let (_, errs) = assert_no_fatal("_foo(_blah, _)");
|
let (_, errs) = assert_no_fatal("_foo(a=_blah, b=_)");
|
||||||
assert_eq!(errs.len(), 3, "found: {errs:#?}");
|
assert_eq!(errs.len(), 3, "found: {errs:#?}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4629,11 +4668,11 @@ thing(false)
|
|||||||
#[test]
|
#[test]
|
||||||
fn random_words_fail() {
|
fn random_words_fail() {
|
||||||
let test_program = r#"part001 = startSketchOn(-XZ)
|
let test_program = r#"part001 = startSketchOn(-XZ)
|
||||||
|> startProfileAt([8.53, 11.8], %)
|
|> startProfile(at = [8.53, 11.8])
|
||||||
asdasd asdasd
|
asdasd asdasd
|
||||||
|> line([11.12, -14.82], %)
|
|> line(at = [11.12, -14.82])
|
||||||
|> line([-13.27, -6.98], %)
|
|> line(at = [-13.27, -6.98])
|
||||||
|> line([-5.09, 12.33], %)
|
|> line(at = [-5.09, 12.33])
|
||||||
asdasd
|
asdasd
|
||||||
"#;
|
"#;
|
||||||
let _ = crate::parsing::top_level_parse(test_program).unwrap_errs();
|
let _ = crate::parsing::top_level_parse(test_program).unwrap_errs();
|
||||||
@ -4643,16 +4682,16 @@ thing(false)
|
|||||||
fn test_member_expression_sketch() {
|
fn test_member_expression_sketch() {
|
||||||
let some_program_string = r#"fn cube(pos, scale) {
|
let some_program_string = r#"fn cube(pos, scale) {
|
||||||
sg = startSketchOn(XY)
|
sg = startSketchOn(XY)
|
||||||
|> startProfileAt(pos, %)
|
|> startProfile(pos)
|
||||||
|> line([0, scale], %)
|
|> line(at = [0, scale])
|
||||||
|> line([scale, 0], %)
|
|> line(at = [scale, 0])
|
||||||
|> line([0, -scale], %)
|
|> line(at = [0, -scale])
|
||||||
|
|
||||||
return sg
|
return sg
|
||||||
}
|
}
|
||||||
|
|
||||||
b1 = cube([0,0], 10)
|
b1 = cube(pos=[0,0], scale=10)
|
||||||
b2 = cube([3,3], 4)
|
b2 = cube(pos=[3,3], scale=4)
|
||||||
|
|
||||||
pt1 = b1[0]
|
pt1 = b1[0]
|
||||||
pt2 = b2[0]
|
pt2 = b2[0]
|
||||||
@ -4671,16 +4710,16 @@ let other_thing = 2 * cos(3)"#;
|
|||||||
fn test_negative_arguments() {
|
fn test_negative_arguments() {
|
||||||
let some_program_string = r#"fn box(p, h, l, w) {
|
let some_program_string = r#"fn box(p, h, l, w) {
|
||||||
myBox = startSketchOn(XY)
|
myBox = startSketchOn(XY)
|
||||||
|> startProfileAt(p, %)
|
|> startProfile(p)
|
||||||
|> line([0, l], %)
|
|> line(at = [0, l])
|
||||||
|> line([w, 0], %)
|
|> line(at = [w, 0])
|
||||||
|> line([0, -l], %)
|
|> line(at = [0, -l])
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length=h)
|
|> extrude(length=h)
|
||||||
|
|
||||||
return myBox
|
return myBox
|
||||||
}
|
}
|
||||||
let myBox = box([0,0], -3, -16, -10)
|
let myBox = box(p=[0,0], h=-3, l=-16, w=-10)
|
||||||
"#;
|
"#;
|
||||||
crate::parsing::top_level_parse(some_program_string).unwrap();
|
crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
}
|
}
|
||||||
@ -4697,20 +4736,20 @@ let myBox = box([0,0], -3, -16, -10)
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_parse_tag_named_std_lib() {
|
fn test_parse_tag_named_std_lib() {
|
||||||
let some_program_string = r#"startSketchOn(XY)
|
let some_program_string = r#"startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line([5, 5], %, $xLine)
|
|> line(%, end = [5, 5], tag = $xLine)
|
||||||
"#;
|
"#;
|
||||||
assert_err(
|
assert_err(
|
||||||
some_program_string,
|
some_program_string,
|
||||||
"Cannot assign a tag to a reserved keyword: xLine",
|
"Cannot assign a tag to a reserved keyword: xLine",
|
||||||
[74, 80],
|
[86, 92],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_empty_tag_brace() {
|
fn test_parse_empty_tag_brace() {
|
||||||
let some_program_string = r#"startSketchOn(XY)
|
let some_program_string = r#"startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(%, $)
|
|> line(%, $)
|
||||||
"#;
|
"#;
|
||||||
assert_err(some_program_string, "Tag names must not be empty", [67, 68]);
|
assert_err(some_program_string, "Tag names must not be empty", [67, 68]);
|
||||||
@ -4718,7 +4757,7 @@ let myBox = box([0,0], -3, -16, -10)
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_parse_empty_tag_whitespace() {
|
fn test_parse_empty_tag_whitespace() {
|
||||||
let some_program_string = r#"startSketchOn(XY)
|
let some_program_string = r#"startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(%, $ ,01)
|
|> line(%, $ ,01)
|
||||||
"#;
|
"#;
|
||||||
assert_err(some_program_string, "Tag names must not be empty", [67, 68]);
|
assert_err(some_program_string, "Tag names must not be empty", [67, 68]);
|
||||||
@ -4727,7 +4766,7 @@ let myBox = box([0,0], -3, -16, -10)
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_parse_empty_tag_comma() {
|
fn test_parse_empty_tag_comma() {
|
||||||
let some_program_string = r#"startSketchOn(XY)
|
let some_program_string = r#"startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(%, $,)
|
|> line(%, $,)
|
||||||
"#;
|
"#;
|
||||||
assert_err(some_program_string, "Tag names must not be empty", [67, 68]);
|
assert_err(some_program_string, "Tag names must not be empty", [67, 68]);
|
||||||
@ -4736,7 +4775,7 @@ let myBox = box([0,0], -3, -16, -10)
|
|||||||
fn test_parse_tag_starting_with_digit() {
|
fn test_parse_tag_starting_with_digit() {
|
||||||
let some_program_string = r#"
|
let some_program_string = r#"
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(%, $01)"#;
|
|> line(%, $01)"#;
|
||||||
assert_err(
|
assert_err(
|
||||||
some_program_string,
|
some_program_string,
|
||||||
@ -4748,14 +4787,14 @@ let myBox = box([0,0], -3, -16, -10)
|
|||||||
fn test_parse_tag_including_digit() {
|
fn test_parse_tag_including_digit() {
|
||||||
let some_program_string = r#"
|
let some_program_string = r#"
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(%, $var01)"#;
|
|> line(%, tag = $var01)"#;
|
||||||
assert_no_err(some_program_string);
|
assert_no_err(some_program_string);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_tag_starting_with_bang() {
|
fn test_parse_tag_starting_with_bang() {
|
||||||
let some_program_string = r#"startSketchOn(XY)
|
let some_program_string = r#"startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(%, $!var,01)
|
|> line(%, $!var,01)
|
||||||
"#;
|
"#;
|
||||||
assert_err(some_program_string, "Tag names must not start with a bang", [67, 68]);
|
assert_err(some_program_string, "Tag names must not start with a bang", [67, 68]);
|
||||||
@ -4763,7 +4802,7 @@ let myBox = box([0,0], -3, -16, -10)
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_parse_tag_starting_with_dollar() {
|
fn test_parse_tag_starting_with_dollar() {
|
||||||
let some_program_string = r#"startSketchOn(XY)
|
let some_program_string = r#"startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(%, $$,01)
|
|> line(%, $$,01)
|
||||||
"#;
|
"#;
|
||||||
assert_err(some_program_string, "Tag names must not start with a dollar", [67, 68]);
|
assert_err(some_program_string, "Tag names must not start with a dollar", [67, 68]);
|
||||||
@ -4771,7 +4810,7 @@ let myBox = box([0,0], -3, -16, -10)
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_parse_tag_starting_with_fn() {
|
fn test_parse_tag_starting_with_fn() {
|
||||||
let some_program_string = r#"startSketchOn(XY)
|
let some_program_string = r#"startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(%, $fn,01)
|
|> line(%, $fn,01)
|
||||||
"#;
|
"#;
|
||||||
assert_err(some_program_string, "Tag names must not start with a keyword", [67, 69]);
|
assert_err(some_program_string, "Tag names must not start with a keyword", [67, 69]);
|
||||||
@ -4779,7 +4818,7 @@ let myBox = box([0,0], -3, -16, -10)
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_parse_tag_starting_with_a_comment() {
|
fn test_parse_tag_starting_with_a_comment() {
|
||||||
let some_program_string = r#"startSketchOn(XY)
|
let some_program_string = r#"startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(%, $//
|
|> line(%, $//
|
||||||
,01)
|
,01)
|
||||||
"#;
|
"#;
|
||||||
@ -4794,8 +4833,8 @@ let myBox = box([0,0], -3, -16, -10)
|
|||||||
fn test_parse_tag_with_reserved_in_middle_works() {
|
fn test_parse_tag_with_reserved_in_middle_works() {
|
||||||
let some_program_string = r#"
|
let some_program_string = r#"
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line([5, 5], %, $sketching)
|
|> line(end = [5, 5], tag = $sketching)
|
||||||
"#;
|
"#;
|
||||||
assert_no_err(some_program_string);
|
assert_no_err(some_program_string);
|
||||||
}
|
}
|
||||||
@ -4803,21 +4842,21 @@ let myBox = box([0,0], -3, -16, -10)
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_parse_array_missing_closing_bracket() {
|
fn test_parse_array_missing_closing_bracket() {
|
||||||
let some_program_string = r#"
|
let some_program_string = r#"
|
||||||
sketch001 = startSketchOn(XZ) |> startProfileAt([90.45, 119.09, %)"#;
|
sketch001 = startSketchOn(XZ) |> startProfile(at = [90.45, 119.09)"#;
|
||||||
assert_err(
|
assert_err(
|
||||||
some_program_string,
|
some_program_string,
|
||||||
"Encountered an unexpected character(s) before finding a closing bracket(`]`) for the array",
|
"Encountered an unexpected character(s) before finding a closing bracket(`]`) for the array",
|
||||||
[49, 65],
|
[52, 60],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_array_missing_comma() {
|
fn test_parse_array_missing_comma() {
|
||||||
let some_program_string = r#"
|
let some_program_string = r#"
|
||||||
sketch001 = startSketchOn(XZ) |> startProfileAt([90.45 119.09], %)"#;
|
sketch001 = startSketchOn(XZ) |> startProfile(at = [90.45 119.09])"#;
|
||||||
assert_err(
|
assert_err(
|
||||||
some_program_string,
|
some_program_string,
|
||||||
"Unexpected character encountered. You might be missing a comma in between elements.",
|
"Unexpected character encountered. You might be missing a comma in between elements.",
|
||||||
[50, 63],
|
[53, 66],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
@ -4825,21 +4864,21 @@ sketch001 = startSketchOn(XZ) |> startProfileAt([90.45 119.09], %)"#;
|
|||||||
// since there is an early exit if encountering a reserved word, the error should be about
|
// since there is an early exit if encountering a reserved word, the error should be about
|
||||||
// that and not the missing comma
|
// that and not the missing comma
|
||||||
let some_program_string = r#"
|
let some_program_string = r#"
|
||||||
sketch001 = startSketchOn(XZ) |> startProfileAt([90.45 $struct], %)"#;
|
sketch001 = startSketchOn(XZ) |> startProfile(at = [90.45 $struct])"#;
|
||||||
assert_err(
|
assert_err(
|
||||||
some_program_string,
|
some_program_string,
|
||||||
"Encountered an unexpected character(s) before finding a closing bracket(`]`) for the array",
|
"Encountered an unexpected character(s) before finding a closing bracket(`]`) for the array",
|
||||||
[49, 50],
|
[52, 53],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_array_random_brace() {
|
fn test_parse_array_random_brace() {
|
||||||
let some_program_string = r#"
|
let some_program_string = r#"
|
||||||
sketch001 = startSketchOn(XZ) |> startProfileAt([}], %)"#;
|
sketch001 = startSketchOn(XZ) |> startProfile(at = [}])"#;
|
||||||
assert_err(
|
assert_err(
|
||||||
some_program_string,
|
some_program_string,
|
||||||
"Encountered an unexpected character(s) before finding a closing bracket(`]`) for the array",
|
"Encountered an unexpected character(s) before finding a closing bracket(`]`) for the array",
|
||||||
[49, 50],
|
[52, 53],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5075,17 +5114,17 @@ mod snapshot_tests {
|
|||||||
snapshot_test!(
|
snapshot_test!(
|
||||||
a,
|
a,
|
||||||
r#"boxSketch = startSketchOn(XY)
|
r#"boxSketch = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt(at = [0, 0])
|
||||||
|> line([0, 10], %)
|
|> line(at = [0, 10])
|
||||||
|> tangentialArc([-5, 5], %)
|
|> tangentialArc(end = [-5, 5])
|
||||||
|> line([5, -15], %)
|
|> line(at = [5, -15])
|
||||||
|> extrude(length=10)
|
|> extrude(length=10)
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
snapshot_test!(b, "myVar = min(5 , -legLen(5, 4))"); // Space before comma
|
snapshot_test!(b, "myVar = min(x=5 , y=-legLen(5, z=4))"); // Space before comma
|
||||||
|
|
||||||
snapshot_test!(c, "myVar = min(-legLen(5, 4), 5)");
|
snapshot_test!(c, "myVar = min(x=-legLen(a=5, b=4), y=5)");
|
||||||
snapshot_test!(d, "myVar = 5 + 6 |> myFunc(45, %)");
|
snapshot_test!(d, "myVar = 5 + 6 |> myFunc(45)");
|
||||||
snapshot_test!(e, "x = 1 * (3 - 4)");
|
snapshot_test!(e, "x = 1 * (3 - 4)");
|
||||||
snapshot_test!(f, r#"x = 1 // this is an inline comment"#);
|
snapshot_test!(f, r#"x = 1 // this is an inline comment"#);
|
||||||
snapshot_test!(
|
snapshot_test!(
|
||||||
@ -5141,11 +5180,11 @@ mod snapshot_tests {
|
|||||||
snapshot_test!(v, r#"pt1 = b1[0]"#);
|
snapshot_test!(v, r#"pt1 = b1[0]"#);
|
||||||
snapshot_test!(w, r#"pt1 = b1['zero']"#);
|
snapshot_test!(w, r#"pt1 = b1['zero']"#);
|
||||||
snapshot_test!(x, r#"pt1 = b1.zero"#);
|
snapshot_test!(x, r#"pt1 = b1.zero"#);
|
||||||
snapshot_test!(y, r#"sg = startSketchOn(XY) |> startProfileAt(pos, %)"#);
|
snapshot_test!(y, r#"sg = startSketchOn(XY) |> startProfile(pos)"#);
|
||||||
snapshot_test!(
|
snapshot_test!(
|
||||||
z,
|
z,
|
||||||
"sg = startSketchOn(XY)
|
"sg = startSketchOn(XY)
|
||||||
|> startProfileAt(pos) |> line([0, -scale], %)"
|
|> startProfile(pos) |> line([0, -scale])"
|
||||||
);
|
);
|
||||||
snapshot_test!(aa, r#"sg = -scale"#);
|
snapshot_test!(aa, r#"sg = -scale"#);
|
||||||
snapshot_test!(ab, "line(endAbsolute = [0, -1])");
|
snapshot_test!(ab, "line(endAbsolute = [0, -1])");
|
||||||
@ -5168,7 +5207,7 @@ mod snapshot_tests {
|
|||||||
snapshot_test!(
|
snapshot_test!(
|
||||||
af,
|
af,
|
||||||
r#"mySketch = startSketchOn(XY)
|
r#"mySketch = startSketchOn(XY)
|
||||||
|> startProfileAt([0,0], %)
|
|> startProfile(at = [0,0])
|
||||||
|> line(endAbsolute = [0, 1], tag = $myPath)
|
|> line(endAbsolute = [0, 1], tag = $myPath)
|
||||||
|> line(endAbsolute = [1, 1])
|
|> line(endAbsolute = [1, 1])
|
||||||
|> line(endAbsolute = [1, 0], tag = $rightPath)
|
|> line(endAbsolute = [1, 0], tag = $rightPath)
|
||||||
@ -5176,21 +5215,21 @@ mod snapshot_tests {
|
|||||||
);
|
);
|
||||||
snapshot_test!(
|
snapshot_test!(
|
||||||
ag,
|
ag,
|
||||||
"mySketch = startSketchOn(XY) |> startProfileAt([0,0], %) |> line(endAbsolute = [1, 1]) |> close()"
|
"mySketch = startSketchOn(XY) |> startProfile(at = [0,0]) |> line(endAbsolute = [1, 1]) |> close()"
|
||||||
);
|
);
|
||||||
snapshot_test!(ah, "myBox = startSketchOn(XY) |> startProfileAt(p, %)");
|
snapshot_test!(ah, "myBox = startSketchOn(XY) |> startProfile(at = p)");
|
||||||
snapshot_test!(ai, r#"myBox = f(1) |> g(2, %)"#);
|
snapshot_test!(ai, r#"myBox = f(1) |> g(2)"#);
|
||||||
snapshot_test!(
|
snapshot_test!(
|
||||||
aj,
|
aj,
|
||||||
r#"myBox = startSketchOn(XY) |> startProfileAt(p, %) |> line(end = [0, l])"#
|
r#"myBox = startSketchOn(XY) |> startProfile(at = p) |> line(end = [0, l])"#
|
||||||
);
|
);
|
||||||
snapshot_test!(ak, "line(endAbsolute = [0, 1])");
|
snapshot_test!(ak, "line(endAbsolute = [0, 1])");
|
||||||
snapshot_test!(ap, "mySketch = startSketchOn(XY) |> startProfileAt([0,0], %)");
|
snapshot_test!(ap, "mySketch = startSketchOn(XY) |> startProfile(at = [0,0])");
|
||||||
snapshot_test!(aq, "log(5, \"hello\", aIdentifier)");
|
snapshot_test!(aq, "log(number = 5, msg = \"hello\", id=aIdentifier)");
|
||||||
snapshot_test!(ar, r#"5 + "a""#);
|
snapshot_test!(ar, r#"5 + "a""#);
|
||||||
snapshot_test!(at, "line([0, l], %)");
|
snapshot_test!(at, "line([0, l])");
|
||||||
snapshot_test!(au, include_str!("../../e2e/executor/inputs/cylinder.kcl"));
|
snapshot_test!(au, include_str!("../../e2e/executor/inputs/cylinder.kcl"));
|
||||||
snapshot_test!(av, "fn f(angle?) { return default(angle, 360) }");
|
snapshot_test!(av, "fn f(angle?) { return default(maybe=angle, otherwise=360) }");
|
||||||
snapshot_test!(
|
snapshot_test!(
|
||||||
aw,
|
aw,
|
||||||
"numbers = [
|
"numbers = [
|
||||||
|
@ -8,7 +8,7 @@ expression: actual
|
|||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"declaration": {
|
"declaration": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 170,
|
"end": 179,
|
||||||
"id": {
|
"id": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 9,
|
"end": 9,
|
||||||
@ -61,44 +61,47 @@ expression: actual
|
|||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"commentStart": 52,
|
"type": "LabeledArg",
|
||||||
"elements": [
|
"label": {
|
||||||
{
|
"commentStart": 52,
|
||||||
"commentStart": 53,
|
"end": 54,
|
||||||
"end": 54,
|
"name": "at",
|
||||||
"raw": "0",
|
"start": 52,
|
||||||
"start": 53,
|
"type": "Identifier"
|
||||||
"type": "Literal",
|
},
|
||||||
"type": "Literal",
|
"arg": {
|
||||||
"value": {
|
"commentStart": 57,
|
||||||
"value": 0.0,
|
"elements": [
|
||||||
"suffix": "None"
|
{
|
||||||
|
"commentStart": 58,
|
||||||
|
"end": 59,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 58,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 61,
|
||||||
|
"end": 62,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 61,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
],
|
||||||
{
|
"end": 63,
|
||||||
"commentStart": 56,
|
"start": 57,
|
||||||
"end": 57,
|
"type": "ArrayExpression",
|
||||||
"raw": "0",
|
"type": "ArrayExpression"
|
||||||
"start": 56,
|
}
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 0.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"end": 58,
|
|
||||||
"start": 52,
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 60,
|
|
||||||
"end": 61,
|
|
||||||
"start": 60,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
@ -117,86 +120,175 @@ expression: actual
|
|||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 37,
|
"commentStart": 37,
|
||||||
"end": 62,
|
"end": 64,
|
||||||
"start": 37,
|
"start": 37,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"commentStart": 75,
|
"type": "LabeledArg",
|
||||||
"elements": [
|
"label": {
|
||||||
{
|
"commentStart": 77,
|
||||||
"commentStart": 76,
|
"end": 79,
|
||||||
"end": 77,
|
"name": "at",
|
||||||
"raw": "0",
|
"start": 77,
|
||||||
"start": 76,
|
"type": "Identifier"
|
||||||
"type": "Literal",
|
},
|
||||||
"type": "Literal",
|
"arg": {
|
||||||
"value": {
|
"commentStart": 82,
|
||||||
"value": 0.0,
|
"elements": [
|
||||||
"suffix": "None"
|
{
|
||||||
|
"commentStart": 83,
|
||||||
|
"end": 84,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 83,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 86,
|
||||||
|
"end": 88,
|
||||||
|
"raw": "10",
|
||||||
|
"start": 86,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 10.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
],
|
||||||
{
|
"end": 89,
|
||||||
"commentStart": 79,
|
"start": 82,
|
||||||
"end": 81,
|
"type": "ArrayExpression",
|
||||||
"raw": "10",
|
"type": "ArrayExpression"
|
||||||
"start": 79,
|
}
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 10.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"end": 82,
|
|
||||||
"start": 75,
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 84,
|
|
||||||
"end": 85,
|
|
||||||
"start": 84,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 70,
|
"commentStart": 72,
|
||||||
"end": 74,
|
"end": 76,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 70,
|
"commentStart": 72,
|
||||||
"end": 74,
|
"end": 76,
|
||||||
"name": "line",
|
"name": "line",
|
||||||
"start": 70,
|
"start": 72,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"path": [],
|
"path": [],
|
||||||
"start": 70,
|
"start": 72,
|
||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 70,
|
"commentStart": 72,
|
||||||
"end": 86,
|
"end": 90,
|
||||||
"start": 70,
|
"start": 72,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"commentStart": 108,
|
"type": "LabeledArg",
|
||||||
"elements": [
|
"label": {
|
||||||
{
|
"commentStart": 112,
|
||||||
"argument": {
|
"end": 115,
|
||||||
"commentStart": 110,
|
"name": "end",
|
||||||
"end": 111,
|
"start": 112,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 118,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"argument": {
|
||||||
|
"commentStart": 120,
|
||||||
|
"end": 121,
|
||||||
|
"raw": "5",
|
||||||
|
"start": 120,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 5.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commentStart": 119,
|
||||||
|
"end": 121,
|
||||||
|
"operator": "-",
|
||||||
|
"start": 119,
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnaryExpression"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 123,
|
||||||
|
"end": 124,
|
||||||
"raw": "5",
|
"raw": "5",
|
||||||
"start": 110,
|
"start": 123,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 5.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 125,
|
||||||
|
"start": 118,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 98,
|
||||||
|
"end": 111,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 98,
|
||||||
|
"end": 111,
|
||||||
|
"name": "tangentialArc",
|
||||||
|
"start": 98,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 98,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 98,
|
||||||
|
"end": 126,
|
||||||
|
"start": 98,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 139,
|
||||||
|
"end": 141,
|
||||||
|
"name": "at",
|
||||||
|
"start": 139,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 144,
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"commentStart": 145,
|
||||||
|
"end": 146,
|
||||||
|
"raw": "5",
|
||||||
|
"start": 145,
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"value": {
|
"value": {
|
||||||
@ -204,148 +296,72 @@ expression: actual
|
|||||||
"suffix": "None"
|
"suffix": "None"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commentStart": 109,
|
{
|
||||||
"end": 111,
|
"argument": {
|
||||||
"operator": "-",
|
"commentStart": 149,
|
||||||
"start": 109,
|
"end": 151,
|
||||||
"type": "UnaryExpression",
|
"raw": "15",
|
||||||
"type": "UnaryExpression"
|
"start": 149,
|
||||||
},
|
"type": "Literal",
|
||||||
{
|
"type": "Literal",
|
||||||
"commentStart": 113,
|
"value": {
|
||||||
"end": 114,
|
"value": 15.0,
|
||||||
"raw": "5",
|
"suffix": "None"
|
||||||
"start": 113,
|
}
|
||||||
"type": "Literal",
|
},
|
||||||
"type": "Literal",
|
"commentStart": 148,
|
||||||
"value": {
|
"end": 151,
|
||||||
"value": 5.0,
|
"operator": "-",
|
||||||
"suffix": "None"
|
"start": 148,
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnaryExpression"
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
],
|
"end": 152,
|
||||||
"end": 115,
|
"start": 144,
|
||||||
"start": 108,
|
"type": "ArrayExpression",
|
||||||
"type": "ArrayExpression",
|
"type": "ArrayExpression"
|
||||||
"type": "ArrayExpression"
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 117,
|
|
||||||
"end": 118,
|
|
||||||
"start": 117,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 94,
|
"commentStart": 134,
|
||||||
"end": 107,
|
"end": 138,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 94,
|
"commentStart": 134,
|
||||||
"end": 107,
|
"end": 138,
|
||||||
"name": "tangentialArc",
|
|
||||||
"start": 94,
|
|
||||||
"type": "Identifier"
|
|
||||||
},
|
|
||||||
"path": [],
|
|
||||||
"start": 94,
|
|
||||||
"type": "Name"
|
|
||||||
},
|
|
||||||
"commentStart": 94,
|
|
||||||
"end": 119,
|
|
||||||
"start": 94,
|
|
||||||
"type": "CallExpression",
|
|
||||||
"type": "CallExpression"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"commentStart": 132,
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"commentStart": 133,
|
|
||||||
"end": 134,
|
|
||||||
"raw": "5",
|
|
||||||
"start": 133,
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 5.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"argument": {
|
|
||||||
"commentStart": 137,
|
|
||||||
"end": 139,
|
|
||||||
"raw": "15",
|
|
||||||
"start": 137,
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 15.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"commentStart": 136,
|
|
||||||
"end": 139,
|
|
||||||
"operator": "-",
|
|
||||||
"start": 136,
|
|
||||||
"type": "UnaryExpression",
|
|
||||||
"type": "UnaryExpression"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"end": 140,
|
|
||||||
"start": 132,
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 142,
|
|
||||||
"end": 143,
|
|
||||||
"start": 142,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"callee": {
|
|
||||||
"abs_path": false,
|
|
||||||
"commentStart": 127,
|
|
||||||
"end": 131,
|
|
||||||
"name": {
|
|
||||||
"commentStart": 127,
|
|
||||||
"end": 131,
|
|
||||||
"name": "line",
|
"name": "line",
|
||||||
"start": 127,
|
"start": 134,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"path": [],
|
"path": [],
|
||||||
"start": 127,
|
"start": 134,
|
||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 127,
|
"commentStart": 134,
|
||||||
"end": 144,
|
"end": 153,
|
||||||
"start": 127,
|
"start": 134,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"type": "LabeledArg",
|
"type": "LabeledArg",
|
||||||
"label": {
|
"label": {
|
||||||
"commentStart": 160,
|
"commentStart": 169,
|
||||||
"end": 166,
|
"end": 175,
|
||||||
"name": "length",
|
"name": "length",
|
||||||
"start": 160,
|
"start": 169,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"arg": {
|
"arg": {
|
||||||
"commentStart": 167,
|
"commentStart": 176,
|
||||||
"end": 169,
|
"end": 178,
|
||||||
"raw": "10",
|
"raw": "10",
|
||||||
"start": 167,
|
"start": 176,
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"value": {
|
"value": {
|
||||||
@ -357,29 +373,29 @@ expression: actual
|
|||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 152,
|
"commentStart": 161,
|
||||||
"end": 159,
|
"end": 168,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 152,
|
"commentStart": 161,
|
||||||
"end": 159,
|
"end": 168,
|
||||||
"name": "extrude",
|
"name": "extrude",
|
||||||
"start": 152,
|
"start": 161,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"path": [],
|
"path": [],
|
||||||
"start": 152,
|
"start": 161,
|
||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 152,
|
"commentStart": 161,
|
||||||
"end": 170,
|
"end": 179,
|
||||||
"start": 152,
|
"start": 161,
|
||||||
"type": "CallExpressionKw",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpressionKw",
|
"type": "CallExpressionKw",
|
||||||
"unlabeled": null
|
"unlabeled": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 12,
|
"commentStart": 12,
|
||||||
"end": 170,
|
"end": 179,
|
||||||
"start": 12,
|
"start": 12,
|
||||||
"type": "PipeExpression",
|
"type": "PipeExpression",
|
||||||
"type": "PipeExpression"
|
"type": "PipeExpression"
|
||||||
@ -387,7 +403,7 @@ expression: actual
|
|||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclarator"
|
"type": "VariableDeclarator"
|
||||||
},
|
},
|
||||||
"end": 170,
|
"end": 179,
|
||||||
"kind": "const",
|
"kind": "const",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
@ -395,6 +411,6 @@ expression: actual
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 171,
|
"end": 180,
|
||||||
"start": 0
|
"start": 0
|
||||||
}
|
}
|
||||||
|
@ -61,54 +61,57 @@ expression: actual
|
|||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"commentStart": 55,
|
"type": "LabeledArg",
|
||||||
"elements": [
|
"label": {
|
||||||
{
|
"commentStart": 53,
|
||||||
"commentStart": 56,
|
"end": 55,
|
||||||
"end": 57,
|
"name": "at",
|
||||||
"raw": "0",
|
"start": 53,
|
||||||
"start": 56,
|
"type": "Identifier"
|
||||||
"type": "Literal",
|
},
|
||||||
"type": "Literal",
|
"arg": {
|
||||||
"value": {
|
"commentStart": 58,
|
||||||
"value": 0.0,
|
"elements": [
|
||||||
"suffix": "None"
|
{
|
||||||
|
"commentStart": 59,
|
||||||
|
"end": 60,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 59,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 61,
|
||||||
|
"end": 62,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 61,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
],
|
||||||
{
|
"end": 63,
|
||||||
"commentStart": 58,
|
"start": 58,
|
||||||
"end": 59,
|
"type": "ArrayExpression",
|
||||||
"raw": "0",
|
"type": "ArrayExpression"
|
||||||
"start": 58,
|
}
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 0.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"end": 60,
|
|
||||||
"start": 55,
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 62,
|
|
||||||
"end": 63,
|
|
||||||
"start": 62,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 40,
|
"commentStart": 40,
|
||||||
"end": 54,
|
"end": 52,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 40,
|
"commentStart": 40,
|
||||||
"end": 54,
|
"end": 52,
|
||||||
"name": "startProfileAt",
|
"name": "startProfile",
|
||||||
"start": 40,
|
"start": 40,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
@ -119,8 +122,9 @@ expression: actual
|
|||||||
"commentStart": 40,
|
"commentStart": 40,
|
||||||
"end": 64,
|
"end": 64,
|
||||||
"start": 40,
|
"start": 40,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
|
@ -61,54 +61,57 @@ expression: actual
|
|||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"commentStart": 47,
|
"type": "LabeledArg",
|
||||||
"elements": [
|
"label": {
|
||||||
{
|
"commentStart": 45,
|
||||||
"commentStart": 48,
|
"end": 47,
|
||||||
"end": 49,
|
"name": "at",
|
||||||
"raw": "0",
|
"start": 45,
|
||||||
"start": 48,
|
"type": "Identifier"
|
||||||
"type": "Literal",
|
},
|
||||||
"type": "Literal",
|
"arg": {
|
||||||
"value": {
|
"commentStart": 50,
|
||||||
"value": 0.0,
|
"elements": [
|
||||||
"suffix": "None"
|
{
|
||||||
|
"commentStart": 51,
|
||||||
|
"end": 52,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 51,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 53,
|
||||||
|
"end": 54,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 53,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
],
|
||||||
{
|
"end": 55,
|
||||||
"commentStart": 50,
|
"start": 50,
|
||||||
"end": 51,
|
"type": "ArrayExpression",
|
||||||
"raw": "0",
|
"type": "ArrayExpression"
|
||||||
"start": 50,
|
}
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 0.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"end": 52,
|
|
||||||
"start": 47,
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 54,
|
|
||||||
"end": 55,
|
|
||||||
"start": 54,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 32,
|
"commentStart": 32,
|
||||||
"end": 46,
|
"end": 44,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 32,
|
"commentStart": 32,
|
||||||
"end": 46,
|
"end": 44,
|
||||||
"name": "startProfileAt",
|
"name": "startProfile",
|
||||||
"start": 32,
|
"start": 32,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
@ -119,8 +122,9 @@ expression: actual
|
|||||||
"commentStart": 32,
|
"commentStart": 32,
|
||||||
"end": 56,
|
"end": 56,
|
||||||
"start": 32,
|
"start": 32,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
|
@ -61,37 +61,40 @@ expression: actual
|
|||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"abs_path": false,
|
"type": "LabeledArg",
|
||||||
"commentStart": 44,
|
"label": {
|
||||||
"end": 45,
|
"commentStart": 42,
|
||||||
"name": {
|
"end": 44,
|
||||||
"commentStart": 44,
|
"name": "at",
|
||||||
"end": 45,
|
"start": 42,
|
||||||
"name": "p",
|
|
||||||
"start": 44,
|
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"path": [],
|
"arg": {
|
||||||
"start": 44,
|
"abs_path": false,
|
||||||
"type": "Name",
|
"commentStart": 47,
|
||||||
"type": "Name"
|
"end": 48,
|
||||||
},
|
"name": {
|
||||||
{
|
"commentStart": 47,
|
||||||
"commentStart": 47,
|
"end": 48,
|
||||||
"end": 48,
|
"name": "p",
|
||||||
"start": 47,
|
"start": 47,
|
||||||
"type": "PipeSubstitution",
|
"type": "Identifier"
|
||||||
"type": "PipeSubstitution"
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 47,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 29,
|
"commentStart": 29,
|
||||||
"end": 43,
|
"end": 41,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 29,
|
"commentStart": 29,
|
||||||
"end": 43,
|
"end": 41,
|
||||||
"name": "startProfileAt",
|
"name": "startProfile",
|
||||||
"start": 29,
|
"start": 29,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
@ -102,8 +105,9 @@ expression: actual
|
|||||||
"commentStart": 29,
|
"commentStart": 29,
|
||||||
"end": 49,
|
"end": 49,
|
||||||
"start": 29,
|
"start": 29,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 8,
|
"commentStart": 8,
|
||||||
|
@ -8,7 +8,7 @@ expression: actual
|
|||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"declaration": {
|
"declaration": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 23,
|
"end": 20,
|
||||||
"id": {
|
"id": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 5,
|
"end": 5,
|
||||||
@ -67,13 +67,6 @@ expression: actual
|
|||||||
"value": 2.0,
|
"value": 2.0,
|
||||||
"suffix": "None"
|
"suffix": "None"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 21,
|
|
||||||
"end": 22,
|
|
||||||
"start": 21,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
@ -92,14 +85,14 @@ expression: actual
|
|||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 16,
|
"commentStart": 16,
|
||||||
"end": 23,
|
"end": 20,
|
||||||
"start": 16,
|
"start": 16,
|
||||||
"type": "CallExpression",
|
"type": "CallExpression",
|
||||||
"type": "CallExpression"
|
"type": "CallExpression"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 8,
|
"commentStart": 8,
|
||||||
"end": 23,
|
"end": 20,
|
||||||
"start": 8,
|
"start": 8,
|
||||||
"type": "PipeExpression",
|
"type": "PipeExpression",
|
||||||
"type": "PipeExpression"
|
"type": "PipeExpression"
|
||||||
@ -107,7 +100,7 @@ expression: actual
|
|||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclarator"
|
"type": "VariableDeclarator"
|
||||||
},
|
},
|
||||||
"end": 23,
|
"end": 20,
|
||||||
"kind": "const",
|
"kind": "const",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
@ -115,6 +108,6 @@ expression: actual
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 23,
|
"end": 20,
|
||||||
"start": 0
|
"start": 0
|
||||||
}
|
}
|
||||||
|
@ -61,37 +61,40 @@ expression: actual
|
|||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"abs_path": false,
|
"type": "LabeledArg",
|
||||||
"commentStart": 44,
|
"label": {
|
||||||
"end": 45,
|
"commentStart": 42,
|
||||||
"name": {
|
"end": 44,
|
||||||
"commentStart": 44,
|
"name": "at",
|
||||||
"end": 45,
|
"start": 42,
|
||||||
"name": "p",
|
|
||||||
"start": 44,
|
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"path": [],
|
"arg": {
|
||||||
"start": 44,
|
"abs_path": false,
|
||||||
"type": "Name",
|
"commentStart": 47,
|
||||||
"type": "Name"
|
"end": 48,
|
||||||
},
|
"name": {
|
||||||
{
|
"commentStart": 47,
|
||||||
"commentStart": 47,
|
"end": 48,
|
||||||
"end": 48,
|
"name": "p",
|
||||||
"start": 47,
|
"start": 47,
|
||||||
"type": "PipeSubstitution",
|
"type": "Identifier"
|
||||||
"type": "PipeSubstitution"
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 47,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 29,
|
"commentStart": 29,
|
||||||
"end": 43,
|
"end": 41,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 29,
|
"commentStart": 29,
|
||||||
"end": 43,
|
"end": 41,
|
||||||
"name": "startProfileAt",
|
"name": "startProfile",
|
||||||
"start": 29,
|
"start": 29,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
@ -102,8 +105,9 @@ expression: actual
|
|||||||
"commentStart": 29,
|
"commentStart": 29,
|
||||||
"end": 49,
|
"end": 49,
|
||||||
"start": 29,
|
"start": 29,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
|
@ -61,54 +61,57 @@ expression: actual
|
|||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"commentStart": 47,
|
"type": "LabeledArg",
|
||||||
"elements": [
|
"label": {
|
||||||
{
|
"commentStart": 45,
|
||||||
"commentStart": 48,
|
"end": 47,
|
||||||
"end": 49,
|
"name": "at",
|
||||||
"raw": "0",
|
"start": 45,
|
||||||
"start": 48,
|
"type": "Identifier"
|
||||||
"type": "Literal",
|
},
|
||||||
"type": "Literal",
|
"arg": {
|
||||||
"value": {
|
"commentStart": 50,
|
||||||
"value": 0.0,
|
"elements": [
|
||||||
"suffix": "None"
|
{
|
||||||
|
"commentStart": 51,
|
||||||
|
"end": 52,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 51,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commentStart": 53,
|
||||||
|
"end": 54,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 53,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
],
|
||||||
{
|
"end": 55,
|
||||||
"commentStart": 50,
|
"start": 50,
|
||||||
"end": 51,
|
"type": "ArrayExpression",
|
||||||
"raw": "0",
|
"type": "ArrayExpression"
|
||||||
"start": 50,
|
}
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 0.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"end": 52,
|
|
||||||
"start": 47,
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 54,
|
|
||||||
"end": 55,
|
|
||||||
"start": 54,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 32,
|
"commentStart": 32,
|
||||||
"end": 46,
|
"end": 44,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 32,
|
"commentStart": 32,
|
||||||
"end": 46,
|
"end": 44,
|
||||||
"name": "startProfileAt",
|
"name": "startProfile",
|
||||||
"start": 32,
|
"start": 32,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
@ -119,8 +122,9 @@ expression: actual
|
|||||||
"commentStart": 32,
|
"commentStart": 32,
|
||||||
"end": 56,
|
"end": 56,
|
||||||
"start": 32,
|
"start": 32,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 11,
|
"commentStart": 11,
|
||||||
|
@ -6,45 +6,75 @@ expression: actual
|
|||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 28,
|
"end": 46,
|
||||||
"expression": {
|
"expression": {
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"commentStart": 4,
|
"type": "LabeledArg",
|
||||||
"end": 5,
|
"label": {
|
||||||
"raw": "5",
|
"commentStart": 4,
|
||||||
"start": 4,
|
"end": 10,
|
||||||
"type": "Literal",
|
"name": "number",
|
||||||
"type": "Literal",
|
"start": 4,
|
||||||
"value": {
|
"type": "Identifier"
|
||||||
"value": 5.0,
|
},
|
||||||
"suffix": "None"
|
"arg": {
|
||||||
|
"commentStart": 13,
|
||||||
|
"end": 14,
|
||||||
|
"raw": "5",
|
||||||
|
"start": 13,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 5.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"commentStart": 7,
|
"type": "LabeledArg",
|
||||||
"end": 14,
|
"label": {
|
||||||
"raw": "\"hello\"",
|
|
||||||
"start": 7,
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": "hello"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"abs_path": false,
|
|
||||||
"commentStart": 16,
|
|
||||||
"end": 27,
|
|
||||||
"name": {
|
|
||||||
"commentStart": 16,
|
"commentStart": 16,
|
||||||
"end": 27,
|
"end": 19,
|
||||||
"name": "aIdentifier",
|
"name": "msg",
|
||||||
"start": 16,
|
"start": 16,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"path": [],
|
"arg": {
|
||||||
"start": 16,
|
"commentStart": 22,
|
||||||
"type": "Name",
|
"end": 29,
|
||||||
"type": "Name"
|
"raw": "\"hello\"",
|
||||||
|
"start": 22,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": "hello"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 31,
|
||||||
|
"end": 33,
|
||||||
|
"name": "id",
|
||||||
|
"start": 31,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 34,
|
||||||
|
"end": 45,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 34,
|
||||||
|
"end": 45,
|
||||||
|
"name": "aIdentifier",
|
||||||
|
"start": 34,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 34,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
@ -63,10 +93,11 @@ expression: actual
|
|||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 28,
|
"end": 46,
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
},
|
},
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "ExpressionStatement",
|
"type": "ExpressionStatement",
|
||||||
@ -74,6 +105,6 @@ expression: actual
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 28,
|
"end": 46,
|
||||||
"start": 0
|
"start": 0
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ expression: actual
|
|||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 15,
|
"end": 12,
|
||||||
"expression": {
|
"expression": {
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
@ -45,13 +45,6 @@ expression: actual
|
|||||||
"start": 5,
|
"start": 5,
|
||||||
"type": "ArrayExpression",
|
"type": "ArrayExpression",
|
||||||
"type": "ArrayExpression"
|
"type": "ArrayExpression"
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 13,
|
|
||||||
"end": 14,
|
|
||||||
"start": 13,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
@ -70,7 +63,7 @@ expression: actual
|
|||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 15,
|
"end": 12,
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "CallExpression",
|
"type": "CallExpression",
|
||||||
"type": "CallExpression"
|
"type": "CallExpression"
|
||||||
@ -81,6 +74,6 @@ expression: actual
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 15,
|
"end": 12,
|
||||||
"start": 0
|
"start": 0
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ expression: actual
|
|||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"declaration": {
|
"declaration": {
|
||||||
"commentStart": 3,
|
"commentStart": 3,
|
||||||
"end": 43,
|
"end": 59,
|
||||||
"id": {
|
"id": {
|
||||||
"commentStart": 3,
|
"commentStart": 3,
|
||||||
"end": 4,
|
"end": 4,
|
||||||
@ -23,31 +23,51 @@ expression: actual
|
|||||||
"argument": {
|
"argument": {
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"abs_path": false,
|
"type": "LabeledArg",
|
||||||
"commentStart": 30,
|
"label": {
|
||||||
"end": 35,
|
|
||||||
"name": {
|
|
||||||
"commentStart": 30,
|
"commentStart": 30,
|
||||||
"end": 35,
|
"end": 35,
|
||||||
"name": "angle",
|
"name": "maybe",
|
||||||
"start": 30,
|
"start": 30,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"path": [],
|
"arg": {
|
||||||
"start": 30,
|
"abs_path": false,
|
||||||
"type": "Name",
|
"commentStart": 36,
|
||||||
"type": "Name"
|
"end": 41,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 36,
|
||||||
|
"end": 41,
|
||||||
|
"name": "angle",
|
||||||
|
"start": 36,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 36,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"commentStart": 37,
|
"type": "LabeledArg",
|
||||||
"end": 40,
|
"label": {
|
||||||
"raw": "360",
|
"commentStart": 43,
|
||||||
"start": 37,
|
"end": 52,
|
||||||
"type": "Literal",
|
"name": "otherwise",
|
||||||
"type": "Literal",
|
"start": 43,
|
||||||
"value": {
|
"type": "Identifier"
|
||||||
"value": 360.0,
|
},
|
||||||
"suffix": "None"
|
"arg": {
|
||||||
|
"commentStart": 53,
|
||||||
|
"end": 56,
|
||||||
|
"raw": "360",
|
||||||
|
"start": 53,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 360.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -67,24 +87,25 @@ expression: actual
|
|||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 22,
|
"commentStart": 22,
|
||||||
"end": 41,
|
"end": 57,
|
||||||
"start": 22,
|
"start": 22,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
},
|
},
|
||||||
"commentStart": 15,
|
"commentStart": 15,
|
||||||
"end": 41,
|
"end": 57,
|
||||||
"start": 15,
|
"start": 15,
|
||||||
"type": "ReturnStatement",
|
"type": "ReturnStatement",
|
||||||
"type": "ReturnStatement"
|
"type": "ReturnStatement"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 13,
|
"commentStart": 13,
|
||||||
"end": 43,
|
"end": 59,
|
||||||
"start": 13
|
"start": 13
|
||||||
},
|
},
|
||||||
"commentStart": 4,
|
"commentStart": 4,
|
||||||
"end": 43,
|
"end": 59,
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
"type": "Parameter",
|
"type": "Parameter",
|
||||||
@ -109,7 +130,7 @@ expression: actual
|
|||||||
"start": 3,
|
"start": 3,
|
||||||
"type": "VariableDeclarator"
|
"type": "VariableDeclarator"
|
||||||
},
|
},
|
||||||
"end": 43,
|
"end": 59,
|
||||||
"kind": "fn",
|
"kind": "fn",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
@ -117,6 +138,6 @@ expression: actual
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 43,
|
"end": 59,
|
||||||
"start": 0
|
"start": 0
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ expression: actual
|
|||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"declaration": {
|
"declaration": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 30,
|
"end": 36,
|
||||||
"id": {
|
"id": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 5,
|
"end": 5,
|
||||||
@ -19,72 +19,102 @@ expression: actual
|
|||||||
"init": {
|
"init": {
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"commentStart": 12,
|
"type": "LabeledArg",
|
||||||
"end": 13,
|
"label": {
|
||||||
"raw": "5",
|
"commentStart": 12,
|
||||||
"start": 12,
|
"end": 13,
|
||||||
"type": "Literal",
|
"name": "x",
|
||||||
"type": "Literal",
|
"start": 12,
|
||||||
"value": {
|
"type": "Identifier"
|
||||||
"value": 5.0,
|
},
|
||||||
"suffix": "None"
|
"arg": {
|
||||||
|
"commentStart": 14,
|
||||||
|
"end": 15,
|
||||||
|
"raw": "5",
|
||||||
|
"start": 14,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 5.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"argument": {
|
"type": "LabeledArg",
|
||||||
"arguments": [
|
"label": {
|
||||||
{
|
"commentStart": 18,
|
||||||
"commentStart": 24,
|
"end": 19,
|
||||||
"end": 25,
|
"name": "y",
|
||||||
|
"start": 18,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"argument": {
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 31,
|
||||||
|
"end": 32,
|
||||||
|
"name": "z",
|
||||||
|
"start": 31,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 33,
|
||||||
|
"end": 34,
|
||||||
|
"raw": "4",
|
||||||
|
"start": 33,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 4.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 21,
|
||||||
|
"end": 27,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 21,
|
||||||
|
"end": 27,
|
||||||
|
"name": "legLen",
|
||||||
|
"start": 21,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 21,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 21,
|
||||||
|
"end": 35,
|
||||||
|
"start": 21,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"commentStart": 28,
|
||||||
|
"end": 29,
|
||||||
"raw": "5",
|
"raw": "5",
|
||||||
"start": 24,
|
"start": 28,
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"value": {
|
"value": {
|
||||||
"value": 5.0,
|
"value": 5.0,
|
||||||
"suffix": "None"
|
"suffix": "None"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 27,
|
|
||||||
"end": 28,
|
|
||||||
"raw": "4",
|
|
||||||
"start": 27,
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 4.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"callee": {
|
|
||||||
"abs_path": false,
|
|
||||||
"commentStart": 17,
|
|
||||||
"end": 23,
|
|
||||||
"name": {
|
|
||||||
"commentStart": 17,
|
|
||||||
"end": 23,
|
|
||||||
"name": "legLen",
|
|
||||||
"start": 17,
|
|
||||||
"type": "Identifier"
|
|
||||||
},
|
|
||||||
"path": [],
|
|
||||||
"start": 17,
|
|
||||||
"type": "Name"
|
|
||||||
},
|
},
|
||||||
"commentStart": 17,
|
"commentStart": 20,
|
||||||
"end": 29,
|
"end": 35,
|
||||||
"start": 17,
|
"operator": "-",
|
||||||
"type": "CallExpression",
|
"start": 20,
|
||||||
"type": "CallExpression"
|
"type": "UnaryExpression",
|
||||||
},
|
"type": "UnaryExpression"
|
||||||
"commentStart": 16,
|
}
|
||||||
"end": 29,
|
|
||||||
"operator": "-",
|
|
||||||
"start": 16,
|
|
||||||
"type": "UnaryExpression",
|
|
||||||
"type": "UnaryExpression"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
@ -103,15 +133,16 @@ expression: actual
|
|||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 8,
|
"commentStart": 8,
|
||||||
"end": 30,
|
"end": 36,
|
||||||
"start": 8,
|
"start": 8,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
},
|
},
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclarator"
|
"type": "VariableDeclarator"
|
||||||
},
|
},
|
||||||
"end": 30,
|
"end": 36,
|
||||||
"kind": "const",
|
"kind": "const",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
@ -119,6 +150,6 @@ expression: actual
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 30,
|
"end": 36,
|
||||||
"start": 0
|
"start": 0
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ expression: actual
|
|||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"declaration": {
|
"declaration": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 29,
|
"end": 37,
|
||||||
"id": {
|
"id": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 5,
|
"end": 5,
|
||||||
@ -19,71 +19,112 @@ expression: actual
|
|||||||
"init": {
|
"init": {
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"argument": {
|
"type": "LabeledArg",
|
||||||
"arguments": [
|
"label": {
|
||||||
{
|
"commentStart": 12,
|
||||||
"commentStart": 20,
|
"end": 13,
|
||||||
"end": 21,
|
"name": "x",
|
||||||
"raw": "5",
|
"start": 12,
|
||||||
"start": 20,
|
"type": "Identifier"
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 5.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 23,
|
|
||||||
"end": 24,
|
|
||||||
"raw": "4",
|
|
||||||
"start": 23,
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 4.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"callee": {
|
|
||||||
"abs_path": false,
|
|
||||||
"commentStart": 13,
|
|
||||||
"end": 19,
|
|
||||||
"name": {
|
|
||||||
"commentStart": 13,
|
|
||||||
"end": 19,
|
|
||||||
"name": "legLen",
|
|
||||||
"start": 13,
|
|
||||||
"type": "Identifier"
|
|
||||||
},
|
|
||||||
"path": [],
|
|
||||||
"start": 13,
|
|
||||||
"type": "Name"
|
|
||||||
},
|
|
||||||
"commentStart": 13,
|
|
||||||
"end": 25,
|
|
||||||
"start": 13,
|
|
||||||
"type": "CallExpression",
|
|
||||||
"type": "CallExpression"
|
|
||||||
},
|
},
|
||||||
"commentStart": 12,
|
"arg": {
|
||||||
"end": 25,
|
"argument": {
|
||||||
"operator": "-",
|
"arguments": [
|
||||||
"start": 12,
|
{
|
||||||
"type": "UnaryExpression",
|
"type": "LabeledArg",
|
||||||
"type": "UnaryExpression"
|
"label": {
|
||||||
|
"commentStart": 22,
|
||||||
|
"end": 23,
|
||||||
|
"name": "a",
|
||||||
|
"start": 22,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 24,
|
||||||
|
"end": 25,
|
||||||
|
"raw": "5",
|
||||||
|
"start": 24,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 5.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"commentStart": 27,
|
||||||
|
"end": 28,
|
||||||
|
"name": "b",
|
||||||
|
"start": 27,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"commentStart": 29,
|
||||||
|
"end": 30,
|
||||||
|
"raw": "4",
|
||||||
|
"start": 29,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 4.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 15,
|
||||||
|
"end": 21,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 15,
|
||||||
|
"end": 21,
|
||||||
|
"name": "legLen",
|
||||||
|
"start": 15,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 15,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 15,
|
||||||
|
"end": 31,
|
||||||
|
"start": 15,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
"commentStart": 14,
|
||||||
|
"end": 31,
|
||||||
|
"operator": "-",
|
||||||
|
"start": 14,
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnaryExpression"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"commentStart": 27,
|
"type": "LabeledArg",
|
||||||
"end": 28,
|
"label": {
|
||||||
"raw": "5",
|
"commentStart": 33,
|
||||||
"start": 27,
|
"end": 34,
|
||||||
"type": "Literal",
|
"name": "y",
|
||||||
"type": "Literal",
|
"start": 33,
|
||||||
"value": {
|
"type": "Identifier"
|
||||||
"value": 5.0,
|
},
|
||||||
"suffix": "None"
|
"arg": {
|
||||||
|
"commentStart": 35,
|
||||||
|
"end": 36,
|
||||||
|
"raw": "5",
|
||||||
|
"start": 35,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 5.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -103,15 +144,16 @@ expression: actual
|
|||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 8,
|
"commentStart": 8,
|
||||||
"end": 29,
|
"end": 37,
|
||||||
"start": 8,
|
"start": 8,
|
||||||
"type": "CallExpression",
|
"type": "CallExpressionKw",
|
||||||
"type": "CallExpression"
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
},
|
},
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclarator"
|
"type": "VariableDeclarator"
|
||||||
},
|
},
|
||||||
"end": 29,
|
"end": 37,
|
||||||
"kind": "const",
|
"kind": "const",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
@ -119,6 +161,6 @@ expression: actual
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 29,
|
"end": 37,
|
||||||
"start": 0
|
"start": 0
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ expression: actual
|
|||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"declaration": {
|
"declaration": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 30,
|
"end": 27,
|
||||||
"id": {
|
"id": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 5,
|
"end": 5,
|
||||||
@ -63,13 +63,6 @@ expression: actual
|
|||||||
"value": 45.0,
|
"value": 45.0,
|
||||||
"suffix": "None"
|
"suffix": "None"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 28,
|
|
||||||
"end": 29,
|
|
||||||
"start": 28,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
@ -88,14 +81,14 @@ expression: actual
|
|||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 17,
|
"commentStart": 17,
|
||||||
"end": 30,
|
"end": 27,
|
||||||
"start": 17,
|
"start": 17,
|
||||||
"type": "CallExpression",
|
"type": "CallExpression",
|
||||||
"type": "CallExpression"
|
"type": "CallExpression"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 8,
|
"commentStart": 8,
|
||||||
"end": 30,
|
"end": 27,
|
||||||
"start": 8,
|
"start": 8,
|
||||||
"type": "PipeExpression",
|
"type": "PipeExpression",
|
||||||
"type": "PipeExpression"
|
"type": "PipeExpression"
|
||||||
@ -103,7 +96,7 @@ expression: actual
|
|||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclarator"
|
"type": "VariableDeclarator"
|
||||||
},
|
},
|
||||||
"end": 30,
|
"end": 27,
|
||||||
"kind": "const",
|
"kind": "const",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
@ -111,6 +104,6 @@ expression: actual
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 30,
|
"end": 27,
|
||||||
"start": 0
|
"start": 0
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ expression: actual
|
|||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"declaration": {
|
"declaration": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 48,
|
"end": 43,
|
||||||
"id": {
|
"id": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 2,
|
"end": 2,
|
||||||
@ -62,36 +62,29 @@ expression: actual
|
|||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 41,
|
"commentStart": 39,
|
||||||
"end": 44,
|
"end": 42,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 41,
|
"commentStart": 39,
|
||||||
"end": 44,
|
"end": 42,
|
||||||
"name": "pos",
|
"name": "pos",
|
||||||
"start": 41,
|
"start": 39,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"path": [],
|
"path": [],
|
||||||
"start": 41,
|
"start": 39,
|
||||||
"type": "Name",
|
"type": "Name",
|
||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 46,
|
|
||||||
"end": 47,
|
|
||||||
"start": 46,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 26,
|
"commentStart": 26,
|
||||||
"end": 40,
|
"end": 38,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 26,
|
"commentStart": 26,
|
||||||
"end": 40,
|
"end": 38,
|
||||||
"name": "startProfileAt",
|
"name": "startProfile",
|
||||||
"start": 26,
|
"start": 26,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
@ -100,14 +93,14 @@ expression: actual
|
|||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 26,
|
"commentStart": 26,
|
||||||
"end": 48,
|
"end": 43,
|
||||||
"start": 26,
|
"start": 26,
|
||||||
"type": "CallExpression",
|
"type": "CallExpression",
|
||||||
"type": "CallExpression"
|
"type": "CallExpression"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 5,
|
"commentStart": 5,
|
||||||
"end": 48,
|
"end": 43,
|
||||||
"start": 5,
|
"start": 5,
|
||||||
"type": "PipeExpression",
|
"type": "PipeExpression",
|
||||||
"type": "PipeExpression"
|
"type": "PipeExpression"
|
||||||
@ -115,7 +108,7 @@ expression: actual
|
|||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclarator"
|
"type": "VariableDeclarator"
|
||||||
},
|
},
|
||||||
"end": 48,
|
"end": 43,
|
||||||
"kind": "const",
|
"kind": "const",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
@ -123,6 +116,6 @@ expression: actual
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 48,
|
"end": 43,
|
||||||
"start": 0
|
"start": 0
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ expression: actual
|
|||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"declaration": {
|
"declaration": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 73,
|
"end": 68,
|
||||||
"id": {
|
"id": {
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 2,
|
"end": 2,
|
||||||
@ -62,17 +62,17 @@ expression: actual
|
|||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 45,
|
"commentStart": 43,
|
||||||
"end": 48,
|
"end": 46,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 45,
|
"commentStart": 43,
|
||||||
"end": 48,
|
"end": 46,
|
||||||
"name": "pos",
|
"name": "pos",
|
||||||
"start": 45,
|
"start": 43,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"path": [],
|
"path": [],
|
||||||
"start": 45,
|
"start": 43,
|
||||||
"type": "Name",
|
"type": "Name",
|
||||||
"type": "Name"
|
"type": "Name"
|
||||||
}
|
}
|
||||||
@ -80,11 +80,11 @@ expression: actual
|
|||||||
"callee": {
|
"callee": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 30,
|
"commentStart": 30,
|
||||||
"end": 44,
|
"end": 42,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 30,
|
"commentStart": 30,
|
||||||
"end": 44,
|
"end": 42,
|
||||||
"name": "startProfileAt",
|
"name": "startProfile",
|
||||||
"start": 30,
|
"start": 30,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
@ -93,7 +93,7 @@ expression: actual
|
|||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 30,
|
"commentStart": 30,
|
||||||
"end": 49,
|
"end": 47,
|
||||||
"start": 30,
|
"start": 30,
|
||||||
"type": "CallExpression",
|
"type": "CallExpression",
|
||||||
"type": "CallExpression"
|
"type": "CallExpression"
|
||||||
@ -101,13 +101,13 @@ expression: actual
|
|||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"commentStart": 58,
|
"commentStart": 56,
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"commentStart": 59,
|
"commentStart": 57,
|
||||||
"end": 60,
|
"end": 58,
|
||||||
"raw": "0",
|
"raw": "0",
|
||||||
"start": 59,
|
"start": 57,
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"value": {
|
"value": {
|
||||||
@ -118,65 +118,58 @@ expression: actual
|
|||||||
{
|
{
|
||||||
"argument": {
|
"argument": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 63,
|
"commentStart": 61,
|
||||||
"end": 68,
|
"end": 66,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 63,
|
"commentStart": 61,
|
||||||
"end": 68,
|
"end": 66,
|
||||||
"name": "scale",
|
"name": "scale",
|
||||||
"start": 63,
|
"start": 61,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"path": [],
|
"path": [],
|
||||||
"start": 63,
|
"start": 61,
|
||||||
"type": "Name",
|
"type": "Name",
|
||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 62,
|
"commentStart": 60,
|
||||||
"end": 68,
|
"end": 66,
|
||||||
"operator": "-",
|
"operator": "-",
|
||||||
"start": 62,
|
"start": 60,
|
||||||
"type": "UnaryExpression",
|
"type": "UnaryExpression",
|
||||||
"type": "UnaryExpression"
|
"type": "UnaryExpression"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"end": 69,
|
"end": 67,
|
||||||
"start": 58,
|
"start": 56,
|
||||||
"type": "ArrayExpression",
|
"type": "ArrayExpression",
|
||||||
"type": "ArrayExpression"
|
"type": "ArrayExpression"
|
||||||
},
|
|
||||||
{
|
|
||||||
"commentStart": 71,
|
|
||||||
"end": 72,
|
|
||||||
"start": 71,
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"callee": {
|
"callee": {
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 53,
|
"commentStart": 51,
|
||||||
"end": 57,
|
"end": 55,
|
||||||
"name": {
|
"name": {
|
||||||
"commentStart": 53,
|
"commentStart": 51,
|
||||||
"end": 57,
|
"end": 55,
|
||||||
"name": "line",
|
"name": "line",
|
||||||
"start": 53,
|
"start": 51,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
},
|
},
|
||||||
"path": [],
|
"path": [],
|
||||||
"start": 53,
|
"start": 51,
|
||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
},
|
||||||
"commentStart": 53,
|
"commentStart": 51,
|
||||||
"end": 73,
|
"end": 68,
|
||||||
"start": 53,
|
"start": 51,
|
||||||
"type": "CallExpression",
|
"type": "CallExpression",
|
||||||
"type": "CallExpression"
|
"type": "CallExpression"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 5,
|
"commentStart": 5,
|
||||||
"end": 73,
|
"end": 68,
|
||||||
"start": 5,
|
"start": 5,
|
||||||
"type": "PipeExpression",
|
"type": "PipeExpression",
|
||||||
"type": "PipeExpression"
|
"type": "PipeExpression"
|
||||||
@ -184,7 +177,7 @@ expression: actual
|
|||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclarator"
|
"type": "VariableDeclarator"
|
||||||
},
|
},
|
||||||
"end": 73,
|
"end": 68,
|
||||||
"kind": "const",
|
"kind": "const",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
@ -192,6 +185,6 @@ expression: actual
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 73,
|
"end": 68,
|
||||||
"start": 0
|
"start": 0
|
||||||
}
|
}
|
||||||
|
@ -282,6 +282,7 @@ fn assert_common_snapshots(
|
|||||||
insta::assert_json_snapshot!("ops", operations, {
|
insta::assert_json_snapshot!("ops", operations, {
|
||||||
"[].unlabeledArg.*.value.**[].from[]" => rounded_redaction(4),
|
"[].unlabeledArg.*.value.**[].from[]" => rounded_redaction(4),
|
||||||
"[].unlabeledArg.*.value.**[].to[]" => rounded_redaction(4),
|
"[].unlabeledArg.*.value.**[].to[]" => rounded_redaction(4),
|
||||||
|
"[].*.unlabeledArg.value.value" => rounded_redaction(4),
|
||||||
"[].labeledArgs.*.value.**[].from[]" => rounded_redaction(4),
|
"[].labeledArgs.*.value.**[].from[]" => rounded_redaction(4),
|
||||||
"[].labeledArgs.*.value.**[].to[]" => rounded_redaction(4),
|
"[].labeledArgs.*.value.**[].to[]" => rounded_redaction(4),
|
||||||
".**.sourceRange" => Vec::new(),
|
".**.sourceRange" => Vec::new(),
|
||||||
|
@ -51,6 +51,7 @@ async fn unparse_test(test: &Test) {
|
|||||||
.map(|file| {
|
.map(|file| {
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let contents = tokio::fs::read_to_string(&file).await.unwrap();
|
let contents = tokio::fs::read_to_string(&file).await.unwrap();
|
||||||
|
eprintln!("{}", file.display());
|
||||||
let program = crate::Program::parse_no_errs(&contents).unwrap();
|
let program = crate::Program::parse_no_errs(&contents).unwrap();
|
||||||
let recast = program.recast_with_options(&Default::default());
|
let recast = program.recast_with_options(&Default::default());
|
||||||
|
|
||||||
|
@ -91,9 +91,9 @@ pub async fn appearance(exec_state: &mut ExecState, args: Args) -> Result<KclVal
|
|||||||
/// |> extrude(length = 10)
|
/// |> extrude(length = 10)
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// example0 = cube([0, 0])
|
/// example0 = cube(center = [0, 0])
|
||||||
/// example1 = cube([20, 0])
|
/// example1 = cube(center = [20, 0])
|
||||||
/// example2 = cube([40, 0])
|
/// example2 = cube(center = [40, 0])
|
||||||
///
|
///
|
||||||
/// appearance([example0, example1], color='#ff0000', metalness=50, roughness=50)
|
/// appearance([example0, example1], color='#ff0000', metalness=50, roughness=50)
|
||||||
/// appearance(example2, color='#00ff00', metalness=50, roughness=50)
|
/// appearance(example2, color='#00ff00', metalness=50, roughness=50)
|
||||||
|
@ -26,7 +26,7 @@ pub async fn map(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
|||||||
/// `[f(a), f(b), f(c)]`
|
/// `[f(a), f(b), f(c)]`
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// r = 10 // radius
|
/// r = 10 // radius
|
||||||
/// fn drawCircle(id) {
|
/// fn drawCircle(@id) {
|
||||||
/// return startSketchOn(XY)
|
/// return startSketchOn(XY)
|
||||||
/// |> circle( center= [id * 2 * r, 0], radius= r)
|
/// |> circle( center= [id * 2 * r, 0], radius= r)
|
||||||
/// }
|
/// }
|
||||||
@ -110,7 +110,7 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
|||||||
/// // This function adds an array of numbers.
|
/// // This function adds an array of numbers.
|
||||||
/// // It uses the `reduce` function, to call the `add` function on every
|
/// // It uses the `reduce` function, to call the `add` function on every
|
||||||
/// // element of the `arr` parameter. The starting value is 0.
|
/// // element of the `arr` parameter. The starting value is 0.
|
||||||
/// fn sum(arr) { return reduce(arr, initial = 0, f = add) }
|
/// fn sum(@arr) { return reduce(arr, initial = 0, f = add) }
|
||||||
///
|
///
|
||||||
/// /*
|
/// /*
|
||||||
/// The above is basically like this pseudo-code:
|
/// The above is basically like this pseudo-code:
|
||||||
@ -138,7 +138,7 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
|||||||
/// ```
|
/// ```
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// // Declare a function that sketches a decagon.
|
/// // Declare a function that sketches a decagon.
|
||||||
/// fn decagon(radius) {
|
/// fn decagon(@radius) {
|
||||||
/// // Each side of the decagon is turned this many radians from the previous angle.
|
/// // Each side of the decagon is turned this many radians from the previous angle.
|
||||||
/// stepAngle = ((1/10) * TAU): number(rad)
|
/// stepAngle = ((1/10) * TAU): number(rad)
|
||||||
///
|
///
|
||||||
|
@ -49,8 +49,8 @@ pub async fn union(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
|||||||
/// |> extrude(length = 10)
|
/// |> extrude(length = 10)
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// part001 = cube([0, 0], 10)
|
/// part001 = cube(center = [0, 0], size = 10)
|
||||||
/// part002 = cube([7, 3], 5)
|
/// part002 = cube(center = [7, 3], size = 5)
|
||||||
/// |> translate(z = 1)
|
/// |> translate(z = 1)
|
||||||
///
|
///
|
||||||
/// unionedPart = union([part001, part002])
|
/// unionedPart = union([part001, part002])
|
||||||
@ -71,8 +71,8 @@ pub async fn union(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
|||||||
/// |> extrude(length = 10)
|
/// |> extrude(length = 10)
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// part001 = cube([0, 0], 10)
|
/// part001 = cube(center = [0, 0], size = 10)
|
||||||
/// part002 = cube([7, 3], 5)
|
/// part002 = cube(center = [7, 3], size = 5)
|
||||||
/// |> translate(z = 1)
|
/// |> translate(z = 1)
|
||||||
///
|
///
|
||||||
/// // This is the equivalent of: union([part001, part002])
|
/// // This is the equivalent of: union([part001, part002])
|
||||||
@ -94,8 +94,8 @@ pub async fn union(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
|||||||
/// |> extrude(length = 10)
|
/// |> extrude(length = 10)
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// part001 = cube([0, 0], 10)
|
/// part001 = cube(center = [0, 0], size = 10)
|
||||||
/// part002 = cube([7, 3], 5)
|
/// part002 = cube(center = [7, 3], size = 5)
|
||||||
/// |> translate(z = 1)
|
/// |> translate(z = 1)
|
||||||
///
|
///
|
||||||
/// // This is the equivalent of: union([part001, part002])
|
/// // This is the equivalent of: union([part001, part002])
|
||||||
@ -199,8 +199,8 @@ pub async fn intersect(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
|||||||
/// |> extrude(length = 10)
|
/// |> extrude(length = 10)
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// part001 = cube([0, 0], 10)
|
/// part001 = cube(center = [0, 0], size = 10)
|
||||||
/// part002 = cube([7, 3], 5)
|
/// part002 = cube(center = [7, 3], size = 5)
|
||||||
/// |> translate(z = 1)
|
/// |> translate(z = 1)
|
||||||
///
|
///
|
||||||
/// intersectedPart = intersect([part001, part002])
|
/// intersectedPart = intersect([part001, part002])
|
||||||
@ -221,8 +221,8 @@ pub async fn intersect(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
|||||||
/// |> extrude(length = 10)
|
/// |> extrude(length = 10)
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// part001 = cube([0, 0], 10)
|
/// part001 = cube(center = [0, 0], size = 10)
|
||||||
/// part002 = cube([7, 3], 5)
|
/// part002 = cube(center = [7, 3], size = 5)
|
||||||
/// |> translate(z = 1)
|
/// |> translate(z = 1)
|
||||||
///
|
///
|
||||||
/// // This is the equivalent of: intersect([part001, part002])
|
/// // This is the equivalent of: intersect([part001, part002])
|
||||||
@ -332,8 +332,8 @@ pub async fn subtract(exec_state: &mut ExecState, args: Args) -> Result<KclValue
|
|||||||
/// |> extrude(length = 10)
|
/// |> extrude(length = 10)
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// part001 = cube([0, 0], 10)
|
/// part001 = cube(center = [0, 0], size = 10)
|
||||||
/// part002 = cube([7, 3], 5)
|
/// part002 = cube(center = [7, 3], size = 5)
|
||||||
/// |> translate(z = 1)
|
/// |> translate(z = 1)
|
||||||
///
|
///
|
||||||
/// subtractedPart = subtract([part001], tools=[part002])
|
/// subtractedPart = subtract([part001], tools=[part002])
|
||||||
@ -354,8 +354,8 @@ pub async fn subtract(exec_state: &mut ExecState, args: Args) -> Result<KclValue
|
|||||||
/// |> extrude(length = 10)
|
/// |> extrude(length = 10)
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// part001 = cube([0, 0], 10)
|
/// part001 = cube(center = [0, 0], size = 10)
|
||||||
/// part002 = cube([7, 3], 5)
|
/// part002 = cube(center = [7, 3], size = 5)
|
||||||
/// |> translate(z = 1)
|
/// |> translate(z = 1)
|
||||||
///
|
///
|
||||||
/// // This is the equivalent of: subtract([part001], tools=[part002])
|
/// // This is the equivalent of: subtract([part001], tools=[part002])
|
||||||
|
@ -96,7 +96,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
|||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// // Each instance will be shifted along the X axis.
|
/// // Each instance will be shifted along the X axis.
|
||||||
/// fn transform(id) {
|
/// fn transform(@id) {
|
||||||
/// return { translate = [4 * id, 0, 0] }
|
/// return { translate = [4 * id, 0, 0] }
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
@ -110,7 +110,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
|||||||
/// // Each instance will be shifted along the X axis,
|
/// // Each instance will be shifted along the X axis,
|
||||||
/// // with a gap between the original (at x = 0) and the first replica
|
/// // with a gap between the original (at x = 0) and the first replica
|
||||||
/// // (at x = 8). This is because `id` starts at 1.
|
/// // (at x = 8). This is because `id` starts at 1.
|
||||||
/// fn transform(id) {
|
/// fn transform(@id) {
|
||||||
/// return { translate = [4 * (1+id), 0, 0] }
|
/// return { translate = [4 * (1+id), 0, 0] }
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
@ -140,7 +140,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// width = 20
|
/// width = 20
|
||||||
/// fn transform(i) {
|
/// fn transform(@i) {
|
||||||
/// return {
|
/// return {
|
||||||
/// // Move down each time.
|
/// // Move down each time.
|
||||||
/// translate = [0, 0, -i * width],
|
/// translate = [0, 0, -i * width],
|
||||||
@ -155,7 +155,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// myCubes =
|
/// myCubes =
|
||||||
/// cube(width, [100,0])
|
/// cube(length = width, center = [100,0])
|
||||||
/// |> patternTransform(instances = 25, transform = transform)
|
/// |> patternTransform(instances = 25, transform = transform)
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
@ -180,7 +180,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// width = 20
|
/// width = 20
|
||||||
/// fn transform(i) {
|
/// fn transform(@i) {
|
||||||
/// return {
|
/// return {
|
||||||
/// translate = [0, 0, -i * width],
|
/// translate = [0, 0, -i * width],
|
||||||
/// rotation = {
|
/// rotation = {
|
||||||
@ -191,7 +191,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
|||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// myCubes =
|
/// myCubes =
|
||||||
/// cube(width, [100,100])
|
/// cube(length = width, center = [100,100])
|
||||||
/// |> patternTransform(instances = 4, transform = transform)
|
/// |> patternTransform(instances = 4, transform = transform)
|
||||||
/// ```
|
/// ```
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
@ -201,7 +201,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
|||||||
/// t = 0.005 // taper factor [0-1)
|
/// t = 0.005 // taper factor [0-1)
|
||||||
/// // Defines how to modify each layer of the vase.
|
/// // Defines how to modify each layer of the vase.
|
||||||
/// // Each replica is shifted up the Z axis, and has a smoothly-varying radius
|
/// // Each replica is shifted up the Z axis, and has a smoothly-varying radius
|
||||||
/// fn transform(replicaId) {
|
/// fn transform(@replicaId) {
|
||||||
/// scale = r * abs(1 - (t * replicaId)) * (5 + cos((replicaId / 8): number(rad)))
|
/// scale = r * abs(1 - (t * replicaId)) * (5 + cos((replicaId / 8): number(rad)))
|
||||||
/// return {
|
/// return {
|
||||||
/// translate = [0, 0, replicaId * 10],
|
/// translate = [0, 0, replicaId * 10],
|
||||||
@ -219,7 +219,7 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
|||||||
/// vase = layer() |> patternTransform(instances = 100, transform = transform)
|
/// vase = layer() |> patternTransform(instances = 100, transform = transform)
|
||||||
/// ```
|
/// ```
|
||||||
/// ```
|
/// ```
|
||||||
/// fn transform(i) {
|
/// fn transform(@i) {
|
||||||
/// // Transform functions can return multiple transforms. They'll be applied in order.
|
/// // Transform functions can return multiple transforms. They'll be applied in order.
|
||||||
/// return [
|
/// return [
|
||||||
/// { translate = [30 * i, 0, 0] },
|
/// { translate = [30 * i, 0, 0] },
|
||||||
@ -282,7 +282,7 @@ async fn inner_pattern_transform<'a>(
|
|||||||
/// Just like patternTransform, but works on 2D sketches not 3D solids.
|
/// Just like patternTransform, but works on 2D sketches not 3D solids.
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// // Each instance will be shifted along the X axis.
|
/// // Each instance will be shifted along the X axis.
|
||||||
/// fn transform(id) {
|
/// fn transform(@id) {
|
||||||
/// return { translate = [4 * id, 0] }
|
/// return { translate = [4 * id, 0] }
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
|
@ -42,10 +42,10 @@ pub async fn segment_end(exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
|||||||
/// |> extrude(length = radius)
|
/// |> extrude(length = radius)
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// cylinder(1, line1)
|
/// cylinder(radius = 1, tag = line1)
|
||||||
/// cylinder(2, line2)
|
/// cylinder(radius = 2, tag = line2)
|
||||||
/// cylinder(3, line3)
|
/// cylinder(radius = 3, tag = line3)
|
||||||
/// cylinder(4, line4)
|
/// cylinder(radius = 4, tag = line4)
|
||||||
/// ```
|
/// ```
|
||||||
#[stdlib {
|
#[stdlib {
|
||||||
name = "segEnd",
|
name = "segEnd",
|
||||||
@ -178,10 +178,10 @@ pub async fn segment_start(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
|||||||
/// |> extrude(length = radius)
|
/// |> extrude(length = radius)
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// cylinder(1, line1)
|
/// cylinder(radius = 1, tag = line1)
|
||||||
/// cylinder(2, line2)
|
/// cylinder(radius = 2, tag = line2)
|
||||||
/// cylinder(3, line3)
|
/// cylinder(radius = 3, tag = line3)
|
||||||
/// cylinder(4, line4)
|
/// cylinder(radius = 4, tag = line4)
|
||||||
/// ```
|
/// ```
|
||||||
#[stdlib {
|
#[stdlib {
|
||||||
name = "segStart",
|
name = "segStart",
|
||||||
|
@ -326,7 +326,7 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
|||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// // Move a sketch.
|
/// // Move a sketch.
|
||||||
///
|
///
|
||||||
/// fn square(length){
|
/// fn square(@length){
|
||||||
/// l = length / 2
|
/// l = length / 2
|
||||||
/// p0 = [-l, -l]
|
/// p0 = [-l, -l]
|
||||||
/// p1 = [-l, l]
|
/// p1 = [-l, l]
|
||||||
|
@ -1125,27 +1125,27 @@ d = 1
|
|||||||
|
|
||||||
fn rect(x, y, w, h) {
|
fn rect(x, y, w, h) {
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|> startProfileAt([x, y], %)
|
|> startProfile(at = [x, y])
|
||||||
|> xLine(length = w)
|
|> xLine(length = w)
|
||||||
|> yLine(length = h)
|
|> yLine(length = h)
|
||||||
|> xLine(length = -w)
|
|> xLine(length = -w)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(d, %)
|
|> extrude(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn quad(x1, y1, x2, y2, x3, y3, x4, y4) {
|
fn quad(x1, y1, x2, y2, x3, y3, x4, y4) {
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|> startProfileAt([x1, y1], %)
|
|> startProfile(at = [x1, y1])
|
||||||
|> line(endAbsolute = [x2, y2])
|
|> line(endAbsolute = [x2, y2])
|
||||||
|> line(endAbsolute = [x3, y3])
|
|> line(endAbsolute = [x3, y3])
|
||||||
|> line(endAbsolute = [x4, y4])
|
|> line(endAbsolute = [x4, y4])
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(d, %)
|
|> extrude(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn crosshair(x, y) {
|
fn crosshair(x, y) {
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|> startProfileAt([x, y], %)
|
|> startProfile(at = [x, y])
|
||||||
|> yLine(length = 1)
|
|> yLine(length = 1)
|
||||||
|> yLine(length = -2)
|
|> yLine(length = -2)
|
||||||
|> yLine(length = 1)
|
|> yLine(length = 1)
|
||||||
@ -1159,11 +1159,30 @@ fn z(z_x, z_y) {
|
|||||||
z_corner = s * 2
|
z_corner = s * 2
|
||||||
z_w = z_end_w + 2 * z_corner
|
z_w = z_end_w + 2 * z_corner
|
||||||
z_h = z_w * 1.08130081300813
|
z_h = z_w * 1.08130081300813
|
||||||
rect(z_x, z_y, z_end_w, -z_end_h)
|
rect(
|
||||||
rect(z_x + z_w, z_y, -z_corner, -z_corner)
|
z_x,
|
||||||
rect(z_x + z_w, z_y - z_h, -z_end_w, z_end_h)
|
a = z_y,
|
||||||
rect(z_x, z_y - z_h, z_corner, z_corner)
|
b = z_end_w,
|
||||||
quad(z_x, z_y - z_h + z_corner, z_x + z_w - z_corner, z_y, z_x + z_w, z_y - z_corner, z_x + z_corner, z_y - z_h)
|
c = -z_end_h,
|
||||||
|
)
|
||||||
|
rect(
|
||||||
|
z_x + z_w,
|
||||||
|
a = z_y,
|
||||||
|
b = -z_corner,
|
||||||
|
c = -z_corner,
|
||||||
|
)
|
||||||
|
rect(
|
||||||
|
z_x + z_w,
|
||||||
|
a = z_y - z_h,
|
||||||
|
b = -z_end_w,
|
||||||
|
c = z_end_h,
|
||||||
|
)
|
||||||
|
rect(
|
||||||
|
z_x,
|
||||||
|
a = z_y - z_h,
|
||||||
|
b = z_corner,
|
||||||
|
c = z_corner,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn o(c_x, c_y) {
|
fn o(c_x, c_y) {
|
||||||
@ -1175,61 +1194,45 @@ fn o(c_x, c_y) {
|
|||||||
a = 7
|
a = 7
|
||||||
|
|
||||||
// Start point for the top sketch
|
// Start point for the top sketch
|
||||||
o_x1 = c_x + o_r * cos((45 + a) / 360 * tau())
|
o_x1 = c_x + o_r * cos((45 + a) / 360 * TAU)
|
||||||
o_y1 = c_y + o_r * sin((45 + a) / 360 * tau())
|
o_y1 = c_y + o_r * sin((45 + a) / 360 * TAU)
|
||||||
|
|
||||||
// Start point for the bottom sketch
|
// Start point for the bottom sketch
|
||||||
o_x2 = c_x + o_r * cos((225 + a) / 360 * tau())
|
o_x2 = c_x + o_r * cos((225 + a) / 360 * TAU)
|
||||||
o_y2 = c_y + o_r * sin((225 + a) / 360 * tau())
|
o_y2 = c_y + o_r * sin((225 + a) / 360 * TAU)
|
||||||
|
|
||||||
// End point for the bottom startSketch
|
// End point for the bottom startSketch
|
||||||
o_x3 = c_x + o_r * cos((45 - a) / 360 * tau())
|
o_x3 = c_x + o_r * cos((45 - a) / 360 * TAU)
|
||||||
o_y3 = c_y + o_r * sin((45 - a) / 360 * tau())
|
o_y3 = c_y + o_r * sin((45 - a) / 360 * TAU)
|
||||||
|
|
||||||
// Where is the center?
|
// Where is the center?
|
||||||
// crosshair(c_x, c_y)
|
// crosshair(c_x, c_y)
|
||||||
|
|
||||||
|
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|> startProfileAt([o_x1, o_y1], %)
|
|> startProfile(at = [o_x1, o_y1])
|
||||||
|> arc({
|
|> arc(radius = o_r, angle_start = 45 + a, angle_end = 225 - a)
|
||||||
radius = o_r,
|
|
||||||
angle_start = 45 + a,
|
|
||||||
angle_end = 225 - a
|
|
||||||
}, %)
|
|
||||||
|> angledLine(angle = 45, length = o_r - i_r)
|
|> angledLine(angle = 45, length = o_r - i_r)
|
||||||
|> arc({
|
|> arc(radius = i_r, angle_start = 225 - a, angle_end = 45 + a)
|
||||||
radius = i_r,
|
|
||||||
angle_start = 225 - a,
|
|
||||||
angle_end = 45 + a
|
|
||||||
}, %)
|
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(d, %)
|
|> extrude(d)
|
||||||
|
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|> startProfileAt([o_x2, o_y2], %)
|
|> startProfile(at = [o_x2, o_y2])
|
||||||
|> arc({
|
|> arc(radius = o_r, angle_start = 225 + a, angle_end = 360 + 45 - a)
|
||||||
radius = o_r,
|
|
||||||
angle_start = 225 + a,
|
|
||||||
angle_end = 360 + 45 - a
|
|
||||||
}, %)
|
|
||||||
|> angledLine(angle = 225, length = o_r - i_r)
|
|> angledLine(angle = 225, length = o_r - i_r)
|
||||||
|> arc({
|
|> arc(radius = i_r, angle_start = 45 - a, angle_end = 225 + a - 360)
|
||||||
radius = i_r,
|
|
||||||
angle_start = 45 - a,
|
|
||||||
angle_end = 225 + a - 360
|
|
||||||
}, %)
|
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(d, %)
|
|> extrude(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn zoo(x0, y0) {
|
fn zoo(x0, y0) {
|
||||||
z(x0, y0)
|
z(x = x0, y = y0)
|
||||||
o(x0 + s * 20, y0 - (s * 6.7))
|
o(x = x0 + s * 20, y = y0 - (s * 6.7))
|
||||||
o(x0 + s * 35, y0 - (s * 6.7))
|
o(x = x0 + s * 35, y = y0 - (s * 6.7))
|
||||||
}
|
}
|
||||||
|
|
||||||
zoo(zoo_x, zoo_y)
|
zoo(x = zoo_x, y = zoo_y)
|
||||||
"#;
|
"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
@ -1250,32 +1253,32 @@ overHangLength = .4
|
|||||||
|
|
||||||
// Sketch and revolve the inside bearing piece
|
// Sketch and revolve the inside bearing piece
|
||||||
insideRevolve = startSketchOn(XZ)
|
insideRevolve = startSketchOn(XZ)
|
||||||
|> startProfileAt([insideDia / 2, 0], %)
|
|> startProfile(at = [insideDia / 2, 0])
|
||||||
|> line([0, thickness + sphereDia / 2], %)
|
|> line(end = [0, thickness + sphereDia / 2])
|
||||||
|> line([overHangLength, 0], %)
|
|> line(end = [overHangLength, 0])
|
||||||
|> line([0, -thickness], %)
|
|> line(end = [0, -thickness])
|
||||||
|> line([-overHangLength + thickness, 0], %)
|
|> line(end = [-overHangLength + thickness, 0])
|
||||||
|> line([0, -sphereDia], %)
|
|> line(end = [0, -sphereDia])
|
||||||
|> line([overHangLength - thickness, 0], %)
|
|> line(end = [overHangLength - thickness, 0])
|
||||||
|> line([0, -thickness], %)
|
|> line(end = [0, -thickness])
|
||||||
|> line([-overHangLength, 0], %)
|
|> line(end = [-overHangLength, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = Y }, %)
|
|> revolve(axis = Y)
|
||||||
|
|
||||||
// Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis)
|
// Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis)
|
||||||
sphere = startSketchOn(XZ)
|
sphere = startSketchOn(XZ)
|
||||||
|> startProfileAt([
|
|> startProfile(at = [
|
||||||
0.05 + insideDia / 2 + thickness,
|
0.05 + insideDia / 2 + thickness,
|
||||||
0 - 0.05
|
0 - 0.05
|
||||||
], %)
|
])
|
||||||
|> line([sphereDia - 0.1, 0], %)
|
|> line(end = [sphereDia - 0.1, 0])
|
||||||
|> arc({
|
|> arc(
|
||||||
angle_start = 0,
|
angle_start = 0,
|
||||||
angle_end = -180,
|
angle_end = -180,
|
||||||
radius = sphereDia / 2 - 0.05
|
radius = sphereDia / 2 - 0.05
|
||||||
}, %)
|
)
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = X }, %)
|
|> revolve(axis = X)
|
||||||
|> patternCircular3d(
|
|> patternCircular3d(
|
||||||
axis = [0, 0, 1],
|
axis = [0, 0, 1],
|
||||||
center = [0, 0, 0],
|
center = [0, 0, 0],
|
||||||
@ -1286,20 +1289,21 @@ sphere = startSketchOn(XZ)
|
|||||||
|
|
||||||
// Sketch and revolve the outside bearing
|
// Sketch and revolve the outside bearing
|
||||||
outsideRevolve = startSketchOn(XZ)
|
outsideRevolve = startSketchOn(XZ)
|
||||||
|> startProfileAt([
|
|> startProfile(at = [
|
||||||
insideDia / 2 + thickness + sphereDia,
|
insideDia / 2 + thickness + sphereDia,
|
||||||
0
|
0
|
||||||
], %)
|
]
|
||||||
|> line([0, sphereDia / 2], %)
|
)
|
||||||
|> line([-overHangLength + thickness, 0], %)
|
|> line(end = [0, sphereDia / 2])
|
||||||
|> line([0, thickness], %)
|
|> line(end = [-overHangLength + thickness, 0])
|
||||||
|> line([overHangLength, 0], %)
|
|> line(end = [0, thickness])
|
||||||
|> line([0, -2 * thickness - sphereDia], %)
|
|> line(end = [overHangLength, 0])
|
||||||
|> line([-overHangLength, 0], %)
|
|> line(end = [0, -2 * thickness - sphereDia])
|
||||||
|> line([0, thickness], %)
|
|> line(end = [-overHangLength, 0])
|
||||||
|> line([overHangLength - thickness, 0], %)
|
|> line(end = [0, thickness])
|
||||||
|
|> line(end = [overHangLength - thickness, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = Y }, %)"#;
|
|> revolve(axis = Y)"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
let recasted = program.recast(&Default::default(), 0);
|
let recasted = program.recast(&Default::default(), 0);
|
||||||
@ -1316,32 +1320,28 @@ overHangLength = .4
|
|||||||
|
|
||||||
// Sketch and revolve the inside bearing piece
|
// Sketch and revolve the inside bearing piece
|
||||||
insideRevolve = startSketchOn(XZ)
|
insideRevolve = startSketchOn(XZ)
|
||||||
|> startProfileAt([insideDia / 2, 0], %)
|
|> startProfile(at = [insideDia / 2, 0])
|
||||||
|> line([0, thickness + sphereDia / 2], %)
|
|> line(end = [0, thickness + sphereDia / 2])
|
||||||
|> line([overHangLength, 0], %)
|
|> line(end = [overHangLength, 0])
|
||||||
|> line([0, -thickness], %)
|
|> line(end = [0, -thickness])
|
||||||
|> line([-overHangLength + thickness, 0], %)
|
|> line(end = [-overHangLength + thickness, 0])
|
||||||
|> line([0, -sphereDia], %)
|
|> line(end = [0, -sphereDia])
|
||||||
|> line([overHangLength - thickness, 0], %)
|
|> line(end = [overHangLength - thickness, 0])
|
||||||
|> line([0, -thickness], %)
|
|> line(end = [0, -thickness])
|
||||||
|> line([-overHangLength, 0], %)
|
|> line(end = [-overHangLength, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = Y }, %)
|
|> revolve(axis = Y)
|
||||||
|
|
||||||
// Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis)
|
// Sketch and revolve one of the balls and duplicate it using a circular pattern. (This is currently a workaround, we have a bug with rotating on a sketch that touches the rotation axis)
|
||||||
sphere = startSketchOn(XZ)
|
sphere = startSketchOn(XZ)
|
||||||
|> startProfileAt([
|
|> startProfile(at = [
|
||||||
0.05 + insideDia / 2 + thickness,
|
0.05 + insideDia / 2 + thickness,
|
||||||
0 - 0.05
|
0 - 0.05
|
||||||
], %)
|
])
|
||||||
|> line([sphereDia - 0.1, 0], %)
|
|> line(end = [sphereDia - 0.1, 0])
|
||||||
|> arc({
|
|> arc(angle_start = 0, angle_end = -180, radius = sphereDia / 2 - 0.05)
|
||||||
angle_start = 0,
|
|
||||||
angle_end = -180,
|
|
||||||
radius = sphereDia / 2 - 0.05
|
|
||||||
}, %)
|
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = X }, %)
|
|> revolve(axis = X)
|
||||||
|> patternCircular3d(
|
|> patternCircular3d(
|
||||||
axis = [0, 0, 1],
|
axis = [0, 0, 1],
|
||||||
center = [0, 0, 0],
|
center = [0, 0, 0],
|
||||||
@ -1352,20 +1352,20 @@ sphere = startSketchOn(XZ)
|
|||||||
|
|
||||||
// Sketch and revolve the outside bearing
|
// Sketch and revolve the outside bearing
|
||||||
outsideRevolve = startSketchOn(XZ)
|
outsideRevolve = startSketchOn(XZ)
|
||||||
|> startProfileAt([
|
|> startProfile(at = [
|
||||||
insideDia / 2 + thickness + sphereDia,
|
insideDia / 2 + thickness + sphereDia,
|
||||||
0
|
0
|
||||||
], %)
|
])
|
||||||
|> line([0, sphereDia / 2], %)
|
|> line(end = [0, sphereDia / 2])
|
||||||
|> line([-overHangLength + thickness, 0], %)
|
|> line(end = [-overHangLength + thickness, 0])
|
||||||
|> line([0, thickness], %)
|
|> line(end = [0, thickness])
|
||||||
|> line([overHangLength, 0], %)
|
|> line(end = [overHangLength, 0])
|
||||||
|> line([0, -2 * thickness - sphereDia], %)
|
|> line(end = [0, -2 * thickness - sphereDia])
|
||||||
|> line([-overHangLength, 0], %)
|
|> line(end = [-overHangLength, 0])
|
||||||
|> line([0, thickness], %)
|
|> line(end = [0, thickness])
|
||||||
|> line([overHangLength - thickness, 0], %)
|
|> line(end = [overHangLength - thickness, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|> revolve({ axis = Y }, %)
|
|> revolve(axis = Y)
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1458,7 +1458,7 @@ f = [1, 2, 3]: [number; 1+]
|
|||||||
let some_program_string = r#"bing = { yo = 55 }
|
let some_program_string = r#"bing = { yo = 55 }
|
||||||
myNestedVar = [
|
myNestedVar = [
|
||||||
{
|
{
|
||||||
prop: line([bing.yo, 21], sketch001)
|
prop: line(a = [bing.yo, 21], b = sketch001)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
"#;
|
"#;
|
||||||
@ -1470,7 +1470,7 @@ myNestedVar = [
|
|||||||
r#"bing = { yo = 55 }
|
r#"bing = { yo = 55 }
|
||||||
myNestedVar = [
|
myNestedVar = [
|
||||||
{
|
{
|
||||||
prop = line([bing.yo, 21], sketch001)
|
prop = line(a = [bing.yo, 21], b = sketch001)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
"#
|
"#
|
||||||
@ -1502,10 +1502,10 @@ myNestedVar = [
|
|||||||
fn test_recast_shebang() {
|
fn test_recast_shebang() {
|
||||||
let some_program_string = r#"#!/usr/local/env zoo kcl
|
let some_program_string = r#"#!/usr/local/env zoo kcl
|
||||||
part001 = startSketchOn(XY)
|
part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-10, -10], %)
|
|> startProfile(at = [-10, -10])
|
||||||
|> line([20, 0], %)
|
|> line(end = [20, 0])
|
||||||
|> line([0, 20], %)
|
|> line(end = [0, 20])
|
||||||
|> line([-20, 0], %)
|
|> line(end = [-20, 0])
|
||||||
|> close()
|
|> close()
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
@ -1517,10 +1517,10 @@ part001 = startSketchOn(XY)
|
|||||||
r#"#!/usr/local/env zoo kcl
|
r#"#!/usr/local/env zoo kcl
|
||||||
|
|
||||||
part001 = startSketchOn(XY)
|
part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-10, -10], %)
|
|> startProfile(at = [-10, -10])
|
||||||
|> line([20, 0], %)
|
|> line(end = [20, 0])
|
||||||
|> line([0, 20], %)
|
|> line(end = [0, 20])
|
||||||
|> line([-20, 0], %)
|
|> line(end = [-20, 0])
|
||||||
|> close()
|
|> close()
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
@ -1533,10 +1533,10 @@ part001 = startSketchOn(XY)
|
|||||||
|
|
||||||
|
|
||||||
part001 = startSketchOn(XY)
|
part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-10, -10], %)
|
|> startProfile(at = [-10, -10])
|
||||||
|> line([20, 0], %)
|
|> line(end = [20, 0])
|
||||||
|> line([0, 20], %)
|
|> line(end = [0, 20])
|
||||||
|> line([-20, 0], %)
|
|> line(end = [-20, 0])
|
||||||
|> close()
|
|> close()
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
@ -1548,10 +1548,10 @@ part001 = startSketchOn(XY)
|
|||||||
r#"#!/usr/local/env zoo kcl
|
r#"#!/usr/local/env zoo kcl
|
||||||
|
|
||||||
part001 = startSketchOn(XY)
|
part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-10, -10], %)
|
|> startProfile(at = [-10, -10])
|
||||||
|> line([20, 0], %)
|
|> line(end = [20, 0])
|
||||||
|> line([0, 20], %)
|
|> line(end = [0, 20])
|
||||||
|> line([-20, 0], %)
|
|> line(end = [-20, 0])
|
||||||
|> close()
|
|> close()
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
@ -1563,10 +1563,10 @@ part001 = startSketchOn(XY)
|
|||||||
|
|
||||||
// Yo yo my comments.
|
// Yo yo my comments.
|
||||||
part001 = startSketchOn(XY)
|
part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-10, -10], %)
|
|> startProfile(at = [-10, -10])
|
||||||
|> line([20, 0], %)
|
|> line(end = [20, 0])
|
||||||
|> line([0, 20], %)
|
|> line(end = [0, 20])
|
||||||
|> line([-20, 0], %)
|
|> line(end = [-20, 0])
|
||||||
|> close()
|
|> close()
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
@ -1579,10 +1579,10 @@ part001 = startSketchOn(XY)
|
|||||||
|
|
||||||
// Yo yo my comments.
|
// Yo yo my comments.
|
||||||
part001 = startSketchOn(XY)
|
part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([-10, -10], %)
|
|> startProfile(at = [-10, -10])
|
||||||
|> line([20, 0], %)
|
|> line(end = [20, 0])
|
||||||
|> line([0, 20], %)
|
|> line(end = [0, 20])
|
||||||
|> line([-20, 0], %)
|
|> line(end = [-20, 0])
|
||||||
|> close()
|
|> close()
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
@ -1613,7 +1613,7 @@ hole_diam = 5
|
|||||||
// define a rectangular shape func
|
// define a rectangular shape func
|
||||||
fn rectShape(pos, w, l) {
|
fn rectShape(pos, w, l) {
|
||||||
rr = startSketchOn(XY)
|
rr = startSketchOn(XY)
|
||||||
|> startProfileAt([pos[0] - (w / 2), pos[1] - (l / 2)], %)
|
|> startProfile(at = [pos[0] - (w / 2), pos[1] - (l / 2)])
|
||||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] - (l / 2)], tag = $edge1)
|
|> line(endAbsolute = [pos[0] + w / 2, pos[1] - (l / 2)], tag = $edge1)
|
||||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] + l / 2], tag = $edge2)
|
|> line(endAbsolute = [pos[0] + w / 2, pos[1] + l / 2], tag = $edge2)
|
||||||
|> line(endAbsolute = [pos[0] - (w / 2), pos[1] + l / 2], tag = $edge3)
|
|> line(endAbsolute = [pos[0] - (w / 2), pos[1] + l / 2], tag = $edge3)
|
||||||
@ -1622,8 +1622,8 @@ fn rectShape(pos, w, l) {
|
|||||||
}
|
}
|
||||||
// build the body of the focusrite scarlett solo gen 4
|
// build the body of the focusrite scarlett solo gen 4
|
||||||
// only used for visualization
|
// only used for visualization
|
||||||
scarlett_body = rectShape([0, 0], width, length)
|
scarlett_body = rectShape(pos = [0, 0], w = width, l = length)
|
||||||
|> extrude(depth, %)
|
|> extrude(depth)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
radius = radius,
|
radius = radius,
|
||||||
tags = [
|
tags = [
|
||||||
@ -1636,14 +1636,14 @@ scarlett_body = rectShape([0, 0], width, length)
|
|||||||
// build the bracket sketch around the body
|
// build the bracket sketch around the body
|
||||||
fn bracketSketch(w, d, t) {
|
fn bracketSketch(w, d, t) {
|
||||||
s = startSketchOn({
|
s = startSketchOn({
|
||||||
plane: {
|
plane = {
|
||||||
origin = { x = 0, y = length / 2 + thk, z = 0 },
|
origin = { x = 0, y = length / 2 + thk, z = 0 },
|
||||||
x_axis = { x = 1, y = 0, z = 0 },
|
x_axis = { x = 1, y = 0, z = 0 },
|
||||||
y_axis = { x = 0, y = 0, z = 1 },
|
y_axis = { x = 0, y = 0, z = 1 },
|
||||||
z_axis = { x = 0, y = 1, z = 0 }
|
z_axis = { x = 0, y = 1, z = 0 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|> startProfileAt([-w / 2 - t, d + t], %)
|
|> startProfile(at = [-w / 2 - t, d + t])
|
||||||
|> line(endAbsolute = [-w / 2 - t, -t], tag = $edge1)
|
|> line(endAbsolute = [-w / 2 - t, -t], tag = $edge1)
|
||||||
|> line(endAbsolute = [w / 2 + t, -t], tag = $edge2)
|
|> line(endAbsolute = [w / 2 + t, -t], tag = $edge2)
|
||||||
|> line(endAbsolute = [w / 2 + t, d + t], tag = $edge3)
|
|> line(endAbsolute = [w / 2 + t, d + t], tag = $edge3)
|
||||||
@ -1655,8 +1655,8 @@ fn bracketSketch(w, d, t) {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
// build the body of the bracket
|
// build the body of the bracket
|
||||||
bracket_body = bracketSketch(width, depth, thk)
|
bracket_body = bracketSketch(w = width, d = depth, t = thk)
|
||||||
|> extrude(length + 10, %)
|
|> extrude(length + 10)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
radius = radius,
|
radius = radius,
|
||||||
tags = [
|
tags = [
|
||||||
@ -1668,26 +1668,26 @@ bracket_body = bracketSketch(width, depth, thk)
|
|||||||
)
|
)
|
||||||
// build the tabs of the mounting bracket (right side)
|
// build the tabs of the mounting bracket (right side)
|
||||||
tabs_r = startSketchOn({
|
tabs_r = startSketchOn({
|
||||||
plane: {
|
plane = {
|
||||||
origin = { x = 0, y = 0, z = depth + thk },
|
origin = { x = 0, y = 0, z = depth + thk },
|
||||||
x_axis = { x = 1, y = 0, z = 0 },
|
x_axis = { x = 1, y = 0, z = 0 },
|
||||||
y_axis = { x = 0, y = 1, z = 0 },
|
y_axis = { x = 0, y = 1, z = 0 },
|
||||||
z_axis = { x = 0, y = 0, z = 1 }
|
z_axis = { x = 0, y = 0, z = 1 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|> startProfileAt([width / 2 + thk, length / 2 + thk], %)
|
|> startProfile(at = [width / 2 + thk, length / 2 + thk])
|
||||||
|> line([10, -5], %)
|
|> line(end = [10, -5])
|
||||||
|> line([0, -10], %)
|
|> line(end = [0, -10])
|
||||||
|> line([-10, -5], %)
|
|> line(end = [-10, -5])
|
||||||
|> close()
|
|> close()
|
||||||
|> hole(circle(
|
|> subtract2d(tool = circle(
|
||||||
center = [
|
center = [
|
||||||
width / 2 + thk + hole_diam,
|
width / 2 + thk + hole_diam,
|
||||||
length / 2 - hole_diam
|
length / 2 - hole_diam
|
||||||
],
|
],
|
||||||
radius = hole_diam / 2
|
radius = hole_diam / 2
|
||||||
), %)
|
))
|
||||||
|> extrude(-thk, %)
|
|> extrude(-thk)
|
||||||
|> patternLinear3d(
|
|> patternLinear3d(
|
||||||
axis = [0, -1, 0],
|
axis = [0, -1, 0],
|
||||||
repetitions = 1,
|
repetitions = 1,
|
||||||
@ -1695,26 +1695,26 @@ tabs_r = startSketchOn({
|
|||||||
)
|
)
|
||||||
// build the tabs of the mounting bracket (left side)
|
// build the tabs of the mounting bracket (left side)
|
||||||
tabs_l = startSketchOn({
|
tabs_l = startSketchOn({
|
||||||
plane: {
|
plane = {
|
||||||
origin = { x = 0, y = 0, z = depth + thk },
|
origin = { x = 0, y = 0, z = depth + thk },
|
||||||
x_axis = { x = 1, y = 0, z = 0 },
|
x_axis = { x = 1, y = 0, z = 0 },
|
||||||
y_axis = { x = 0, y = 1, z = 0 },
|
y_axis = { x = 0, y = 1, z = 0 },
|
||||||
z_axis = { x = 0, y = 0, z = 1 }
|
z_axis = { x = 0, y = 0, z = 1 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|> startProfileAt([-width / 2 - thk, length / 2 + thk], %)
|
|> startProfile(at = [-width / 2 - thk, length / 2 + thk])
|
||||||
|> line([-10, -5], %)
|
|> line(end = [-10, -5])
|
||||||
|> line([0, -10], %)
|
|> line(end = [0, -10])
|
||||||
|> line([10, -5], %)
|
|> line(end = [10, -5])
|
||||||
|> close()
|
|> close()
|
||||||
|> hole(circle(
|
|> subtract2d(tool = circle(
|
||||||
center = [
|
center = [
|
||||||
-width / 2 - thk - hole_diam,
|
-width / 2 - thk - hole_diam,
|
||||||
length / 2 - hole_diam
|
length / 2 - hole_diam
|
||||||
],
|
],
|
||||||
radius = hole_diam / 2
|
radius = hole_diam / 2
|
||||||
), %)
|
))
|
||||||
|> extrude(-thk, %)
|
|> extrude(-thk)
|
||||||
|> patternLinear3d(axis = [0, -1, 0], repetitions = 1, distance = length - 10ft)
|
|> patternLinear3d(axis = [0, -1, 0], repetitions = 1, distance = length - 10ft)
|
||||||
"#;
|
"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
@ -1735,7 +1735,7 @@ hole_diam = 5
|
|||||||
// define a rectangular shape func
|
// define a rectangular shape func
|
||||||
fn rectShape(pos, w, l) {
|
fn rectShape(pos, w, l) {
|
||||||
rr = startSketchOn(XY)
|
rr = startSketchOn(XY)
|
||||||
|> startProfileAt([pos[0] - (w / 2), pos[1] - (l / 2)], %)
|
|> startProfile(at = [pos[0] - (w / 2), pos[1] - (l / 2)])
|
||||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] - (l / 2)], tag = $edge1)
|
|> line(endAbsolute = [pos[0] + w / 2, pos[1] - (l / 2)], tag = $edge1)
|
||||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] + l / 2], tag = $edge2)
|
|> line(endAbsolute = [pos[0] + w / 2, pos[1] + l / 2], tag = $edge2)
|
||||||
|> line(endAbsolute = [pos[0] - (w / 2), pos[1] + l / 2], tag = $edge3)
|
|> line(endAbsolute = [pos[0] - (w / 2), pos[1] + l / 2], tag = $edge3)
|
||||||
@ -1744,8 +1744,8 @@ fn rectShape(pos, w, l) {
|
|||||||
}
|
}
|
||||||
// build the body of the focusrite scarlett solo gen 4
|
// build the body of the focusrite scarlett solo gen 4
|
||||||
// only used for visualization
|
// only used for visualization
|
||||||
scarlett_body = rectShape([0, 0], width, length)
|
scarlett_body = rectShape(pos = [0, 0], w = width, l = length)
|
||||||
|> extrude(depth, %)
|
|> extrude(depth)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
radius = radius,
|
radius = radius,
|
||||||
tags = [
|
tags = [
|
||||||
@ -1765,7 +1765,7 @@ fn bracketSketch(w, d, t) {
|
|||||||
z_axis = { x = 0, y = 1, z = 0 }
|
z_axis = { x = 0, y = 1, z = 0 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|> startProfileAt([-w / 2 - t, d + t], %)
|
|> startProfile(at = [-w / 2 - t, d + t])
|
||||||
|> line(endAbsolute = [-w / 2 - t, -t], tag = $edge1)
|
|> line(endAbsolute = [-w / 2 - t, -t], tag = $edge1)
|
||||||
|> line(endAbsolute = [w / 2 + t, -t], tag = $edge2)
|
|> line(endAbsolute = [w / 2 + t, -t], tag = $edge2)
|
||||||
|> line(endAbsolute = [w / 2 + t, d + t], tag = $edge3)
|
|> line(endAbsolute = [w / 2 + t, d + t], tag = $edge3)
|
||||||
@ -1777,8 +1777,8 @@ fn bracketSketch(w, d, t) {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
// build the body of the bracket
|
// build the body of the bracket
|
||||||
bracket_body = bracketSketch(width, depth, thk)
|
bracket_body = bracketSketch(w = width, d = depth, t = thk)
|
||||||
|> extrude(length + 10, %)
|
|> extrude(length + 10)
|
||||||
|> fillet(
|
|> fillet(
|
||||||
radius = radius,
|
radius = radius,
|
||||||
tags = [
|
tags = [
|
||||||
@ -1797,19 +1797,19 @@ tabs_r = startSketchOn({
|
|||||||
z_axis = { x = 0, y = 0, z = 1 }
|
z_axis = { x = 0, y = 0, z = 1 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|> startProfileAt([width / 2 + thk, length / 2 + thk], %)
|
|> startProfile(at = [width / 2 + thk, length / 2 + thk])
|
||||||
|> line([10, -5], %)
|
|> line(end = [10, -5])
|
||||||
|> line([0, -10], %)
|
|> line(end = [0, -10])
|
||||||
|> line([-10, -5], %)
|
|> line(end = [-10, -5])
|
||||||
|> close()
|
|> close()
|
||||||
|> hole(circle(
|
|> subtract2d(tool = circle(
|
||||||
center = [
|
center = [
|
||||||
width / 2 + thk + hole_diam,
|
width / 2 + thk + hole_diam,
|
||||||
length / 2 - hole_diam
|
length / 2 - hole_diam
|
||||||
],
|
],
|
||||||
radius = hole_diam / 2,
|
radius = hole_diam / 2,
|
||||||
), %)
|
))
|
||||||
|> extrude(-thk, %)
|
|> extrude(-thk)
|
||||||
|> patternLinear3d(axis = [0, -1, 0], repetitions = 1, distance = length - 10)
|
|> patternLinear3d(axis = [0, -1, 0], repetitions = 1, distance = length - 10)
|
||||||
// build the tabs of the mounting bracket (left side)
|
// build the tabs of the mounting bracket (left side)
|
||||||
tabs_l = startSketchOn({
|
tabs_l = startSketchOn({
|
||||||
@ -1820,19 +1820,19 @@ tabs_l = startSketchOn({
|
|||||||
z_axis = { x = 0, y = 0, z = 1 }
|
z_axis = { x = 0, y = 0, z = 1 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|> startProfileAt([-width / 2 - thk, length / 2 + thk], %)
|
|> startProfile(at = [-width / 2 - thk, length / 2 + thk])
|
||||||
|> line([-10, -5], %)
|
|> line(end = [-10, -5])
|
||||||
|> line([0, -10], %)
|
|> line(end = [0, -10])
|
||||||
|> line([10, -5], %)
|
|> line(end = [10, -5])
|
||||||
|> close()
|
|> close()
|
||||||
|> hole(circle(
|
|> subtract2d(tool = circle(
|
||||||
center = [
|
center = [
|
||||||
-width / 2 - thk - hole_diam,
|
-width / 2 - thk - hole_diam,
|
||||||
length / 2 - hole_diam
|
length / 2 - hole_diam
|
||||||
],
|
],
|
||||||
radius = hole_diam / 2,
|
radius = hole_diam / 2,
|
||||||
), %)
|
))
|
||||||
|> extrude(-thk, %)
|
|> extrude(-thk)
|
||||||
|> patternLinear3d(axis = [0, -1, 0], repetitions = 1, distance = length - 10ft)
|
|> patternLinear3d(axis = [0, -1, 0], repetitions = 1, distance = length - 10ft)
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
@ -1842,12 +1842,12 @@ tabs_l = startSketchOn({
|
|||||||
fn test_recast_nested_var_declaration_in_fn_body() {
|
fn test_recast_nested_var_declaration_in_fn_body() {
|
||||||
let some_program_string = r#"fn cube(pos, scale) {
|
let some_program_string = r#"fn cube(pos, scale) {
|
||||||
sg = startSketchOn(XY)
|
sg = startSketchOn(XY)
|
||||||
|> startProfileAt(pos, %)
|
|> startProfile(at = pos)
|
||||||
|> line([0, scale], %)
|
|> line(end = [0, scale])
|
||||||
|> line([scale, 0], %)
|
|> line(end = [scale, 0])
|
||||||
|> line([0, -scale], %)
|
|> line(end = [0, -scale])
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(scale, %)
|
|> extrude(scale)
|
||||||
}"#;
|
}"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
@ -1856,12 +1856,12 @@ tabs_l = startSketchOn({
|
|||||||
recasted,
|
recasted,
|
||||||
r#"fn cube(pos, scale) {
|
r#"fn cube(pos, scale) {
|
||||||
sg = startSketchOn(XY)
|
sg = startSketchOn(XY)
|
||||||
|> startProfileAt(pos, %)
|
|> startProfile(at = pos)
|
||||||
|> line([0, scale], %)
|
|> line(end = [0, scale])
|
||||||
|> line([scale, 0], %)
|
|> line(end = [scale, 0])
|
||||||
|> line([0, -scale], %)
|
|> line(end = [0, -scale])
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(scale, %)
|
|> extrude(scale)
|
||||||
}
|
}
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
@ -1873,15 +1873,15 @@ tabs_l = startSketchOn({
|
|||||||
x = dfsfs + dfsfsd as y
|
x = dfsfs + dfsfsd as y
|
||||||
|
|
||||||
sg = startSketchOn(XY)
|
sg = startSketchOn(XY)
|
||||||
|> startProfileAt(pos, %) as foo
|
|> startProfile(at = pos) as foo
|
||||||
|> line([0, scale], %)
|
|> line([0, scale])
|
||||||
|> line([scale, 0], %) as bar
|
|> line([scale, 0]) as bar
|
||||||
|> line([0 as baz, -scale] as qux, %)
|
|> line([0 as baz, -scale] as qux)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(scale, %)
|
|> extrude(length = scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
cube(0, 0) as cub
|
cube(pos = 0, scale = 0) as cub
|
||||||
"#;
|
"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
@ -1892,18 +1892,18 @@ cube(0, 0) as cub
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_recast_with_bad_indentation() {
|
fn test_recast_with_bad_indentation() {
|
||||||
let some_program_string = r#"part001 = startSketchOn(XY)
|
let some_program_string = r#"part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([0.0, 5.0], %)
|
|> startProfile(at = [0.0, 5.0])
|
||||||
|> line([0.4900857016, -0.0240763666], %)
|
|> line(end = [0.4900857016, -0.0240763666])
|
||||||
|> line([0.6804562304, 0.9087880491], %)"#;
|
|> line(end = [0.6804562304, 0.9087880491])"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
let recasted = program.recast(&Default::default(), 0);
|
let recasted = program.recast(&Default::default(), 0);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
recasted,
|
recasted,
|
||||||
r#"part001 = startSketchOn(XY)
|
r#"part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([0.0, 5.0], %)
|
|> startProfile(at = [0.0, 5.0])
|
||||||
|> line([0.4900857016, -0.0240763666], %)
|
|> line(end = [0.4900857016, -0.0240763666])
|
||||||
|> line([0.6804562304, 0.9087880491], %)
|
|> line(end = [0.6804562304, 0.9087880491])
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1911,38 +1911,38 @@ cube(0, 0) as cub
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_recast_with_bad_indentation_and_inline_comment() {
|
fn test_recast_with_bad_indentation_and_inline_comment() {
|
||||||
let some_program_string = r#"part001 = startSketchOn(XY)
|
let some_program_string = r#"part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([0.0, 5.0], %)
|
|> startProfile(at = [0.0, 5.0])
|
||||||
|> line([0.4900857016, -0.0240763666], %) // hello world
|
|> line(end = [0.4900857016, -0.0240763666]) // hello world
|
||||||
|> line([0.6804562304, 0.9087880491], %)"#;
|
|> line(end = [0.6804562304, 0.9087880491])"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
let recasted = program.recast(&Default::default(), 0);
|
let recasted = program.recast(&Default::default(), 0);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
recasted,
|
recasted,
|
||||||
r#"part001 = startSketchOn(XY)
|
r#"part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([0.0, 5.0], %)
|
|> startProfile(at = [0.0, 5.0])
|
||||||
|> line([0.4900857016, -0.0240763666], %) // hello world
|
|> line(end = [0.4900857016, -0.0240763666]) // hello world
|
||||||
|> line([0.6804562304, 0.9087880491], %)
|
|> line(end = [0.6804562304, 0.9087880491])
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_recast_with_bad_indentation_and_line_comment() {
|
fn test_recast_with_bad_indentation_and_line_comment() {
|
||||||
let some_program_string = r#"part001 = startSketchOn(XY)
|
let some_program_string = r#"part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([0.0, 5.0], %)
|
|> startProfile(at = [0.0, 5.0])
|
||||||
|> line([0.4900857016, -0.0240763666], %)
|
|> line(end = [0.4900857016, -0.0240763666])
|
||||||
// hello world
|
// hello world
|
||||||
|> line([0.6804562304, 0.9087880491], %)"#;
|
|> line(end = [0.6804562304, 0.9087880491])"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
let recasted = program.recast(&Default::default(), 0);
|
let recasted = program.recast(&Default::default(), 0);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
recasted,
|
recasted,
|
||||||
r#"part001 = startSketchOn(XY)
|
r#"part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([0.0, 5.0], %)
|
|> startProfile(at = [0.0, 5.0])
|
||||||
|> line([0.4900857016, -0.0240763666], %)
|
|> line(end = [0.4900857016, -0.0240763666])
|
||||||
// hello world
|
// hello world
|
||||||
|> line([0.6804562304, 0.9087880491], %)
|
|> line(end = [0.6804562304, 0.9087880491])
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2085,7 +2085,7 @@ thing = 'foo'
|
|||||||
/* comment at start */
|
/* comment at start */
|
||||||
|
|
||||||
mySk1 = startSketchOn(XY)
|
mySk1 = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)"#;
|
|> startProfile(at = [0, 0])"#;
|
||||||
let program = crate::parsing::top_level_parse(test_program).unwrap();
|
let program = crate::parsing::top_level_parse(test_program).unwrap();
|
||||||
|
|
||||||
let recasted = program.recast(&Default::default(), 0);
|
let recasted = program.recast(&Default::default(), 0);
|
||||||
@ -2094,7 +2094,7 @@ mySk1 = startSketchOn(XY)
|
|||||||
r#"/* comment at start */
|
r#"/* comment at start */
|
||||||
|
|
||||||
mySk1 = startSketchOn(XY)
|
mySk1 = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2103,7 +2103,7 @@ mySk1 = startSketchOn(XY)
|
|||||||
fn test_recast_lots_of_comments() {
|
fn test_recast_lots_of_comments() {
|
||||||
let some_program_string = r#"// comment at start
|
let some_program_string = r#"// comment at start
|
||||||
mySk1 = startSketchOn(XY)
|
mySk1 = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(endAbsolute = [1, 1])
|
|> line(endAbsolute = [1, 1])
|
||||||
// comment here
|
// comment here
|
||||||
|> line(endAbsolute = [0, 1], tag = $myTag)
|
|> line(endAbsolute = [0, 1], tag = $myTag)
|
||||||
@ -2112,10 +2112,10 @@ mySk1 = startSketchOn(XY)
|
|||||||
here
|
here
|
||||||
*/
|
*/
|
||||||
// a comment between pipe expression statements
|
// a comment between pipe expression statements
|
||||||
|> rx(90, %)
|
|> rx(90)
|
||||||
// and another with just white space between others below
|
// and another with just white space between others below
|
||||||
|> ry(45, %)
|
|> ry(45)
|
||||||
|> rx(45, %)
|
|> rx(45)
|
||||||
// one more for good measure"#;
|
// one more for good measure"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
@ -2124,7 +2124,7 @@ mySk1 = startSketchOn(XY)
|
|||||||
recasted,
|
recasted,
|
||||||
r#"// comment at start
|
r#"// comment at start
|
||||||
mySk1 = startSketchOn(XY)
|
mySk1 = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(endAbsolute = [1, 1])
|
|> line(endAbsolute = [1, 1])
|
||||||
// comment here
|
// comment here
|
||||||
|> line(endAbsolute = [0, 1], tag = $myTag)
|
|> line(endAbsolute = [0, 1], tag = $myTag)
|
||||||
@ -2132,10 +2132,10 @@ mySk1 = startSketchOn(XY)
|
|||||||
/* and
|
/* and
|
||||||
here */
|
here */
|
||||||
// a comment between pipe expression statements
|
// a comment between pipe expression statements
|
||||||
|> rx(90, %)
|
|> rx(90)
|
||||||
// and another with just white space between others below
|
// and another with just white space between others below
|
||||||
|> ry(45, %)
|
|> ry(45)
|
||||||
|> rx(45, %)
|
|> rx(45)
|
||||||
// one more for good measure
|
// one more for good measure
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
@ -2223,10 +2223,10 @@ myVar3 = 6
|
|||||||
myAng = 40
|
myAng = 40
|
||||||
myAng2 = 134
|
myAng2 = 134
|
||||||
part001 = startSketchOn(XY)
|
part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line([1, 3.82], %, $seg01) // ln-should-get-tag
|
|> line(end = [1, 3.82], tag = $seg01) // ln-should-get-tag
|
||||||
|> angledLine(angle = -foo(seg01, myVar, %), length = myVar) // ln-lineTo-xAbsolute should use angleToMatchLengthX helper
|
|> angledLine(angle = -foo(x = seg01, y = myVar, z = %), length = myVar) // ln-lineTo-xAbsolute should use angleToMatchLengthX helper
|
||||||
|> angledLine(angle = -bar(seg01, myVar, %), length = myVar) // ln-lineTo-yAbsolute should use angleToMatchLengthY helper"#;
|
|> angledLine(angle = -bar(x = seg01, y = myVar, z = %), length = myVar) // ln-lineTo-yAbsolute should use angleToMatchLengthY helper"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
let recasted = program.recast(&Default::default(), 0);
|
let recasted = program.recast(&Default::default(), 0);
|
||||||
@ -2241,10 +2241,10 @@ myVar3 = 6
|
|||||||
myAng = 40
|
myAng = 40
|
||||||
myAng2 = 134
|
myAng2 = 134
|
||||||
part001 = startSketchOn(XY)
|
part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line([1, 3.82], %, $seg01) // ln-should-get-tag
|
|> line(end = [1, 3.82], tag = $seg01) // ln-should-get-tag
|
||||||
|> angledLine(angle = -foo(seg01, myVar, %), length = myVar) // ln-lineTo-xAbsolute should use angleToMatchLengthX helper
|
|> angledLine(angle = -foo(x = seg01, y = myVar, z = %), length = myVar) // ln-lineTo-xAbsolute should use angleToMatchLengthX helper
|
||||||
|> angledLine(angle = -bar(seg01, myVar, %), length = myVar) // ln-lineTo-yAbsolute should use angleToMatchLengthY helper
|
|> angledLine(angle = -bar(x = seg01, y = myVar, z = %), length = myVar) // ln-lineTo-yAbsolute should use angleToMatchLengthY helper
|
||||||
"#;
|
"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
@ -2262,8 +2262,8 @@ part001 = startSketchOn(XY)
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_recast_after_rename_std() {
|
fn test_recast_after_rename_std() {
|
||||||
let some_program_string = r#"part001 = startSketchOn(XY)
|
let some_program_string = r#"part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([0.0000000000, 5.0000000000], %)
|
|> startProfile(at = [0.0000000000, 5.0000000000])
|
||||||
|> line([0.4900857016, -0.0240763666], %)
|
|> line(end = [0.4900857016, -0.0240763666])
|
||||||
|
|
||||||
part002 = "part002"
|
part002 = "part002"
|
||||||
things = [part001, 0.0]
|
things = [part001, 0.0]
|
||||||
@ -2282,8 +2282,8 @@ fn ghi(part001) {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
recasted,
|
recasted,
|
||||||
r#"mySuperCoolPart = startSketchOn(XY)
|
r#"mySuperCoolPart = startSketchOn(XY)
|
||||||
|> startProfileAt([0.0, 5.0], %)
|
|> startProfile(at = [0.0, 5.0])
|
||||||
|> line([0.4900857016, -0.0240763666], %)
|
|> line(end = [0.4900857016, -0.0240763666])
|
||||||
|
|
||||||
part002 = "part002"
|
part002 = "part002"
|
||||||
things = [mySuperCoolPart, 0.0]
|
things = [mySuperCoolPart, 0.0]
|
||||||
@ -2319,24 +2319,24 @@ fn ghi(part001) {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_recast_trailing_comma() {
|
fn test_recast_trailing_comma() {
|
||||||
let some_program_string = r#"startSketchOn(XY)
|
let some_program_string = r#"startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> arc({
|
|> arc({
|
||||||
radius = 1,
|
radius = 1,
|
||||||
angle_start = 0,
|
angle_start = 0,
|
||||||
angle_end = 180,
|
angle_end = 180,
|
||||||
}, %)"#;
|
})"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
let recasted = program.recast(&Default::default(), 0);
|
let recasted = program.recast(&Default::default(), 0);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
recasted,
|
recasted,
|
||||||
r#"startSketchOn(XY)
|
r#"startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> arc({
|
|> arc({
|
||||||
radius = 1,
|
radius = 1,
|
||||||
angle_start = 0,
|
angle_start = 0,
|
||||||
angle_end = 180
|
angle_end = 180
|
||||||
}, %)
|
})
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2348,12 +2348,12 @@ l = 8
|
|||||||
h = 10
|
h = 10
|
||||||
|
|
||||||
firstExtrude = startSketchOn(XY)
|
firstExtrude = startSketchOn(XY)
|
||||||
|> startProfileAt([0,0], %)
|
|> startProfile(at = [0,0])
|
||||||
|> line([0, l], %)
|
|> line(end = [0, l])
|
||||||
|> line([w, 0], %)
|
|> line(end = [w, 0])
|
||||||
|> line([0, -l], %)
|
|> line(end = [0, -l])
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(h, %)
|
|> extrude(h)
|
||||||
"#;
|
"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
@ -2365,12 +2365,12 @@ l = 8
|
|||||||
h = 10
|
h = 10
|
||||||
|
|
||||||
firstExtrude = startSketchOn(XY)
|
firstExtrude = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line([0, l], %)
|
|> line(end = [0, l])
|
||||||
|> line([w, 0], %)
|
|> line(end = [w, 0])
|
||||||
|> line([0, -l], %)
|
|> line(end = [0, -l])
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(h, %)
|
|> extrude(h)
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2385,12 +2385,12 @@ h = 10
|
|||||||
// It has multiple lines
|
// It has multiple lines
|
||||||
// And it's really long
|
// And it's really long
|
||||||
firstExtrude = startSketchOn(XY)
|
firstExtrude = startSketchOn(XY)
|
||||||
|> startProfileAt([0,0], %)
|
|> startProfile(at = [0,0])
|
||||||
|> line([0, l], %)
|
|> line(end = [0, l])
|
||||||
|> line([w, 0], %)
|
|> line(end = [w, 0])
|
||||||
|> line([0, -l], %)
|
|> line(end = [0, -l])
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(h, %)
|
|> extrude(h)
|
||||||
"#;
|
"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
@ -2405,12 +2405,12 @@ h = 10
|
|||||||
// It has multiple lines
|
// It has multiple lines
|
||||||
// And it's really long
|
// And it's really long
|
||||||
firstExtrude = startSketchOn(XY)
|
firstExtrude = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line([0, l], %)
|
|> line(end = [0, l])
|
||||||
|> line([w, 0], %)
|
|> line(end = [w, 0])
|
||||||
|> line([0, -l], %)
|
|> line(end = [0, -l])
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(h, %)
|
|> extrude(h)
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2430,11 +2430,11 @@ firstExtrude = startSketchOn(XY)
|
|||||||
thickness = 0.5
|
thickness = 0.5
|
||||||
|
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line([0, -(wallMountL - thickness)], %)
|
|> line(end = [0, -(wallMountL - thickness)])
|
||||||
|> line([0, -(5 - thickness)], %)
|
|> line(end = [0, -(5 - thickness)])
|
||||||
|> line([0, -(5 - 1)], %)
|
|> line(end = [0, -(5 - 1)])
|
||||||
|> line([0, -(-5 - 1)], %)"#;
|
|> line(end = [0, -(-5 - 1)])"#;
|
||||||
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
let program = crate::parsing::top_level_parse(some_program_string).unwrap();
|
||||||
|
|
||||||
let recasted = program.recast(&Default::default(), 0);
|
let recasted = program.recast(&Default::default(), 0);
|
||||||
@ -2560,9 +2560,13 @@ sketch002 = startSketchOn({
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn unparse_fn_unnamed() {
|
fn unparse_fn_unnamed() {
|
||||||
let input = r#"squares_out = reduce(arr, 0: number, fn(i, squares) {
|
let input = r#"squares_out = reduce(
|
||||||
return 1
|
arr,
|
||||||
})
|
n = 0: number,
|
||||||
|
f = fn(i, squares) {
|
||||||
|
return 1
|
||||||
|
},
|
||||||
|
)
|
||||||
"#;
|
"#;
|
||||||
let ast = crate::parsing::top_level_parse(input).unwrap();
|
let ast = crate::parsing::top_level_parse(input).unwrap();
|
||||||
let actual = ast.recast(&FormatOptions::new(), 0);
|
let actual = ast.recast(&FormatOptions::new(), 0);
|
||||||
|
@ -117,7 +117,7 @@ export fn fillet(
|
|||||||
/// return sg
|
/// return sg
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// part001 = cube([0,0], 20)
|
/// part001 = cube(pos = [0,0], scale = 20)
|
||||||
/// |> close(tag = $line1)
|
/// |> close(tag = $line1)
|
||||||
/// |> extrude(length = 20)
|
/// |> extrude(length = 20)
|
||||||
/// // We tag the chamfer to reference it later.
|
/// // We tag the chamfer to reference it later.
|
||||||
|
@ -88,8 +88,8 @@ export type string
|
|||||||
/// |> close()
|
/// |> close()
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// rect([0, 0])
|
/// rect(origin = [0, 0])
|
||||||
/// rect([20, 0])
|
/// rect(origin = [20, 0])
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Those tags would only be available in the `rect` function and not globally.
|
/// Those tags would only be available in the `rect` function and not globally.
|
||||||
@ -116,8 +116,8 @@ export type string
|
|||||||
/// |> close()
|
/// |> close()
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// rect([0, 0])
|
/// rect(origin = [0, 0])
|
||||||
/// myRect = rect([20, 0])
|
/// myRect = rect(origin = [20, 0])
|
||||||
///
|
///
|
||||||
/// myRect
|
/// myRect
|
||||||
/// |> extrude(length = 10)
|
/// |> extrude(length = 10)
|
||||||
|
@ -79,7 +79,8 @@ description: Result of parsing add_lots.kcl
|
|||||||
"name": "i",
|
"name": "i",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "Identifier"
|
"type": "Identifier"
|
||||||
}
|
},
|
||||||
|
"labeled": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"start": 0,
|
"start": 0,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user