Move more KCL executor tests into simulation tests (#4540)

This commit is contained in:
Adam Chalmers
2024-11-21 18:33:02 -06:00
committed by GitHub
parent 455fb49fb6
commit 56ef859bb3
38 changed files with 77959 additions and 36 deletions

View File

@ -15,6 +15,14 @@ redo-kcl-stdlib-docs:
TWENTY_TWENTY=overwrite {{cnr}} -p kcl-lib kcl_test_example
EXPECTORATE=overwrite {{cnr}} -p kcl-lib docs::gen_std_tests::test_generate_stdlib
# Copy a test KCL file from executor tests into a new simulation test.
copy-exec-test-into-sim-test test_name:
mkdir -p kcl/tests/{{test_name}}
cp tests/executor/inputs/{{test_name}}.kcl kcl/tests/{{test_name}}/input.kcl
zoo kcl fmt -w kcl/tests/{{test_name}}/input.kcl
just new-sim-test {{test_name}}
# Create a new KCL deterministic simulation test case.
new-sim-test test_name render_to_png="true":
# Add the various tests for this new test case.

View File

@ -1604,3 +1604,192 @@ mod sketch_on_chamfer_two_times_different_order {
super::execute(TEST_NAME, true).await
}
}
mod parametric_with_tan_arc {
const TEST_NAME: &str = "parametric_with_tan_arc";
/// Test tokenizing KCL.
#[test]
fn tokenize() {
super::tokenize(TEST_NAME)
}
/// Test parsing KCL.
#[test]
fn parse() {
super::parse(TEST_NAME)
}
/// Test that parsing and unparsing KCL produces the original KCL input.
#[test]
fn unparse() {
super::unparse(TEST_NAME)
}
/// Test that KCL is executed correctly.
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute() {
super::execute(TEST_NAME, true).await
}
}
mod parametric {
const TEST_NAME: &str = "parametric";
/// Test tokenizing KCL.
#[test]
fn tokenize() {
super::tokenize(TEST_NAME)
}
/// Test parsing KCL.
#[test]
fn parse() {
super::parse(TEST_NAME)
}
/// Test that parsing and unparsing KCL produces the original KCL input.
#[test]
fn unparse() {
super::unparse(TEST_NAME)
}
/// Test that KCL is executed correctly.
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute() {
super::execute(TEST_NAME, true).await
}
}
mod angled_line {
const TEST_NAME: &str = "angled_line";
/// Test tokenizing KCL.
#[test]
fn tokenize() {
super::tokenize(TEST_NAME)
}
/// Test parsing KCL.
#[test]
fn parse() {
super::parse(TEST_NAME)
}
/// Test that parsing and unparsing KCL produces the original KCL input.
#[test]
fn unparse() {
super::unparse(TEST_NAME)
}
/// Test that KCL is executed correctly.
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute() {
super::execute(TEST_NAME, true).await
}
}
mod function_sketch_with_position {
const TEST_NAME: &str = "function_sketch_with_position";
/// Test tokenizing KCL.
#[test]
fn tokenize() {
super::tokenize(TEST_NAME)
}
/// Test parsing KCL.
#[test]
fn parse() {
super::parse(TEST_NAME)
}
/// Test that parsing and unparsing KCL produces the original KCL input.
#[test]
fn unparse() {
super::unparse(TEST_NAME)
}
/// Test that KCL is executed correctly.
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute() {
super::execute(TEST_NAME, true).await
}
}
mod function_sketch {
const TEST_NAME: &str = "function_sketch";
/// Test tokenizing KCL.
#[test]
fn tokenize() {
super::tokenize(TEST_NAME)
}
/// Test parsing KCL.
#[test]
fn parse() {
super::parse(TEST_NAME)
}
/// Test that parsing and unparsing KCL produces the original KCL input.
#[test]
fn unparse() {
super::unparse(TEST_NAME)
}
/// Test that KCL is executed correctly.
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute() {
super::execute(TEST_NAME, true).await
}
}
mod i_shape {
const TEST_NAME: &str = "i_shape";
/// Test tokenizing KCL.
#[test]
fn tokenize() {
super::tokenize(TEST_NAME)
}
/// Test parsing KCL.
#[test]
fn parse() {
super::parse(TEST_NAME)
}
/// Test that parsing and unparsing KCL produces the original KCL input.
#[test]
fn unparse() {
super::unparse(TEST_NAME)
}
/// Test that KCL is executed correctly.
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute() {
super::execute(TEST_NAME, true).await
}
}
mod kittycad_svg {
const TEST_NAME: &str = "kittycad_svg";
/// Test tokenizing KCL.
#[test]
fn tokenize() {
super::tokenize(TEST_NAME)
}
/// Test parsing KCL.
#[test]
fn parse() {
super::parse(TEST_NAME)
}
/// Test that parsing and unparsing KCL produces the original KCL input.
#[test]
fn unparse() {
super::unparse(TEST_NAME)
}
/// Test that KCL is executed correctly.
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute() {
super::execute(TEST_NAME, true).await
}
}

View File

@ -0,0 +1,433 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing angled_line.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 265,
"id": {
"end": 7,
"name": "part001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 28,
"raw": "'XY'",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 23,
"name": "startSketchOn",
"start": 10,
"type": "Identifier"
},
"end": 29,
"optional": false,
"start": 10,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 55,
"raw": "4.83",
"start": 51,
"type": "Literal",
"type": "Literal",
"value": 4.83
},
{
"end": 62,
"raw": "12.56",
"start": 57,
"type": "Literal",
"type": "Literal",
"value": 12.56
}
],
"end": 63,
"start": 50,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 66,
"start": 65,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 49,
"name": "startProfileAt",
"start": 35,
"type": "Identifier"
},
"end": 67,
"optional": false,
"start": 35,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 83,
"raw": "15.1",
"start": 79,
"type": "Literal",
"type": "Literal",
"value": 15.1
},
{
"end": 89,
"raw": "2.48",
"start": 85,
"type": "Literal",
"type": "Literal",
"value": 2.48
}
],
"end": 90,
"start": 78,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 93,
"start": 92,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 77,
"name": "line",
"start": 73,
"type": "Identifier"
},
"end": 94,
"optional": false,
"start": 73,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 110,
"raw": "3.15",
"start": 106,
"type": "Literal",
"type": "Literal",
"value": 3.15
},
{
"argument": {
"end": 117,
"raw": "9.85",
"start": 113,
"type": "Literal",
"type": "Literal",
"value": 9.85
},
"end": 117,
"operator": "-",
"start": 112,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 118,
"start": 105,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 121,
"start": 120,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 129,
"start": 123,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "seg01"
}
],
"callee": {
"end": 104,
"name": "line",
"start": 100,
"type": "Identifier"
},
"end": 130,
"optional": false,
"start": 100,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"argument": {
"end": 148,
"raw": "15.17",
"start": 143,
"type": "Literal",
"type": "Literal",
"value": 15.17
},
"end": 148,
"operator": "-",
"start": 142,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"argument": {
"end": 154,
"raw": "4.1",
"start": 151,
"type": "Literal",
"type": "Literal",
"value": 4.1
},
"end": 154,
"operator": "-",
"start": 150,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 155,
"start": 141,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 158,
"start": 157,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 140,
"name": "line",
"start": 136,
"type": "Identifier"
},
"end": 159,
"optional": false,
"start": 136,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"arguments": [
{
"end": 189,
"name": "seg01",
"start": 184,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 183,
"name": "segAng",
"start": 177,
"type": "Identifier"
},
"end": 190,
"optional": false,
"start": 177,
"type": "CallExpression",
"type": "CallExpression"
},
{
"end": 197,
"raw": "12.35",
"start": 192,
"type": "Literal",
"type": "Literal",
"value": 12.35
}
],
"end": 198,
"start": 176,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 201,
"start": 200,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 175,
"name": "angledLine",
"start": 165,
"type": "Identifier"
},
"end": 202,
"optional": false,
"start": 165,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"argument": {
"end": 220,
"raw": "13.02",
"start": 215,
"type": "Literal",
"type": "Literal",
"value": 13.02
},
"end": 220,
"operator": "-",
"start": 214,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"end": 227,
"raw": "10.03",
"start": 222,
"type": "Literal",
"type": "Literal",
"value": 10.03
}
],
"end": 228,
"start": 213,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 231,
"start": 230,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 212,
"name": "line",
"start": 208,
"type": "Identifier"
},
"end": 232,
"optional": false,
"start": 208,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 245,
"start": 244,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 243,
"name": "close",
"start": 238,
"type": "Identifier"
},
"end": 246,
"optional": false,
"start": 238,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 261,
"raw": "4",
"start": 260,
"type": "Literal",
"type": "Literal",
"value": 4
},
{
"end": 264,
"start": 263,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 259,
"name": "extrude",
"start": 252,
"type": "Identifier"
},
"end": 265,
"optional": false,
"start": 252,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 265,
"start": 10,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 265,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 266,
"start": 0
}
}

View File

@ -0,0 +1,9 @@
part001 = startSketchOn('XY')
|> startProfileAt([4.83, 12.56], %)
|> line([15.1, 2.48], %)
|> line([3.15, -9.85], %, $seg01)
|> line([-15.17, -4.1], %)
|> angledLine([segAng(seg01), 12.35], %)
|> line([-13.02, 10.03], %)
|> close(%)
|> extrude(4, %)

View File

@ -0,0 +1,432 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing angled_line.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"part001": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
73,
94,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
100,
130,
0
],
"tag": {
"end": 129,
"start": 123,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
136,
159,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
165,
202,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
208,
232,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
238,
246,
0
],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
73,
94,
0
]
},
"from": [
4.83,
12.56
],
"tag": null,
"to": [
19.93,
15.04
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
100,
130,
0
]
},
"from": [
19.93,
15.04
],
"tag": {
"end": 129,
"start": 123,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
23.08,
5.19
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
136,
159,
0
]
},
"from": [
23.08,
5.19
],
"tag": null,
"to": [
7.91,
1.09
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
165,
202,
0
]
},
"from": [
7.91,
1.09
],
"tag": null,
"to": [
11.6718,
-10.6731
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
208,
232,
0
]
},
"from": [
11.6718,
-10.6731
],
"tag": null,
"to": [
-1.3482,
-0.6431
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
238,
246,
0
]
},
"from": [
-1.3482,
-0.6431
],
"tag": null,
"to": [
4.83,
12.56
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
4.83,
12.56
],
"to": [
4.83,
12.56
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
35,
67,
0
]
}
},
"tags": {
"seg01": {
"type": "TagIdentifier",
"value": "seg01",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
100,
130,
0
]
},
"from": [
19.93,
15.040000000000001
],
"tag": {
"end": 129,
"start": 123,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
23.08,
5.190000000000001
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
100,
130,
0
],
"tag": {
"end": 129,
"start": 123,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
123,
129,
0
]
}
]
}
},
"__meta": [
{
"sourceRange": [
35,
67,
0
]
}
]
},
"height": 4.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"__meta": [
{
"sourceRange": [
35,
67,
0
]
}
]
},
"seg01": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "seg01",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
100,
130,
0
]
},
"from": [
19.93,
15.040000000000001
],
"tag": {
"end": 129,
"start": 123,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
23.08,
5.190000000000001
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
100,
130,
0
],
"tag": {
"end": 129,
"start": 123,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
123,
129,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -0,0 +1,771 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing angled_line.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 7,
"value": "part001"
},
{
"type": "whitespace",
"start": 7,
"end": 8,
"value": " "
},
{
"type": "operator",
"start": 8,
"end": 9,
"value": "="
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "word",
"start": 10,
"end": 23,
"value": "startSketchOn"
},
{
"type": "brace",
"start": 23,
"end": 24,
"value": "("
},
{
"type": "string",
"start": 24,
"end": 28,
"value": "'XY'"
},
{
"type": "brace",
"start": 28,
"end": 29,
"value": ")"
},
{
"type": "whitespace",
"start": 29,
"end": 32,
"value": "\n "
},
{
"type": "operator",
"start": 32,
"end": 34,
"value": "|>"
},
{
"type": "whitespace",
"start": 34,
"end": 35,
"value": " "
},
{
"type": "word",
"start": 35,
"end": 49,
"value": "startProfileAt"
},
{
"type": "brace",
"start": 49,
"end": 50,
"value": "("
},
{
"type": "brace",
"start": 50,
"end": 51,
"value": "["
},
{
"type": "number",
"start": 51,
"end": 55,
"value": "4.83"
},
{
"type": "comma",
"start": 55,
"end": 56,
"value": ","
},
{
"type": "whitespace",
"start": 56,
"end": 57,
"value": " "
},
{
"type": "number",
"start": 57,
"end": 62,
"value": "12.56"
},
{
"type": "brace",
"start": 62,
"end": 63,
"value": "]"
},
{
"type": "comma",
"start": 63,
"end": 64,
"value": ","
},
{
"type": "whitespace",
"start": 64,
"end": 65,
"value": " "
},
{
"type": "operator",
"start": 65,
"end": 66,
"value": "%"
},
{
"type": "brace",
"start": 66,
"end": 67,
"value": ")"
},
{
"type": "whitespace",
"start": 67,
"end": 70,
"value": "\n "
},
{
"type": "operator",
"start": 70,
"end": 72,
"value": "|>"
},
{
"type": "whitespace",
"start": 72,
"end": 73,
"value": " "
},
{
"type": "word",
"start": 73,
"end": 77,
"value": "line"
},
{
"type": "brace",
"start": 77,
"end": 78,
"value": "("
},
{
"type": "brace",
"start": 78,
"end": 79,
"value": "["
},
{
"type": "number",
"start": 79,
"end": 83,
"value": "15.1"
},
{
"type": "comma",
"start": 83,
"end": 84,
"value": ","
},
{
"type": "whitespace",
"start": 84,
"end": 85,
"value": " "
},
{
"type": "number",
"start": 85,
"end": 89,
"value": "2.48"
},
{
"type": "brace",
"start": 89,
"end": 90,
"value": "]"
},
{
"type": "comma",
"start": 90,
"end": 91,
"value": ","
},
{
"type": "whitespace",
"start": 91,
"end": 92,
"value": " "
},
{
"type": "operator",
"start": 92,
"end": 93,
"value": "%"
},
{
"type": "brace",
"start": 93,
"end": 94,
"value": ")"
},
{
"type": "whitespace",
"start": 94,
"end": 97,
"value": "\n "
},
{
"type": "operator",
"start": 97,
"end": 99,
"value": "|>"
},
{
"type": "whitespace",
"start": 99,
"end": 100,
"value": " "
},
{
"type": "word",
"start": 100,
"end": 104,
"value": "line"
},
{
"type": "brace",
"start": 104,
"end": 105,
"value": "("
},
{
"type": "brace",
"start": 105,
"end": 106,
"value": "["
},
{
"type": "number",
"start": 106,
"end": 110,
"value": "3.15"
},
{
"type": "comma",
"start": 110,
"end": 111,
"value": ","
},
{
"type": "whitespace",
"start": 111,
"end": 112,
"value": " "
},
{
"type": "operator",
"start": 112,
"end": 113,
"value": "-"
},
{
"type": "number",
"start": 113,
"end": 117,
"value": "9.85"
},
{
"type": "brace",
"start": 117,
"end": 118,
"value": "]"
},
{
"type": "comma",
"start": 118,
"end": 119,
"value": ","
},
{
"type": "whitespace",
"start": 119,
"end": 120,
"value": " "
},
{
"type": "operator",
"start": 120,
"end": 121,
"value": "%"
},
{
"type": "comma",
"start": 121,
"end": 122,
"value": ","
},
{
"type": "whitespace",
"start": 122,
"end": 123,
"value": " "
},
{
"type": "dollar",
"start": 123,
"end": 124,
"value": "$"
},
{
"type": "word",
"start": 124,
"end": 129,
"value": "seg01"
},
{
"type": "brace",
"start": 129,
"end": 130,
"value": ")"
},
{
"type": "whitespace",
"start": 130,
"end": 133,
"value": "\n "
},
{
"type": "operator",
"start": 133,
"end": 135,
"value": "|>"
},
{
"type": "whitespace",
"start": 135,
"end": 136,
"value": " "
},
{
"type": "word",
"start": 136,
"end": 140,
"value": "line"
},
{
"type": "brace",
"start": 140,
"end": 141,
"value": "("
},
{
"type": "brace",
"start": 141,
"end": 142,
"value": "["
},
{
"type": "operator",
"start": 142,
"end": 143,
"value": "-"
},
{
"type": "number",
"start": 143,
"end": 148,
"value": "15.17"
},
{
"type": "comma",
"start": 148,
"end": 149,
"value": ","
},
{
"type": "whitespace",
"start": 149,
"end": 150,
"value": " "
},
{
"type": "operator",
"start": 150,
"end": 151,
"value": "-"
},
{
"type": "number",
"start": 151,
"end": 154,
"value": "4.1"
},
{
"type": "brace",
"start": 154,
"end": 155,
"value": "]"
},
{
"type": "comma",
"start": 155,
"end": 156,
"value": ","
},
{
"type": "whitespace",
"start": 156,
"end": 157,
"value": " "
},
{
"type": "operator",
"start": 157,
"end": 158,
"value": "%"
},
{
"type": "brace",
"start": 158,
"end": 159,
"value": ")"
},
{
"type": "whitespace",
"start": 159,
"end": 162,
"value": "\n "
},
{
"type": "operator",
"start": 162,
"end": 164,
"value": "|>"
},
{
"type": "whitespace",
"start": 164,
"end": 165,
"value": " "
},
{
"type": "word",
"start": 165,
"end": 175,
"value": "angledLine"
},
{
"type": "brace",
"start": 175,
"end": 176,
"value": "("
},
{
"type": "brace",
"start": 176,
"end": 177,
"value": "["
},
{
"type": "word",
"start": 177,
"end": 183,
"value": "segAng"
},
{
"type": "brace",
"start": 183,
"end": 184,
"value": "("
},
{
"type": "word",
"start": 184,
"end": 189,
"value": "seg01"
},
{
"type": "brace",
"start": 189,
"end": 190,
"value": ")"
},
{
"type": "comma",
"start": 190,
"end": 191,
"value": ","
},
{
"type": "whitespace",
"start": 191,
"end": 192,
"value": " "
},
{
"type": "number",
"start": 192,
"end": 197,
"value": "12.35"
},
{
"type": "brace",
"start": 197,
"end": 198,
"value": "]"
},
{
"type": "comma",
"start": 198,
"end": 199,
"value": ","
},
{
"type": "whitespace",
"start": 199,
"end": 200,
"value": " "
},
{
"type": "operator",
"start": 200,
"end": 201,
"value": "%"
},
{
"type": "brace",
"start": 201,
"end": 202,
"value": ")"
},
{
"type": "whitespace",
"start": 202,
"end": 205,
"value": "\n "
},
{
"type": "operator",
"start": 205,
"end": 207,
"value": "|>"
},
{
"type": "whitespace",
"start": 207,
"end": 208,
"value": " "
},
{
"type": "word",
"start": 208,
"end": 212,
"value": "line"
},
{
"type": "brace",
"start": 212,
"end": 213,
"value": "("
},
{
"type": "brace",
"start": 213,
"end": 214,
"value": "["
},
{
"type": "operator",
"start": 214,
"end": 215,
"value": "-"
},
{
"type": "number",
"start": 215,
"end": 220,
"value": "13.02"
},
{
"type": "comma",
"start": 220,
"end": 221,
"value": ","
},
{
"type": "whitespace",
"start": 221,
"end": 222,
"value": " "
},
{
"type": "number",
"start": 222,
"end": 227,
"value": "10.03"
},
{
"type": "brace",
"start": 227,
"end": 228,
"value": "]"
},
{
"type": "comma",
"start": 228,
"end": 229,
"value": ","
},
{
"type": "whitespace",
"start": 229,
"end": 230,
"value": " "
},
{
"type": "operator",
"start": 230,
"end": 231,
"value": "%"
},
{
"type": "brace",
"start": 231,
"end": 232,
"value": ")"
},
{
"type": "whitespace",
"start": 232,
"end": 235,
"value": "\n "
},
{
"type": "operator",
"start": 235,
"end": 237,
"value": "|>"
},
{
"type": "whitespace",
"start": 237,
"end": 238,
"value": " "
},
{
"type": "word",
"start": 238,
"end": 243,
"value": "close"
},
{
"type": "brace",
"start": 243,
"end": 244,
"value": "("
},
{
"type": "operator",
"start": 244,
"end": 245,
"value": "%"
},
{
"type": "brace",
"start": 245,
"end": 246,
"value": ")"
},
{
"type": "whitespace",
"start": 246,
"end": 249,
"value": "\n "
},
{
"type": "operator",
"start": 249,
"end": 251,
"value": "|>"
},
{
"type": "whitespace",
"start": 251,
"end": 252,
"value": " "
},
{
"type": "word",
"start": 252,
"end": 259,
"value": "extrude"
},
{
"type": "brace",
"start": 259,
"end": 260,
"value": "("
},
{
"type": "number",
"start": 260,
"end": 261,
"value": "4"
},
{
"type": "comma",
"start": 261,
"end": 262,
"value": ","
},
{
"type": "whitespace",
"start": 262,
"end": 263,
"value": " "
},
{
"type": "operator",
"start": 263,
"end": 264,
"value": "%"
},
{
"type": "brace",
"start": 264,
"end": 265,
"value": ")"
},
{
"type": "whitespace",
"start": 265,
"end": 266,
"value": "\n"
}
]
}

View File

@ -0,0 +1,463 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing function_sketch.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 211,
"id": {
"end": 6,
"name": "box",
"start": 3,
"type": "Identifier"
},
"init": {
"body": {
"body": [
{
"declarations": [
{
"end": 193,
"id": {
"end": 31,
"name": "myBox",
"start": 26,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 52,
"raw": "'XY'",
"start": 48,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 47,
"name": "startSketchOn",
"start": 34,
"type": "Identifier"
},
"end": 53,
"optional": false,
"start": 34,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 78,
"raw": "0",
"start": 77,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 81,
"raw": "0",
"start": 80,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 82,
"start": 76,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 85,
"start": 84,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 75,
"name": "startProfileAt",
"start": 61,
"type": "Identifier"
},
"end": 86,
"optional": false,
"start": 61,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 101,
"raw": "0",
"start": 100,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 104,
"name": "l",
"start": 103,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 105,
"start": 99,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 108,
"start": 107,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 98,
"name": "line",
"start": 94,
"type": "Identifier"
},
"end": 109,
"optional": false,
"start": 94,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 124,
"name": "w",
"start": 123,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 127,
"raw": "0",
"start": 126,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 128,
"start": 122,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 131,
"start": 130,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 121,
"name": "line",
"start": 117,
"type": "Identifier"
},
"end": 132,
"optional": false,
"start": 117,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 147,
"raw": "0",
"start": 146,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 151,
"name": "l",
"start": 150,
"type": "Identifier",
"type": "Identifier"
},
"end": 151,
"operator": "-",
"start": 149,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 152,
"start": 145,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 155,
"start": 154,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 144,
"name": "line",
"start": 140,
"type": "Identifier"
},
"end": 156,
"optional": false,
"start": 140,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 171,
"start": 170,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 169,
"name": "close",
"start": 164,
"type": "Identifier"
},
"end": 172,
"optional": false,
"start": 164,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 189,
"name": "h",
"start": 188,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 192,
"start": 191,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 187,
"name": "extrude",
"start": 180,
"type": "Identifier"
},
"end": 193,
"optional": false,
"start": 180,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 193,
"start": 34,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 26,
"type": "VariableDeclarator"
}
],
"end": 193,
"kind": "const",
"start": 26,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"argument": {
"end": 209,
"name": "myBox",
"start": 204,
"type": "Identifier",
"type": "Identifier"
},
"end": 209,
"start": 197,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"end": 211,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 197,
"start": 193,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 22
},
"end": 211,
"params": [
{
"type": "Parameter",
"identifier": {
"end": 11,
"name": "h",
"start": 10,
"type": "Identifier"
},
"optional": false
},
{
"type": "Parameter",
"identifier": {
"end": 14,
"name": "l",
"start": 13,
"type": "Identifier"
},
"optional": false
},
{
"type": "Parameter",
"identifier": {
"end": 17,
"name": "w",
"start": 16,
"type": "Identifier"
},
"optional": false
}
],
"start": 9,
"type": "FunctionExpression",
"type": "FunctionExpression"
},
"start": 3,
"type": "VariableDeclarator"
}
],
"end": 211,
"kind": "fn",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 234,
"id": {
"end": 218,
"name": "fnBox",
"start": 213,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 226,
"raw": "3",
"start": 225,
"type": "Literal",
"type": "Literal",
"value": 3
},
{
"end": 229,
"raw": "6",
"start": 228,
"type": "Literal",
"type": "Literal",
"value": 6
},
{
"end": 233,
"raw": "10",
"start": 231,
"type": "Literal",
"type": "Literal",
"value": 10
}
],
"callee": {
"end": 224,
"name": "box",
"start": 221,
"type": "Identifier"
},
"end": 234,
"optional": false,
"start": 221,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 213,
"type": "VariableDeclarator"
}
],
"end": 234,
"kind": "const",
"start": 213,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 235,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 213,
"start": 211,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}

View File

@ -0,0 +1,13 @@
fn box = (h, l, w) => {
myBox = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([0, l], %)
|> line([w, 0], %)
|> line([0, -l], %)
|> close(%)
|> extrude(h, %)
return myBox
}
fnBox = box(3, 6, 10)

View File

@ -0,0 +1,637 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing function_sketch.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"box": {
"type": "Function",
"expression": {
"body": {
"body": [
{
"declarations": [
{
"end": 193,
"id": {
"end": 31,
"name": "myBox",
"start": 26,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 52,
"raw": "'XY'",
"start": 48,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 47,
"name": "startSketchOn",
"start": 34,
"type": "Identifier"
},
"end": 53,
"optional": false,
"start": 34,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 78,
"raw": "0",
"start": 77,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 81,
"raw": "0",
"start": 80,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 82,
"start": 76,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 85,
"start": 84,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 75,
"name": "startProfileAt",
"start": 61,
"type": "Identifier"
},
"end": 86,
"optional": false,
"start": 61,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 101,
"raw": "0",
"start": 100,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 104,
"name": "l",
"start": 103,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 105,
"start": 99,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 108,
"start": 107,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 98,
"name": "line",
"start": 94,
"type": "Identifier"
},
"end": 109,
"optional": false,
"start": 94,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 124,
"name": "w",
"start": 123,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 127,
"raw": "0",
"start": 126,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 128,
"start": 122,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 131,
"start": 130,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 121,
"name": "line",
"start": 117,
"type": "Identifier"
},
"end": 132,
"optional": false,
"start": 117,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 147,
"raw": "0",
"start": 146,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 151,
"name": "l",
"start": 150,
"type": "Identifier",
"type": "Identifier"
},
"end": 151,
"operator": "-",
"start": 149,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 152,
"start": 145,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 155,
"start": 154,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 144,
"name": "line",
"start": 140,
"type": "Identifier"
},
"end": 156,
"optional": false,
"start": 140,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 171,
"start": 170,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 169,
"name": "close",
"start": 164,
"type": "Identifier"
},
"end": 172,
"optional": false,
"start": 164,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 189,
"name": "h",
"start": 188,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 192,
"start": 191,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 187,
"name": "extrude",
"start": 180,
"type": "Identifier"
},
"end": 193,
"optional": false,
"start": 180,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 193,
"start": 34,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 26,
"type": "VariableDeclarator"
}
],
"end": 193,
"kind": "const",
"start": 26,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"argument": {
"end": 209,
"name": "myBox",
"start": 204,
"type": "Identifier",
"type": "Identifier"
},
"end": 209,
"start": 197,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"end": 211,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 197,
"start": 193,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 22
},
"end": 211,
"params": [
{
"type": "Parameter",
"identifier": {
"end": 11,
"name": "h",
"start": 10,
"type": "Identifier"
},
"optional": false
},
{
"type": "Parameter",
"identifier": {
"end": 14,
"name": "l",
"start": 13,
"type": "Identifier"
},
"optional": false
},
{
"type": "Parameter",
"identifier": {
"end": 17,
"name": "w",
"start": 16,
"type": "Identifier"
},
"optional": false
}
],
"start": 9,
"type": "FunctionExpression"
},
"memory": {
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
},
"__meta": [
{
"sourceRange": [
9,
211,
0
]
}
]
},
"fnBox": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
94,
109,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
117,
132,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
140,
156,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
164,
172,
0
],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
94,
109,
0
]
},
"from": [
0.0,
0.0
],
"tag": null,
"to": [
0.0,
6.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
117,
132,
0
]
},
"from": [
0.0,
6.0
],
"tag": null,
"to": [
10.0,
6.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
140,
156,
0
]
},
"from": [
10.0,
6.0
],
"tag": null,
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
164,
172,
0
]
},
"from": [
10.0,
0.0
],
"tag": null,
"to": [
0.0,
0.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
61,
86,
0
]
}
},
"__meta": [
{
"sourceRange": [
61,
86,
0
]
}
]
},
"height": 3.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"__meta": [
{
"sourceRange": [
61,
86,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -0,0 +1,777 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing function_sketch.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "keyword",
"start": 0,
"end": 2,
"value": "fn"
},
{
"type": "whitespace",
"start": 2,
"end": 3,
"value": " "
},
{
"type": "word",
"start": 3,
"end": 6,
"value": "box"
},
{
"type": "whitespace",
"start": 6,
"end": 7,
"value": " "
},
{
"type": "operator",
"start": 7,
"end": 8,
"value": "="
},
{
"type": "whitespace",
"start": 8,
"end": 9,
"value": " "
},
{
"type": "brace",
"start": 9,
"end": 10,
"value": "("
},
{
"type": "word",
"start": 10,
"end": 11,
"value": "h"
},
{
"type": "comma",
"start": 11,
"end": 12,
"value": ","
},
{
"type": "whitespace",
"start": 12,
"end": 13,
"value": " "
},
{
"type": "word",
"start": 13,
"end": 14,
"value": "l"
},
{
"type": "comma",
"start": 14,
"end": 15,
"value": ","
},
{
"type": "whitespace",
"start": 15,
"end": 16,
"value": " "
},
{
"type": "word",
"start": 16,
"end": 17,
"value": "w"
},
{
"type": "brace",
"start": 17,
"end": 18,
"value": ")"
},
{
"type": "whitespace",
"start": 18,
"end": 19,
"value": " "
},
{
"type": "operator",
"start": 19,
"end": 21,
"value": "=>"
},
{
"type": "whitespace",
"start": 21,
"end": 22,
"value": " "
},
{
"type": "brace",
"start": 22,
"end": 23,
"value": "{"
},
{
"type": "whitespace",
"start": 23,
"end": 26,
"value": "\n "
},
{
"type": "word",
"start": 26,
"end": 31,
"value": "myBox"
},
{
"type": "whitespace",
"start": 31,
"end": 32,
"value": " "
},
{
"type": "operator",
"start": 32,
"end": 33,
"value": "="
},
{
"type": "whitespace",
"start": 33,
"end": 34,
"value": " "
},
{
"type": "word",
"start": 34,
"end": 47,
"value": "startSketchOn"
},
{
"type": "brace",
"start": 47,
"end": 48,
"value": "("
},
{
"type": "string",
"start": 48,
"end": 52,
"value": "'XY'"
},
{
"type": "brace",
"start": 52,
"end": 53,
"value": ")"
},
{
"type": "whitespace",
"start": 53,
"end": 58,
"value": "\n "
},
{
"type": "operator",
"start": 58,
"end": 60,
"value": "|>"
},
{
"type": "whitespace",
"start": 60,
"end": 61,
"value": " "
},
{
"type": "word",
"start": 61,
"end": 75,
"value": "startProfileAt"
},
{
"type": "brace",
"start": 75,
"end": 76,
"value": "("
},
{
"type": "brace",
"start": 76,
"end": 77,
"value": "["
},
{
"type": "number",
"start": 77,
"end": 78,
"value": "0"
},
{
"type": "comma",
"start": 78,
"end": 79,
"value": ","
},
{
"type": "whitespace",
"start": 79,
"end": 80,
"value": " "
},
{
"type": "number",
"start": 80,
"end": 81,
"value": "0"
},
{
"type": "brace",
"start": 81,
"end": 82,
"value": "]"
},
{
"type": "comma",
"start": 82,
"end": 83,
"value": ","
},
{
"type": "whitespace",
"start": 83,
"end": 84,
"value": " "
},
{
"type": "operator",
"start": 84,
"end": 85,
"value": "%"
},
{
"type": "brace",
"start": 85,
"end": 86,
"value": ")"
},
{
"type": "whitespace",
"start": 86,
"end": 91,
"value": "\n "
},
{
"type": "operator",
"start": 91,
"end": 93,
"value": "|>"
},
{
"type": "whitespace",
"start": 93,
"end": 94,
"value": " "
},
{
"type": "word",
"start": 94,
"end": 98,
"value": "line"
},
{
"type": "brace",
"start": 98,
"end": 99,
"value": "("
},
{
"type": "brace",
"start": 99,
"end": 100,
"value": "["
},
{
"type": "number",
"start": 100,
"end": 101,
"value": "0"
},
{
"type": "comma",
"start": 101,
"end": 102,
"value": ","
},
{
"type": "whitespace",
"start": 102,
"end": 103,
"value": " "
},
{
"type": "word",
"start": 103,
"end": 104,
"value": "l"
},
{
"type": "brace",
"start": 104,
"end": 105,
"value": "]"
},
{
"type": "comma",
"start": 105,
"end": 106,
"value": ","
},
{
"type": "whitespace",
"start": 106,
"end": 107,
"value": " "
},
{
"type": "operator",
"start": 107,
"end": 108,
"value": "%"
},
{
"type": "brace",
"start": 108,
"end": 109,
"value": ")"
},
{
"type": "whitespace",
"start": 109,
"end": 114,
"value": "\n "
},
{
"type": "operator",
"start": 114,
"end": 116,
"value": "|>"
},
{
"type": "whitespace",
"start": 116,
"end": 117,
"value": " "
},
{
"type": "word",
"start": 117,
"end": 121,
"value": "line"
},
{
"type": "brace",
"start": 121,
"end": 122,
"value": "("
},
{
"type": "brace",
"start": 122,
"end": 123,
"value": "["
},
{
"type": "word",
"start": 123,
"end": 124,
"value": "w"
},
{
"type": "comma",
"start": 124,
"end": 125,
"value": ","
},
{
"type": "whitespace",
"start": 125,
"end": 126,
"value": " "
},
{
"type": "number",
"start": 126,
"end": 127,
"value": "0"
},
{
"type": "brace",
"start": 127,
"end": 128,
"value": "]"
},
{
"type": "comma",
"start": 128,
"end": 129,
"value": ","
},
{
"type": "whitespace",
"start": 129,
"end": 130,
"value": " "
},
{
"type": "operator",
"start": 130,
"end": 131,
"value": "%"
},
{
"type": "brace",
"start": 131,
"end": 132,
"value": ")"
},
{
"type": "whitespace",
"start": 132,
"end": 137,
"value": "\n "
},
{
"type": "operator",
"start": 137,
"end": 139,
"value": "|>"
},
{
"type": "whitespace",
"start": 139,
"end": 140,
"value": " "
},
{
"type": "word",
"start": 140,
"end": 144,
"value": "line"
},
{
"type": "brace",
"start": 144,
"end": 145,
"value": "("
},
{
"type": "brace",
"start": 145,
"end": 146,
"value": "["
},
{
"type": "number",
"start": 146,
"end": 147,
"value": "0"
},
{
"type": "comma",
"start": 147,
"end": 148,
"value": ","
},
{
"type": "whitespace",
"start": 148,
"end": 149,
"value": " "
},
{
"type": "operator",
"start": 149,
"end": 150,
"value": "-"
},
{
"type": "word",
"start": 150,
"end": 151,
"value": "l"
},
{
"type": "brace",
"start": 151,
"end": 152,
"value": "]"
},
{
"type": "comma",
"start": 152,
"end": 153,
"value": ","
},
{
"type": "whitespace",
"start": 153,
"end": 154,
"value": " "
},
{
"type": "operator",
"start": 154,
"end": 155,
"value": "%"
},
{
"type": "brace",
"start": 155,
"end": 156,
"value": ")"
},
{
"type": "whitespace",
"start": 156,
"end": 161,
"value": "\n "
},
{
"type": "operator",
"start": 161,
"end": 163,
"value": "|>"
},
{
"type": "whitespace",
"start": 163,
"end": 164,
"value": " "
},
{
"type": "word",
"start": 164,
"end": 169,
"value": "close"
},
{
"type": "brace",
"start": 169,
"end": 170,
"value": "("
},
{
"type": "operator",
"start": 170,
"end": 171,
"value": "%"
},
{
"type": "brace",
"start": 171,
"end": 172,
"value": ")"
},
{
"type": "whitespace",
"start": 172,
"end": 177,
"value": "\n "
},
{
"type": "operator",
"start": 177,
"end": 179,
"value": "|>"
},
{
"type": "whitespace",
"start": 179,
"end": 180,
"value": " "
},
{
"type": "word",
"start": 180,
"end": 187,
"value": "extrude"
},
{
"type": "brace",
"start": 187,
"end": 188,
"value": "("
},
{
"type": "word",
"start": 188,
"end": 189,
"value": "h"
},
{
"type": "comma",
"start": 189,
"end": 190,
"value": ","
},
{
"type": "whitespace",
"start": 190,
"end": 191,
"value": " "
},
{
"type": "operator",
"start": 191,
"end": 192,
"value": "%"
},
{
"type": "brace",
"start": 192,
"end": 193,
"value": ")"
},
{
"type": "whitespace",
"start": 193,
"end": 197,
"value": "\n\n "
},
{
"type": "keyword",
"start": 197,
"end": 203,
"value": "return"
},
{
"type": "whitespace",
"start": 203,
"end": 204,
"value": " "
},
{
"type": "word",
"start": 204,
"end": 209,
"value": "myBox"
},
{
"type": "whitespace",
"start": 209,
"end": 210,
"value": "\n"
},
{
"type": "brace",
"start": 210,
"end": 211,
"value": "}"
},
{
"type": "whitespace",
"start": 211,
"end": 213,
"value": "\n\n"
},
{
"type": "word",
"start": 213,
"end": 218,
"value": "fnBox"
},
{
"type": "whitespace",
"start": 218,
"end": 219,
"value": " "
},
{
"type": "operator",
"start": 219,
"end": 220,
"value": "="
},
{
"type": "whitespace",
"start": 220,
"end": 221,
"value": " "
},
{
"type": "word",
"start": 221,
"end": 224,
"value": "box"
},
{
"type": "brace",
"start": 224,
"end": 225,
"value": "("
},
{
"type": "number",
"start": 225,
"end": 226,
"value": "3"
},
{
"type": "comma",
"start": 226,
"end": 227,
"value": ","
},
{
"type": "whitespace",
"start": 227,
"end": 228,
"value": " "
},
{
"type": "number",
"start": 228,
"end": 229,
"value": "6"
},
{
"type": "comma",
"start": 229,
"end": 230,
"value": ","
},
{
"type": "whitespace",
"start": 230,
"end": 231,
"value": " "
},
{
"type": "number",
"start": 231,
"end": 233,
"value": "10"
},
{
"type": "brace",
"start": 233,
"end": 234,
"value": ")"
},
{
"type": "whitespace",
"start": 234,
"end": 235,
"value": "\n"
}
]
}

View File

@ -0,0 +1,480 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing function_sketch_with_position.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 209,
"id": {
"end": 6,
"name": "box",
"start": 3,
"type": "Identifier"
},
"init": {
"body": {
"body": [
{
"declarations": [
{
"end": 191,
"id": {
"end": 34,
"name": "myBox",
"start": 29,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 55,
"raw": "'XY'",
"start": 51,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 50,
"name": "startSketchOn",
"start": 37,
"type": "Identifier"
},
"end": 56,
"optional": false,
"start": 37,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 80,
"name": "p",
"start": 79,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 83,
"start": 82,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 78,
"name": "startProfileAt",
"start": 64,
"type": "Identifier"
},
"end": 84,
"optional": false,
"start": 64,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 99,
"raw": "0",
"start": 98,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 102,
"name": "l",
"start": 101,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 103,
"start": 97,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 106,
"start": 105,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 96,
"name": "line",
"start": 92,
"type": "Identifier"
},
"end": 107,
"optional": false,
"start": 92,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 122,
"name": "w",
"start": 121,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 125,
"raw": "0",
"start": 124,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 126,
"start": 120,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 129,
"start": 128,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 119,
"name": "line",
"start": 115,
"type": "Identifier"
},
"end": 130,
"optional": false,
"start": 115,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 145,
"raw": "0",
"start": 144,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 149,
"name": "l",
"start": 148,
"type": "Identifier",
"type": "Identifier"
},
"end": 149,
"operator": "-",
"start": 147,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 150,
"start": 143,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 153,
"start": 152,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 142,
"name": "line",
"start": 138,
"type": "Identifier"
},
"end": 154,
"optional": false,
"start": 138,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 169,
"start": 168,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 167,
"name": "close",
"start": 162,
"type": "Identifier"
},
"end": 170,
"optional": false,
"start": 162,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 187,
"name": "h",
"start": 186,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 190,
"start": 189,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 185,
"name": "extrude",
"start": 178,
"type": "Identifier"
},
"end": 191,
"optional": false,
"start": 178,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 191,
"start": 37,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 29,
"type": "VariableDeclarator"
}
],
"end": 191,
"kind": "const",
"start": 29,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"argument": {
"end": 207,
"name": "myBox",
"start": 202,
"type": "Identifier",
"type": "Identifier"
},
"end": 207,
"start": 195,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"end": 209,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 195,
"start": 191,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 25
},
"end": 209,
"params": [
{
"type": "Parameter",
"identifier": {
"end": 11,
"name": "p",
"start": 10,
"type": "Identifier"
},
"optional": false
},
{
"type": "Parameter",
"identifier": {
"end": 14,
"name": "h",
"start": 13,
"type": "Identifier"
},
"optional": false
},
{
"type": "Parameter",
"identifier": {
"end": 17,
"name": "l",
"start": 16,
"type": "Identifier"
},
"optional": false
},
{
"type": "Parameter",
"identifier": {
"end": 20,
"name": "w",
"start": 19,
"type": "Identifier"
},
"optional": false
}
],
"start": 9,
"type": "FunctionExpression",
"type": "FunctionExpression"
},
"start": 3,
"type": "VariableDeclarator"
}
],
"end": 209,
"kind": "fn",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 240,
"id": {
"end": 216,
"name": "thing",
"start": 211,
"type": "Identifier"
},
"init": {
"arguments": [
{
"elements": [
{
"end": 225,
"raw": "0",
"start": 224,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 228,
"raw": "0",
"start": 227,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 229,
"start": 223,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 232,
"raw": "3",
"start": 231,
"type": "Literal",
"type": "Literal",
"value": 3
},
{
"end": 235,
"raw": "6",
"start": 234,
"type": "Literal",
"type": "Literal",
"value": 6
},
{
"end": 239,
"raw": "10",
"start": 237,
"type": "Literal",
"type": "Literal",
"value": 10
}
],
"callee": {
"end": 222,
"name": "box",
"start": 219,
"type": "Identifier"
},
"end": 240,
"optional": false,
"start": 219,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 211,
"type": "VariableDeclarator"
}
],
"end": 240,
"kind": "const",
"start": 211,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 241,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 211,
"start": 209,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}

View File

@ -0,0 +1,13 @@
fn box = (p, h, l, w) => {
myBox = startSketchOn('XY')
|> startProfileAt(p, %)
|> line([0, l], %)
|> line([w, 0], %)
|> line([0, -l], %)
|> close(%)
|> extrude(h, %)
return myBox
}
thing = box([0, 0], 3, 6, 10)

View File

@ -0,0 +1,630 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing function_sketch_with_position.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"box": {
"type": "Function",
"expression": {
"body": {
"body": [
{
"declarations": [
{
"end": 191,
"id": {
"end": 34,
"name": "myBox",
"start": 29,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 55,
"raw": "'XY'",
"start": 51,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 50,
"name": "startSketchOn",
"start": 37,
"type": "Identifier"
},
"end": 56,
"optional": false,
"start": 37,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 80,
"name": "p",
"start": 79,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 83,
"start": 82,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 78,
"name": "startProfileAt",
"start": 64,
"type": "Identifier"
},
"end": 84,
"optional": false,
"start": 64,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 99,
"raw": "0",
"start": 98,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 102,
"name": "l",
"start": 101,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 103,
"start": 97,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 106,
"start": 105,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 96,
"name": "line",
"start": 92,
"type": "Identifier"
},
"end": 107,
"optional": false,
"start": 92,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 122,
"name": "w",
"start": 121,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 125,
"raw": "0",
"start": 124,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 126,
"start": 120,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 129,
"start": 128,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 119,
"name": "line",
"start": 115,
"type": "Identifier"
},
"end": 130,
"optional": false,
"start": 115,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 145,
"raw": "0",
"start": 144,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 149,
"name": "l",
"start": 148,
"type": "Identifier",
"type": "Identifier"
},
"end": 149,
"operator": "-",
"start": 147,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 150,
"start": 143,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 153,
"start": 152,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 142,
"name": "line",
"start": 138,
"type": "Identifier"
},
"end": 154,
"optional": false,
"start": 138,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 169,
"start": 168,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 167,
"name": "close",
"start": 162,
"type": "Identifier"
},
"end": 170,
"optional": false,
"start": 162,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 187,
"name": "h",
"start": 186,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 190,
"start": 189,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 185,
"name": "extrude",
"start": 178,
"type": "Identifier"
},
"end": 191,
"optional": false,
"start": 178,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 191,
"start": 37,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 29,
"type": "VariableDeclarator"
}
],
"end": 191,
"kind": "const",
"start": 29,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"argument": {
"end": 207,
"name": "myBox",
"start": 202,
"type": "Identifier",
"type": "Identifier"
},
"end": 207,
"start": 195,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"end": 209,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 195,
"start": 191,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 25
},
"end": 209,
"params": [
{
"type": "Parameter",
"identifier": {
"end": 11,
"name": "p",
"start": 10,
"type": "Identifier"
},
"optional": false
},
{
"type": "Parameter",
"identifier": {
"end": 14,
"name": "h",
"start": 13,
"type": "Identifier"
},
"optional": false
},
{
"type": "Parameter",
"identifier": {
"end": 17,
"name": "l",
"start": 16,
"type": "Identifier"
},
"optional": false
},
{
"type": "Parameter",
"identifier": {
"end": 20,
"name": "w",
"start": 19,
"type": "Identifier"
},
"optional": false
}
],
"start": 9,
"type": "FunctionExpression"
},
"memory": {
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
},
"__meta": [
{
"sourceRange": [
9,
209,
0
]
}
]
},
"thing": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
92,
107,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
115,
130,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
138,
154,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
162,
170,
0
],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
92,
107,
0
]
},
"from": [
0.0,
0.0
],
"tag": null,
"to": [
0.0,
6.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
115,
130,
0
]
},
"from": [
0.0,
6.0
],
"tag": null,
"to": [
10.0,
6.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
138,
154,
0
]
},
"from": [
10.0,
6.0
],
"tag": null,
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
162,
170,
0
]
},
"from": [
10.0,
0.0
],
"tag": null,
"to": [
0.0,
0.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
64,
84,
0
]
}
},
"__meta": [
{
"sourceRange": [
64,
84,
0
]
}
]
},
"height": 3.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"__meta": [
{
"sourceRange": [
64,
84,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -0,0 +1,813 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing function_sketch_with_position.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "keyword",
"start": 0,
"end": 2,
"value": "fn"
},
{
"type": "whitespace",
"start": 2,
"end": 3,
"value": " "
},
{
"type": "word",
"start": 3,
"end": 6,
"value": "box"
},
{
"type": "whitespace",
"start": 6,
"end": 7,
"value": " "
},
{
"type": "operator",
"start": 7,
"end": 8,
"value": "="
},
{
"type": "whitespace",
"start": 8,
"end": 9,
"value": " "
},
{
"type": "brace",
"start": 9,
"end": 10,
"value": "("
},
{
"type": "word",
"start": 10,
"end": 11,
"value": "p"
},
{
"type": "comma",
"start": 11,
"end": 12,
"value": ","
},
{
"type": "whitespace",
"start": 12,
"end": 13,
"value": " "
},
{
"type": "word",
"start": 13,
"end": 14,
"value": "h"
},
{
"type": "comma",
"start": 14,
"end": 15,
"value": ","
},
{
"type": "whitespace",
"start": 15,
"end": 16,
"value": " "
},
{
"type": "word",
"start": 16,
"end": 17,
"value": "l"
},
{
"type": "comma",
"start": 17,
"end": 18,
"value": ","
},
{
"type": "whitespace",
"start": 18,
"end": 19,
"value": " "
},
{
"type": "word",
"start": 19,
"end": 20,
"value": "w"
},
{
"type": "brace",
"start": 20,
"end": 21,
"value": ")"
},
{
"type": "whitespace",
"start": 21,
"end": 22,
"value": " "
},
{
"type": "operator",
"start": 22,
"end": 24,
"value": "=>"
},
{
"type": "whitespace",
"start": 24,
"end": 25,
"value": " "
},
{
"type": "brace",
"start": 25,
"end": 26,
"value": "{"
},
{
"type": "whitespace",
"start": 26,
"end": 29,
"value": "\n "
},
{
"type": "word",
"start": 29,
"end": 34,
"value": "myBox"
},
{
"type": "whitespace",
"start": 34,
"end": 35,
"value": " "
},
{
"type": "operator",
"start": 35,
"end": 36,
"value": "="
},
{
"type": "whitespace",
"start": 36,
"end": 37,
"value": " "
},
{
"type": "word",
"start": 37,
"end": 50,
"value": "startSketchOn"
},
{
"type": "brace",
"start": 50,
"end": 51,
"value": "("
},
{
"type": "string",
"start": 51,
"end": 55,
"value": "'XY'"
},
{
"type": "brace",
"start": 55,
"end": 56,
"value": ")"
},
{
"type": "whitespace",
"start": 56,
"end": 61,
"value": "\n "
},
{
"type": "operator",
"start": 61,
"end": 63,
"value": "|>"
},
{
"type": "whitespace",
"start": 63,
"end": 64,
"value": " "
},
{
"type": "word",
"start": 64,
"end": 78,
"value": "startProfileAt"
},
{
"type": "brace",
"start": 78,
"end": 79,
"value": "("
},
{
"type": "word",
"start": 79,
"end": 80,
"value": "p"
},
{
"type": "comma",
"start": 80,
"end": 81,
"value": ","
},
{
"type": "whitespace",
"start": 81,
"end": 82,
"value": " "
},
{
"type": "operator",
"start": 82,
"end": 83,
"value": "%"
},
{
"type": "brace",
"start": 83,
"end": 84,
"value": ")"
},
{
"type": "whitespace",
"start": 84,
"end": 89,
"value": "\n "
},
{
"type": "operator",
"start": 89,
"end": 91,
"value": "|>"
},
{
"type": "whitespace",
"start": 91,
"end": 92,
"value": " "
},
{
"type": "word",
"start": 92,
"end": 96,
"value": "line"
},
{
"type": "brace",
"start": 96,
"end": 97,
"value": "("
},
{
"type": "brace",
"start": 97,
"end": 98,
"value": "["
},
{
"type": "number",
"start": 98,
"end": 99,
"value": "0"
},
{
"type": "comma",
"start": 99,
"end": 100,
"value": ","
},
{
"type": "whitespace",
"start": 100,
"end": 101,
"value": " "
},
{
"type": "word",
"start": 101,
"end": 102,
"value": "l"
},
{
"type": "brace",
"start": 102,
"end": 103,
"value": "]"
},
{
"type": "comma",
"start": 103,
"end": 104,
"value": ","
},
{
"type": "whitespace",
"start": 104,
"end": 105,
"value": " "
},
{
"type": "operator",
"start": 105,
"end": 106,
"value": "%"
},
{
"type": "brace",
"start": 106,
"end": 107,
"value": ")"
},
{
"type": "whitespace",
"start": 107,
"end": 112,
"value": "\n "
},
{
"type": "operator",
"start": 112,
"end": 114,
"value": "|>"
},
{
"type": "whitespace",
"start": 114,
"end": 115,
"value": " "
},
{
"type": "word",
"start": 115,
"end": 119,
"value": "line"
},
{
"type": "brace",
"start": 119,
"end": 120,
"value": "("
},
{
"type": "brace",
"start": 120,
"end": 121,
"value": "["
},
{
"type": "word",
"start": 121,
"end": 122,
"value": "w"
},
{
"type": "comma",
"start": 122,
"end": 123,
"value": ","
},
{
"type": "whitespace",
"start": 123,
"end": 124,
"value": " "
},
{
"type": "number",
"start": 124,
"end": 125,
"value": "0"
},
{
"type": "brace",
"start": 125,
"end": 126,
"value": "]"
},
{
"type": "comma",
"start": 126,
"end": 127,
"value": ","
},
{
"type": "whitespace",
"start": 127,
"end": 128,
"value": " "
},
{
"type": "operator",
"start": 128,
"end": 129,
"value": "%"
},
{
"type": "brace",
"start": 129,
"end": 130,
"value": ")"
},
{
"type": "whitespace",
"start": 130,
"end": 135,
"value": "\n "
},
{
"type": "operator",
"start": 135,
"end": 137,
"value": "|>"
},
{
"type": "whitespace",
"start": 137,
"end": 138,
"value": " "
},
{
"type": "word",
"start": 138,
"end": 142,
"value": "line"
},
{
"type": "brace",
"start": 142,
"end": 143,
"value": "("
},
{
"type": "brace",
"start": 143,
"end": 144,
"value": "["
},
{
"type": "number",
"start": 144,
"end": 145,
"value": "0"
},
{
"type": "comma",
"start": 145,
"end": 146,
"value": ","
},
{
"type": "whitespace",
"start": 146,
"end": 147,
"value": " "
},
{
"type": "operator",
"start": 147,
"end": 148,
"value": "-"
},
{
"type": "word",
"start": 148,
"end": 149,
"value": "l"
},
{
"type": "brace",
"start": 149,
"end": 150,
"value": "]"
},
{
"type": "comma",
"start": 150,
"end": 151,
"value": ","
},
{
"type": "whitespace",
"start": 151,
"end": 152,
"value": " "
},
{
"type": "operator",
"start": 152,
"end": 153,
"value": "%"
},
{
"type": "brace",
"start": 153,
"end": 154,
"value": ")"
},
{
"type": "whitespace",
"start": 154,
"end": 159,
"value": "\n "
},
{
"type": "operator",
"start": 159,
"end": 161,
"value": "|>"
},
{
"type": "whitespace",
"start": 161,
"end": 162,
"value": " "
},
{
"type": "word",
"start": 162,
"end": 167,
"value": "close"
},
{
"type": "brace",
"start": 167,
"end": 168,
"value": "("
},
{
"type": "operator",
"start": 168,
"end": 169,
"value": "%"
},
{
"type": "brace",
"start": 169,
"end": 170,
"value": ")"
},
{
"type": "whitespace",
"start": 170,
"end": 175,
"value": "\n "
},
{
"type": "operator",
"start": 175,
"end": 177,
"value": "|>"
},
{
"type": "whitespace",
"start": 177,
"end": 178,
"value": " "
},
{
"type": "word",
"start": 178,
"end": 185,
"value": "extrude"
},
{
"type": "brace",
"start": 185,
"end": 186,
"value": "("
},
{
"type": "word",
"start": 186,
"end": 187,
"value": "h"
},
{
"type": "comma",
"start": 187,
"end": 188,
"value": ","
},
{
"type": "whitespace",
"start": 188,
"end": 189,
"value": " "
},
{
"type": "operator",
"start": 189,
"end": 190,
"value": "%"
},
{
"type": "brace",
"start": 190,
"end": 191,
"value": ")"
},
{
"type": "whitespace",
"start": 191,
"end": 195,
"value": "\n\n "
},
{
"type": "keyword",
"start": 195,
"end": 201,
"value": "return"
},
{
"type": "whitespace",
"start": 201,
"end": 202,
"value": " "
},
{
"type": "word",
"start": 202,
"end": 207,
"value": "myBox"
},
{
"type": "whitespace",
"start": 207,
"end": 208,
"value": "\n"
},
{
"type": "brace",
"start": 208,
"end": 209,
"value": "}"
},
{
"type": "whitespace",
"start": 209,
"end": 211,
"value": "\n\n"
},
{
"type": "word",
"start": 211,
"end": 216,
"value": "thing"
},
{
"type": "whitespace",
"start": 216,
"end": 217,
"value": " "
},
{
"type": "operator",
"start": 217,
"end": 218,
"value": "="
},
{
"type": "whitespace",
"start": 218,
"end": 219,
"value": " "
},
{
"type": "word",
"start": 219,
"end": 222,
"value": "box"
},
{
"type": "brace",
"start": 222,
"end": 223,
"value": "("
},
{
"type": "brace",
"start": 223,
"end": 224,
"value": "["
},
{
"type": "number",
"start": 224,
"end": 225,
"value": "0"
},
{
"type": "comma",
"start": 225,
"end": 226,
"value": ","
},
{
"type": "whitespace",
"start": 226,
"end": 227,
"value": " "
},
{
"type": "number",
"start": 227,
"end": 228,
"value": "0"
},
{
"type": "brace",
"start": 228,
"end": 229,
"value": "]"
},
{
"type": "comma",
"start": 229,
"end": 230,
"value": ","
},
{
"type": "whitespace",
"start": 230,
"end": 231,
"value": " "
},
{
"type": "number",
"start": 231,
"end": 232,
"value": "3"
},
{
"type": "comma",
"start": 232,
"end": 233,
"value": ","
},
{
"type": "whitespace",
"start": 233,
"end": 234,
"value": " "
},
{
"type": "number",
"start": 234,
"end": 235,
"value": "6"
},
{
"type": "comma",
"start": 235,
"end": 236,
"value": ","
},
{
"type": "whitespace",
"start": 236,
"end": 237,
"value": " "
},
{
"type": "number",
"start": 237,
"end": 239,
"value": "10"
},
{
"type": "brace",
"start": 239,
"end": 240,
"value": ")"
},
{
"type": "whitespace",
"start": 240,
"end": 241,
"value": "\n"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
d_wrist_circumference = [22.8, 10.7, 16.4, 18.5]
width = d_wrist_circumference[0] + d_wrist_circumference[1] + d_wrist_circumference[2] + d_wrist_circumference[3]
length = 120.0
hand_thickness = 24.0
corner_radius = 5.0
// At first I thought this was going to be symmetric,
// but I measured intentionally to not be symmetric,
// because your wrist isn't a perfect cylindrical surface
brace_base = startSketchAt([corner_radius, 0])
|> line([width - corner_radius, 0.0], %)
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(25.0 - corner_radius, %)
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(-(d_wrist_circumference[0] - (corner_radius * 2)), %)
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> yLine(length - 25.0 - 23.0 - (corner_radius * 2), %)
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> xLine(15.0 - (corner_radius * 2), %)
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(23.0 - corner_radius, %)
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(-(hand_thickness + 15.0 + 15.0 - (corner_radius * 2)), %)
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(-(23.0 - corner_radius), %)
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> xLine(15.0 - (corner_radius * 2), %)
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> yLine(-(length - 25.0 - 23.0 - (corner_radius * 2)), %)
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> xLine(-(d_wrist_circumference[1] + d_wrist_circumference[2] + d_wrist_circumference[3] - hand_thickness - corner_radius), %)
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(-(25.0 - corner_radius), %)
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> close(%)
inner = startSketchAt([0, 0])
|> xLine(1.0, %)
|> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(25.0 - (corner_radius * 2), %)
|> tangentialArcToRelative([-corner_radius, corner_radius], %)
|> xLine(-1.0, %)
|> tangentialArcToRelative([-corner_radius, -corner_radius], %)
|> yLine(-(25.0 - (corner_radius * 2)), %)
|> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> close(%)
final = brace_base
|> hole(inner, %)
|> extrude(3.0, %)

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,286 @@
svg = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> lineTo([2.52, -26.04], %) // MoveAbsolute
|> lineTo([2.52, -25.2], %) // VerticalLineAbsolute
|> lineTo([0.84, -25.2], %) // HorizontalLineAbsolute
|> lineTo([0.84, -24.36], %) // VerticalLineAbsolute
|> lineTo([0, -24.36], %) // HorizontalLineAbsolute
|> lineTo([0, -6.72], %) // VerticalLineAbsolute
|> lineTo([0.84, -6.72], %) // HorizontalLineAbsolute
|> lineTo([0.84, -5.88], %) // VerticalLineAbsolute
|> lineTo([1.68, -5.88], %) // HorizontalLineAbsolute
|> lineTo([1.68, -5.04], %) // VerticalLineAbsolute
|> lineTo([2.52, -5.04], %) // HorizontalLineAbsolute
|> lineTo([2.52, -4.2], %) // VerticalLineAbsolute
|> lineTo([3.36, -4.2], %) // HorizontalLineAbsolute
|> lineTo([3.36, -3.36], %) // VerticalLineAbsolute
|> lineTo([17.64, -3.36], %) // HorizontalLineAbsolute
|> lineTo([17.64, -4.2], %) // VerticalLineAbsolute
|> lineTo([18.48, -4.2], %) // HorizontalLineRelative
|> lineTo([18.48, -5.04], %) // VerticalLineHorizonal
|> lineTo([19.32, -5.04], %) // HorizontalLineRelative
|> lineTo([19.32, -5.88], %) // VerticalLineHorizonal
|> lineTo([20.16, -5.88], %) // HorizontalLineRelative
|> lineTo([20.16, -6.72], %) // VerticalLineAbsolute
|> lineTo([21, -6.72], %) // HorizontalLineAbsolute
|> lineTo([21, -24.36], %) // VerticalLineHorizonal
|> lineTo([20.16, -24.36], %) // HorizontalLineRelative
|> lineTo([20.16, -25.2], %) // VerticalLineHorizonal
|> lineTo([18.48, -25.2], %) // HorizontalLineRelative
|> lineTo([18.48, -26.04], %) // VerticalLineHorizonal
|> lineTo([15.96, -26.04], %) // HorizontalLineRelative
|> lineTo([15.96, -26.88], %) // VerticalLineHorizonal
|> lineTo([16.8, -26.88], %) // HorizontalLineRelative
|> lineTo([16.8, -28.56], %) // VerticalLineHorizonal
|> lineTo([11.76, -28.56], %) // HorizontalLineAbsolute
|> lineTo([11.76, -26.88], %) // VerticalLineAbsolute
|> lineTo([12.6, -26.88], %) // HorizontalLineAbsolute
|> lineTo([12.6, -26.04], %) // VerticalLineAbsolute
|> lineTo([8.4, -26.04], %) // HorizontalLineAbsolute
|> lineTo([8.4, -26.88], %) // VerticalLineHorizonal
|> lineTo([9.24, -26.88], %) // HorizontalLineRelative
|> lineTo([9.24, -28.56], %) // VerticalLineHorizonal
|> lineTo([4.2, -28.56], %) // HorizontalLineAbsolute
|> lineTo([4.2, -26.88], %) // VerticalLineHorizonal
|> lineTo([5.04, -26.88], %) // HorizontalLineRelative
|> lineTo([5.04, -26.04], %) // VerticalLineHorizonal
|> lineTo([0.839996, -20.58], %) // MoveRelative
|> lineTo([0.839996, -24.36], %) // VerticalLineHorizonal
|> lineTo([2.52, -24.36], %) // HorizontalLineAbsolute
|> lineTo([2.52, -25.2], %) // VerticalLineHorizonal
|> lineTo([18.48, -25.2], %) // HorizontalLineRelative
|> lineTo([18.48, -24.36], %) // VerticalLineHorizonal
|> lineTo([20.16, -24.36], %) // HorizontalLineRelative
|> lineTo([20.16, -20.58], %) // VerticalLineAbsolute
// StopAbsolute
|> lineTo([7.56, -24.36], %) // MoveAbsolute
|> lineTo([7.56, -22.68], %) // VerticalLineHorizonal
|> lineTo([13.44, -22.68], %) // HorizontalLineRelative
|> lineTo([13.44, -24.36], %) // VerticalLineHorizonal
|> lineTo([1.68, -22.68], %) // MoveRelative
|> lineTo([1.68, -21.84], %) // VerticalLineHorizonal
|> lineTo([5.88, -21.84], %) // HorizontalLineRelative
|> lineTo([5.88, -22.68], %) // VerticalLineHorizonal
|> lineTo([3.36, -24.36], %) // MoveRelative
|> lineTo([3.36, -23.52], %) // VerticalLineHorizonal
|> lineTo([5.88, -23.52], %) // HorizontalLineRelative
|> lineTo([5.88, -24.36], %) // VerticalLineHorizonal
|> lineTo([15.12, -22.68], %) // MoveRelative
|> lineTo([15.12, -21.84], %) // VerticalLineHorizonal
|> lineTo([15.959999999999999, -21.84], %) // HorizontalLineRelative
|> lineTo([15.959999999999999, -22.68], %) // VerticalLineHorizonal
|> lineTo([16.8, -22.68], %) // MoveRelative
|> lineTo([16.8, -21.84], %) // VerticalLineHorizonal
|> lineTo([17.64, -21.84], %) // HorizontalLineRelative
|> lineTo([17.64, -22.68], %) // VerticalLineHorizonal
|> lineTo([18.48, -22.68], %) // MoveRelative
|> lineTo([18.48, -21.84], %) // VerticalLineHorizonal
|> lineTo([19.32, -21.84], %) // HorizontalLineRelative
|> lineTo([19.32, -22.68], %) // VerticalLineHorizonal
|> lineTo([15.12, -24.36], %) // MoveRelative
|> lineTo([15.12, -23.52], %) // VerticalLineHorizonal
|> lineTo([17.64, -23.52], %) // HorizontalLineRelative
|> lineTo([17.64, -24.36], %) // VerticalLineHorizonal
|> lineTo([18.48, -5.88], %) // MoveAbsolute
|> lineTo([18.48, -5.04], %) // VerticalLineAbsolute
|> lineTo([17.64, -5.04], %) // HorizontalLineAbsolute
|> lineTo([17.64, -4.2], %) // VerticalLineAbsolute
|> lineTo([3.36, -4.2], %) // HorizontalLineAbsolute
|> lineTo([3.36, -5.04], %) // VerticalLineAbsolute
|> lineTo([2.52, -5.04], %) // HorizontalLineAbsolute
|> lineTo([2.52, -5.88], %) // VerticalLineAbsolute
|> lineTo([1.68, -5.88], %) // HorizontalLineAbsolute
|> lineTo([1.68, -6.72], %) // VerticalLineAbsolute
|> lineTo([0.839996, -6.72], %) // HorizontalLineAbsolute
|> lineTo([0.839996, -8.4], %) // VerticalLineAbsolute
|> lineTo([20.16, -8.4], %) // HorizontalLineAbsolute
|> lineTo([20.16, -6.72], %) // VerticalLineAbsolute
|> lineTo([19.32, -6.72], %) // HorizontalLineAbsolute
|> lineTo([19.32, -5.88], %) // VerticalLineAbsolute
|> lineTo([20.16, -7.56], %) // MoveAbsolute
|> lineTo([0.839996, -7.56], %) // HorizontalLineAbsolute
|> lineTo([0.839996, -19.32], %) // VerticalLineAbsolute
|> lineTo([20.16, -19.32], %) // HorizontalLineAbsolute
|> lineTo([3.36, -10.08], %) // MoveAbsolute
|> lineTo([3.36, -9.24001], %) // VerticalLineAbsolute
|> lineTo([17.64, -9.24001], %) // HorizontalLineAbsolute
|> lineTo([17.64, -10.08], %) // VerticalLineAbsolute
|> lineTo([18.48, -10.08], %) // HorizontalLineRelative
|> lineTo([18.48, -16.8], %) // VerticalLineHorizonal
|> lineTo([17.64, -16.8], %) // HorizontalLineRelative
|> lineTo([17.64, -17.64], %) // VerticalLineHorizonal
|> lineTo([3.36, -17.64], %) // HorizontalLineAbsolute
|> lineTo([3.36, -16.8], %) // VerticalLineAbsolute
|> lineTo([2.52, -16.8], %) // HorizontalLineAbsolute
|> lineTo([2.52, -10.080000000000002], %) // VerticalLineHorizonal
|> lineTo([13.44, -10.92], %) // MoveRelative
|> lineTo([13.44, -10.08], %) // VerticalLineHorizonal
|> lineTo([15.12, -10.08], %) // HorizontalLineRelative
|> lineTo([15.12, -13.44], %) // VerticalLineHorizonal
|> lineTo([14.28, -13.44], %) // HorizontalLineRelative
|> lineTo([9.24, -13.44], %) // MoveRelative
|> lineTo([11.76, -13.44], %) // HorizontalLineRelative
|> lineTo([11.76, -14.28], %) // VerticalLineHorizonal
|> lineTo([10.92, -14.28], %) // HorizontalLineRelative here
|> lineTo([10.92, -15.959999999999999], %) // VerticalLineHorizonal
|> lineTo([13.44, -15.959999999999999], %) // HorizontalLineRelative
|> lineTo([13.44, -15.12], %) // VerticalLineHorizonal
|> lineTo([14.28, -15.12], %) // HorizontalLineRelative
|> lineTo([14.28, -15.959999999999999], %) // VerticalLineHorizonal
|> lineTo([13.44, -15.959999999999999], %) // HorizontalLineAbsolute
|> lineTo([13.44, -16.8], %) // VerticalLineAbsolute
|> lineTo([7.56, -16.8], %) // HorizontalLineAbsolute
|> lineTo([7.56, -15.96], %) // VerticalLineAbsolute
|> lineTo([6.72, -15.96], %) // HorizontalLineAbsolute
|> lineTo([6.72, -15.120000000000001], %) // VerticalLineHorizonal
|> lineTo([7.56, -15.120000000000001], %) // HorizontalLineRelative
|> lineTo([7.56, -15.96], %) // VerticalLineHorizonal
|> lineTo([10.08, -15.96], %) // HorizontalLineRelative
|> lineTo([10.08, -14.28], %) // VerticalLineAbsolute
|> lineTo([9.24, -14.28], %) // HorizontalLineAbsolute
|> lineTo([7.56, -12.6], %) // MoveAbsolute
|> lineTo([7.56, -11.76], %) // VerticalLineAbsolute
|> lineTo([5.04, -11.76], %) // HorizontalLineAbsolute
|> lineTo([5.04, -12.6], %) // VerticalLineAbsolute
|> lineTo([4.2, -12.6], %) // HorizontalLineAbsolute
|> lineTo([4.2, -11.76], %) // VerticalLineHorizonal
|> lineTo([5.04, -11.76], %) // HorizontalLineRelative
|> lineTo([5.04, -10.92], %) // VerticalLineHorizonal
|> lineTo([7.5600000000000005, -10.92], %) // HorizontalLineRelative
|> lineTo([7.5600000000000005, -11.76], %) // VerticalLineHorizonal
|> lineTo([8.4, -11.76], %) // HorizontalLineAbsolute
|> lineTo([8.4, -12.6], %) // VerticalLineHorizonal
|> lineTo([3.36, -5.88], %) // MoveAbsolute
|> lineTo([3.36, -5.04], %) // VerticalLineAbsolute
|> lineTo([4.2, -5.04], %) // HorizontalLineAbsolute
|> lineTo([4.2, -3.36], %) // VerticalLineAbsolute
|> lineTo([5.04, -3.36], %) // HorizontalLineAbsolute
|> lineTo([5.04, -1.68], %) // VerticalLineAbsolute
|> lineTo([5.88, -1.68], %) // HorizontalLineAbsolute
|> lineTo([5.88, -0.83999599], %) // VerticalLineAbsolute
|> lineTo([6.72, -0.83999599], %) // HorizontalLineAbsolute
|> lineTo([6.72, -1.68], %) // VerticalLineAbsolute
|> lineTo([7.56, -1.68], %) // HorizontalLineAbsolute
|> lineTo([7.56, -3.36], %) // VerticalLineAbsolute
|> lineTo([8.4, -3.36], %) // HorizontalLineAbsolute
|> lineTo([8.4, -5.04], %) // VerticalLineHorizonal
|> lineTo([9.24, -5.04], %) // HorizontalLineRelative
|> lineTo([9.24, -5.88], %) // VerticalLineHorizonal
|> lineTo([17.64, -5.04], %) // MoveAbsolute
|> lineTo([17.64, -5.88], %) // VerticalLineAbsolute
|> lineTo([11.76, -5.88], %) // HorizontalLineAbsolute
|> lineTo([11.76, -5.04], %) // VerticalLineAbsolute
|> lineTo([12.6, -5.04], %) // HorizontalLineAbsolute
|> lineTo([12.6, -3.36], %) // VerticalLineAbsolute
|> lineTo([13.44, -3.36], %) // HorizontalLineRelative
|> lineTo([13.44, -1.68], %) // VerticalLineAbsolute
|> lineTo([14.28, -1.68], %) // HorizontalLineRelative
|> lineTo([14.28, -0.83999599], %) // VerticalLineAbsolute
|> lineTo([15.12, -0.83999599], %) // HorizontalLineRelative
|> lineTo([15.12, -1.68], %) // VerticalLineAbsolute
|> lineTo([15.959999999999999, -1.68], %) // HorizontalLineRelative
|> lineTo([15.959999999999999, -3.36], %) // VerticalLineHorizonal
|> lineTo([16.8, -3.36], %) // HorizontalLineRelative
|> lineTo([16.8, -5.04], %) // VerticalLineHorizonal
|> lineTo([13.44, -1.68], %) // MoveAbsolute
|> lineTo([13.44, -0], %) // VerticalLineAbsolute
|> lineTo([15.959999999999999, -0], %) // HorizontalLineRelative
|> lineTo([15.959999999999999, -1.68], %) // VerticalLineHorizonal
|> lineTo([16.8, -1.68], %) // HorizontalLineRelative
|> lineTo([16.8, -3.36], %) // VerticalLineHorizonal
|> lineTo([17.64, -3.36], %) // HorizontalLineRelative
|> lineTo([17.64, -4.62], %) // VerticalLineAbsolute
|> lineTo([16.8, -4.62], %) // HorizontalLineAbsolute
|> lineTo([16.8, -3.36], %) // VerticalLineAbsolute
|> lineTo([15.96, -3.36], %) // HorizontalLineAbsolute
|> lineTo([15.96, -1.68], %) // VerticalLineAbsolute
|> lineTo([15.12, -1.68], %) // HorizontalLineAbsolute
|> lineTo([15.12, -0.83999999], %) // VerticalLineAbsolute
|> lineTo([14.28, -0.83999999], %) // HorizontalLineAbsolute
|> lineTo([14.28, -1.68], %) // VerticalLineAbsolute
|> lineTo([13.44, -1.68], %) // HorizontalLineAbsolute
|> lineTo([13.44, -3.36], %) // VerticalLineAbsolute
|> lineTo([12.6, -3.36], %) // HorizontalLineAbsolute
|> lineTo([12.6, -4.62], %) // VerticalLineAbsolute
|> lineTo([11.76, -4.62], %) // HorizontalLineAbsolute
|> lineTo([11.76, -3.36], %) // VerticalLineAbsolute
|> lineTo([12.6, -3.36], %) // HorizontalLineAbsolute
|> lineTo([12.6, -1.68], %) // VerticalLineAbsolute
|> lineTo([5.04, -1.68], %) // MoveAbsolute
|> lineTo([5.04, -0], %) // VerticalLineAbsolute
|> lineTo([7.56, -0], %) // HorizontalLineAbsolute
|> lineTo([7.56, -1.68], %) // VerticalLineAbsolute
|> lineTo([8.4, -1.68], %) // HorizontalLineAbsolute
|> lineTo([8.4, -3.36], %) // VerticalLineAbsolute
|> lineTo([9.24, -3.36], %) // HorizontalLineAbsolute
|> lineTo([9.24, -4.62], %) // VerticalLineAbsolute
|> lineTo([8.4, -4.62], %) // HorizontalLineAbsolute
|> lineTo([8.4, -3.36], %) // VerticalLineAbsolute
|> lineTo([7.56, -3.36], %) // HorizontalLineAbsolute
|> lineTo([7.56, -1.68], %) // VerticalLineAbsolute
|> lineTo([6.72, -1.68], %) // HorizontalLineAbsolute
|> lineTo([6.72, -0.83999999], %) // VerticalLineAbsolute
|> lineTo([5.88, -0.83999999], %) // HorizontalLineAbsolute
|> lineTo([5.88, -1.68], %) // VerticalLineAbsolute
|> lineTo([5.04, -1.68], %) // HorizontalLineAbsolute
|> lineTo([5.04, -3.36], %) // VerticalLineAbsolute
|> lineTo([4.2, -3.36], %) // HorizontalLineAbsolute
|> lineTo([4.2, -4.62], %) // VerticalLineAbsolute
|> lineTo([3.36, -4.62], %) // HorizontalLineAbsolute
|> lineTo([3.36, -3.36], %) // VerticalLineAbsolute
|> lineTo([4.2, -3.36], %) // HorizontalLineAbsolute
|> lineTo([4.2, -1.68], %) // VerticalLineAbsolute
|> lineTo([13.44, -5.88], %) // MoveAbsolute
|> lineTo([13.44, -5.04], %) // VerticalLineAbsolute
|> lineTo([14.28, -5.04], %) // HorizontalLineRelative
|> lineTo([14.28, -4.2], %) // VerticalLineAbsolute
|> lineTo([15.12, -4.2], %) // HorizontalLineRelative
|> lineTo([15.12, -5.04], %) // VerticalLineHorizonal
|> lineTo([15.959999999999999, -5.04], %) // HorizontalLineRelative
|> lineTo([15.959999999999999, -5.88], %) // VerticalLineHorizonal
|> lineTo([5.88, -5.04], %) // MoveAbsolute
|> lineTo([5.88, -4.2], %) // VerticalLineAbsolute
|> lineTo([6.72, -4.2], %) // HorizontalLineAbsolute
|> lineTo([6.72, -5.04], %) // VerticalLineAbsolute
|> lineTo([7.56, -5.04], %) // HorizontalLineAbsolute
|> lineTo([7.56, -5.88], %) // VerticalLineAbsolute
|> lineTo([5.04, -5.88], %) // HorizontalLineAbsolute
|> lineTo([5.04, -5.04], %) // VerticalLineAbsolute
|> lineTo([17.64, -5.88], %) // MoveAbsolute
|> lineTo([17.64, -5.04], %) // VerticalLineAbsolute
|> lineTo([16.8, -5.04], %) // HorizontalLineAbsolute
|> lineTo([16.8, -4.2], %) // VerticalLineAbsolute
|> lineTo([17.64, -4.2], %) // HorizontalLineRelative
|> lineTo([17.64, -5.04], %) // VerticalLineHorizonal
|> lineTo([18.48, -5.04], %) // HorizontalLineRelative
|> lineTo([18.48, -5.88], %) // VerticalLineHorizonal
|> lineTo([3.36, -5.04], %) // MoveAbsolute
|> lineTo([3.36, -5.88], %) // VerticalLineAbsolute
|> lineTo([2.52, -5.88], %) // HorizontalLineAbsolute
|> lineTo([2.52, -5.04], %) // VerticalLineAbsolute
|> lineTo([3.36, -5.04], %) // HorizontalLineAbsolute
|> lineTo([3.36, -4.2], %) // VerticalLineAbsolute
|> lineTo([4.2, -4.2], %) // HorizontalLineAbsolute
|> lineTo([4.2, -5.04], %) // VerticalLineHorizonal
|> lineTo([8.4, -4.2], %) // MoveRelative
|> lineTo([9.24, -4.2], %) // HorizontalLineRelative
|> lineTo([9.24, -5.04], %) // VerticalLineHorizonal
|> lineTo([10.08, -5.04], %) // HorizontalLineRelative
|> lineTo([10.08, -5.88], %) // VerticalLineAbsolute
|> lineTo([9.24, -5.88], %) // HorizontalLineAbsolute
|> lineTo([9.24, -5.04], %) // VerticalLineAbsolute
|> lineTo([8.4, -5.04], %) // HorizontalLineAbsolute
|> lineTo([11.76, -4.2], %) // MoveAbsolute
|> lineTo([12.6, -4.2], %) // HorizontalLineAbsolute
|> lineTo([12.6, -5.04], %) // VerticalLineAbsolute
|> lineTo([11.76, -5.04], %) // HorizontalLineAbsolute
|> lineTo([11.76, -5.88], %) // VerticalLineAbsolute
|> lineTo([10.92, -5.88], %) // HorizontalLineAbsolute
|> lineTo([10.92, -5.04], %) // VerticalLineAbsolute
|> lineTo([11.76, -5.04], %) // HorizontalLineRelative
|> lineTo([14.28, -10.92], %) // MoveRelative
|> lineTo([13.44, -10.92], %) // HorizontalLineRelative
|> lineTo([13.44, -13.44], %) // VerticalLineHorizonal
|> lineTo([14.28, -13.44], %) // HorizontalLineRelative
|> close(%)
|> extrude(1, %)

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,835 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing parametric.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 18,
"id": {
"end": 10,
"name": "sigmaAllow",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 18,
"raw": "35000",
"start": 13,
"type": "Literal",
"type": "Literal",
"value": 35000
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 18,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 35,
"id": {
"end": 31,
"name": "width",
"start": 26,
"type": "Identifier"
},
"init": {
"end": 35,
"raw": "9",
"start": 34,
"type": "Literal",
"type": "Literal",
"value": 9
},
"start": 26,
"type": "VariableDeclarator"
}
],
"end": 35,
"kind": "const",
"start": 26,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 51,
"id": {
"end": 45,
"name": "p",
"start": 44,
"type": "Identifier"
},
"init": {
"end": 51,
"raw": "150",
"start": 48,
"type": "Literal",
"type": "Literal",
"value": 150
},
"start": 44,
"type": "VariableDeclarator"
}
],
"end": 51,
"kind": "const",
"start": 44,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 88,
"id": {
"end": 84,
"name": "distance",
"start": 76,
"type": "Identifier"
},
"init": {
"end": 88,
"raw": "6",
"start": 87,
"type": "Literal",
"type": "Literal",
"value": 6
},
"start": 76,
"type": "VariableDeclarator"
}
],
"end": 88,
"kind": "const",
"start": 76,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 106,
"id": {
"end": 102,
"name": "FOS",
"start": 99,
"type": "Identifier"
},
"init": {
"end": 106,
"raw": "2",
"start": 105,
"type": "Literal",
"type": "Literal",
"value": 2
},
"start": 99,
"type": "VariableDeclarator"
}
],
"end": 106,
"kind": "const",
"start": 99,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 116,
"id": {
"end": 112,
"name": "leg1",
"start": 108,
"type": "Identifier"
},
"init": {
"end": 116,
"raw": "5",
"start": 115,
"type": "Literal",
"type": "Literal",
"value": 5
},
"start": 108,
"type": "VariableDeclarator"
}
],
"end": 116,
"kind": "const",
"start": 108,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 135,
"id": {
"end": 131,
"name": "leg2",
"start": 127,
"type": "Identifier"
},
"init": {
"end": 135,
"raw": "8",
"start": 134,
"type": "Literal",
"type": "Literal",
"value": 8
},
"start": 127,
"type": "VariableDeclarator"
}
],
"end": 135,
"kind": "const",
"start": 127,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 207,
"id": {
"end": 155,
"name": "thickness",
"start": 146,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 206,
"left": {
"end": 198,
"left": {
"end": 185,
"left": {
"end": 181,
"left": {
"end": 175,
"left": {
"end": 171,
"name": "distance",
"start": 163,
"type": "Identifier",
"type": "Identifier"
},
"operator": "*",
"right": {
"end": 175,
"name": "p",
"start": 174,
"type": "Identifier",
"type": "Identifier"
},
"start": 163,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "*",
"right": {
"end": 181,
"name": "FOS",
"start": 178,
"type": "Identifier",
"type": "Identifier"
},
"start": 163,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "*",
"right": {
"end": 185,
"raw": "6",
"start": 184,
"type": "Literal",
"type": "Literal",
"value": 6
},
"start": 163,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "/",
"right": {
"end": 198,
"name": "sigmaAllow",
"start": 188,
"type": "Identifier",
"type": "Identifier"
},
"start": 163,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "/",
"right": {
"end": 206,
"name": "width",
"start": 201,
"type": "Identifier",
"type": "Identifier"
},
"start": 163,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 162,
"name": "sqrt",
"start": 158,
"type": "Identifier"
},
"end": 207,
"optional": false,
"start": 158,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 146,
"type": "VariableDeclarator"
}
],
"end": 207,
"kind": "const",
"start": 146,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 467,
"id": {
"end": 225,
"name": "bracket",
"start": 218,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 246,
"raw": "'XY'",
"start": 242,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 241,
"name": "startSketchOn",
"start": 228,
"type": "Identifier"
},
"end": 247,
"optional": false,
"start": 228,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 270,
"raw": "0",
"start": 269,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 273,
"raw": "0",
"start": 272,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 274,
"start": 268,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 277,
"start": 276,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 267,
"name": "startProfileAt",
"start": 253,
"type": "Identifier"
},
"end": 278,
"optional": false,
"start": 253,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 291,
"raw": "0",
"start": 290,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 297,
"name": "leg1",
"start": 293,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 298,
"start": 289,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 301,
"start": 300,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 288,
"name": "line",
"start": 284,
"type": "Identifier"
},
"end": 302,
"optional": false,
"start": 284,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 318,
"name": "leg2",
"start": 314,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 321,
"raw": "0",
"start": 320,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 322,
"start": 313,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 325,
"start": 324,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 312,
"name": "line",
"start": 308,
"type": "Identifier"
},
"end": 326,
"optional": false,
"start": 308,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 339,
"raw": "0",
"start": 338,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 351,
"name": "thickness",
"start": 342,
"type": "Identifier",
"type": "Identifier"
},
"end": 351,
"operator": "-",
"start": 341,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 352,
"start": 337,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 355,
"start": 354,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 336,
"name": "line",
"start": 332,
"type": "Identifier"
},
"end": 356,
"optional": false,
"start": 332,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 385,
"left": {
"argument": {
"end": 373,
"name": "leg2",
"start": 369,
"type": "Identifier",
"type": "Identifier"
},
"end": 373,
"operator": "-",
"start": 368,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
"operator": "+",
"right": {
"end": 385,
"name": "thickness",
"start": 376,
"type": "Identifier",
"type": "Identifier"
},
"start": 368,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 388,
"raw": "0",
"start": 387,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 389,
"start": 367,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 392,
"start": 391,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 366,
"name": "line",
"start": 362,
"type": "Identifier"
},
"end": 393,
"optional": false,
"start": 362,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 406,
"raw": "0",
"start": 405,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 425,
"left": {
"argument": {
"end": 413,
"name": "leg1",
"start": 409,
"type": "Identifier",
"type": "Identifier"
},
"end": 413,
"operator": "-",
"start": 408,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
"operator": "+",
"right": {
"end": 425,
"name": "thickness",
"start": 416,
"type": "Identifier",
"type": "Identifier"
},
"start": 408,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"end": 426,
"start": 404,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 429,
"start": 428,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 403,
"name": "line",
"start": 399,
"type": "Identifier"
},
"end": 430,
"optional": false,
"start": 399,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 443,
"start": 442,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 441,
"name": "close",
"start": 436,
"type": "Identifier"
},
"end": 444,
"optional": false,
"start": 436,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 463,
"name": "width",
"start": 458,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 466,
"start": 465,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 457,
"name": "extrude",
"start": 450,
"type": "Identifier"
},
"end": 467,
"optional": false,
"start": 450,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 467,
"start": 228,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 218,
"type": "VariableDeclarator"
}
],
"end": 467,
"kind": "const",
"start": 218,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 468,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 25,
"start": 18,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "psi",
"style": "line"
}
}
],
"1": [
{
"end": 43,
"start": 35,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inch",
"style": "line"
}
}
],
"2": [
{
"end": 75,
"start": 51,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "Force on shelf - lbs",
"style": "line"
}
}
],
"3": [
{
"end": 98,
"start": 88,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inches",
"style": "line"
}
}
],
"4": [
{
"end": 108,
"start": 106,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"5": [
{
"end": 126,
"start": 116,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inches",
"style": "line"
}
}
],
"6": [
{
"end": 145,
"start": 135,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inches",
"style": "line"
}
}
],
"7": [
{
"end": 217,
"start": 207,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inches",
"style": "line"
}
}
]
},
"startNodes": []
},
"start": 0
}
}

View File

@ -0,0 +1,18 @@
sigmaAllow = 35000 // psi
width = 9 // inch
p = 150 // Force on shelf - lbs
distance = 6 // inches
FOS = 2
leg1 = 5 // inches
leg2 = 8 // inches
thickness = sqrt(distance * p * FOS * 6 / sigmaAllow / width) // inches
bracket = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([0, leg1], %)
|> line([leg2, 0], %)
|> line([0, -thickness], %)
|> line([-leg2 + thickness, 0], %)
|> line([0, -leg1 + thickness], %)
|> close(%)
|> extrude(width, %)

View File

@ -0,0 +1,405 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing parametric.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"FOS": {
"type": "Int",
"value": 2,
"__meta": [
{
"sourceRange": [
105,
106,
0
]
}
]
},
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"bracket": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
284,
302,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
308,
326,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
332,
356,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
362,
393,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
399,
430,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
436,
444,
0
],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
284,
302,
0
]
},
"from": [
0.0,
0.0
],
"tag": null,
"to": [
0.0,
5.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
308,
326,
0
]
},
"from": [
0.0,
5.0
],
"tag": null,
"to": [
8.0,
5.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
332,
356,
0
]
},
"from": [
8.0,
5.0
],
"tag": null,
"to": [
8.0,
4.8148
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
362,
393,
0
]
},
"from": [
8.0,
4.8148
],
"tag": null,
"to": [
0.1852,
4.8148
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
399,
430,
0
]
},
"from": [
0.1852,
4.8148
],
"tag": null,
"to": [
0.1852,
0.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
436,
444,
0
]
},
"from": [
0.1852,
0.0
],
"tag": null,
"to": [
0.0,
0.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
253,
278,
0
]
}
},
"__meta": [
{
"sourceRange": [
253,
278,
0
]
}
]
},
"height": 9.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"__meta": [
{
"sourceRange": [
253,
278,
0
]
}
]
},
"distance": {
"type": "Int",
"value": 6,
"__meta": [
{
"sourceRange": [
87,
88,
0
]
}
]
},
"leg1": {
"type": "Int",
"value": 5,
"__meta": [
{
"sourceRange": [
115,
116,
0
]
}
]
},
"leg2": {
"type": "Int",
"value": 8,
"__meta": [
{
"sourceRange": [
134,
135,
0
]
}
]
},
"p": {
"type": "Int",
"value": 150,
"__meta": [
{
"sourceRange": [
48,
51,
0
]
}
]
},
"sigmaAllow": {
"type": "Int",
"value": 35000,
"__meta": [
{
"sourceRange": [
13,
18,
0
]
}
]
},
"thickness": {
"type": "Number",
"value": 0.1851640199545103,
"__meta": [
{
"sourceRange": [
158,
207,
0
]
}
]
},
"width": {
"type": "Int",
"value": 9,
"__meta": [
{
"sourceRange": [
34,
35,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,937 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing parametric_with_tan_arc.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 18,
"id": {
"end": 10,
"name": "sigmaAllow",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 18,
"raw": "15000",
"start": 13,
"type": "Literal",
"type": "Literal",
"value": 15000
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 18,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 36,
"id": {
"end": 31,
"name": "width",
"start": 26,
"type": "Identifier"
},
"init": {
"end": 36,
"raw": "11",
"start": 34,
"type": "Literal",
"type": "Literal",
"value": 11
},
"start": 26,
"type": "VariableDeclarator"
}
],
"end": 36,
"kind": "const",
"start": 26,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 52,
"id": {
"end": 46,
"name": "p",
"start": 45,
"type": "Identifier"
},
"init": {
"end": 52,
"raw": "150",
"start": 49,
"type": "Literal",
"type": "Literal",
"value": 150
},
"start": 45,
"type": "VariableDeclarator"
}
],
"end": 52,
"kind": "const",
"start": 45,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 90,
"id": {
"end": 85,
"name": "distance",
"start": 77,
"type": "Identifier"
},
"init": {
"end": 90,
"raw": "12",
"start": 88,
"type": "Literal",
"type": "Literal",
"value": 12
},
"start": 77,
"type": "VariableDeclarator"
}
],
"end": 90,
"kind": "const",
"start": 77,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 108,
"id": {
"end": 104,
"name": "FOS",
"start": 101,
"type": "Identifier"
},
"init": {
"end": 108,
"raw": "2",
"start": 107,
"type": "Literal",
"type": "Literal",
"value": 2
},
"start": 101,
"type": "VariableDeclarator"
}
],
"end": 108,
"kind": "const",
"start": 101,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 172,
"id": {
"end": 118,
"name": "thickness",
"start": 109,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 170,
"left": {
"end": 148,
"left": {
"end": 144,
"left": {
"end": 138,
"left": {
"end": 134,
"name": "distance",
"start": 126,
"type": "Identifier",
"type": "Identifier"
},
"operator": "*",
"right": {
"end": 138,
"name": "p",
"start": 137,
"type": "Identifier",
"type": "Identifier"
},
"start": 126,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "*",
"right": {
"end": 144,
"name": "FOS",
"start": 141,
"type": "Identifier",
"type": "Identifier"
},
"start": 126,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "*",
"right": {
"end": 148,
"raw": "6",
"start": 147,
"type": "Literal",
"type": "Literal",
"value": 6
},
"start": 126,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "/",
"right": {
"end": 170,
"left": {
"end": 162,
"name": "sigmaAllow",
"start": 152,
"type": "Identifier",
"type": "Identifier"
},
"operator": "*",
"right": {
"end": 170,
"name": "width",
"start": 165,
"type": "Identifier",
"type": "Identifier"
},
"start": 152,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 126,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 125,
"name": "sqrt",
"start": 121,
"type": "Identifier"
},
"end": 172,
"optional": false,
"start": 121,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 109,
"type": "VariableDeclarator"
}
],
"end": 172,
"kind": "const",
"start": 109,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 196,
"id": {
"end": 180,
"name": "filletR",
"start": 173,
"type": "Identifier"
},
"init": {
"end": 196,
"left": {
"end": 192,
"name": "thickness",
"start": 183,
"type": "Identifier",
"type": "Identifier"
},
"operator": "*",
"right": {
"end": 196,
"raw": "2",
"start": 195,
"type": "Literal",
"type": "Literal",
"value": 2
},
"start": 183,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 173,
"type": "VariableDeclarator"
}
],
"end": 196,
"kind": "const",
"start": 173,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 212,
"id": {
"end": 208,
"name": "shelfMountL",
"start": 197,
"type": "Identifier"
},
"init": {
"end": 212,
"raw": "9",
"start": 211,
"type": "Literal",
"type": "Literal",
"value": 9
},
"start": 197,
"type": "VariableDeclarator"
}
],
"end": 212,
"kind": "const",
"start": 197,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 227,
"id": {
"end": 223,
"name": "wallMountL",
"start": 213,
"type": "Identifier"
},
"init": {
"end": 227,
"raw": "8",
"start": 226,
"type": "Literal",
"type": "Literal",
"value": 8
},
"start": 213,
"type": "VariableDeclarator"
}
],
"end": 227,
"kind": "const",
"start": 213,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 593,
"id": {
"end": 236,
"name": "bracket",
"start": 229,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"elements": [
{
"end": 255,
"raw": "0",
"start": 254,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 258,
"raw": "0",
"start": 257,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 259,
"start": 253,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
],
"callee": {
"end": 252,
"name": "startSketchAt",
"start": 239,
"type": "Identifier"
},
"end": 260,
"optional": false,
"start": 239,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 273,
"raw": "0",
"start": 272,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 285,
"name": "wallMountL",
"start": 275,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 286,
"start": 271,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 289,
"start": 288,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 270,
"name": "line",
"start": 266,
"type": "Identifier"
},
"end": 290,
"optional": false,
"start": 266,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 341,
"properties": [
{
"end": 327,
"key": {
"end": 318,
"name": "radius",
"start": 312,
"type": "Identifier"
},
"start": 312,
"type": "ObjectProperty",
"value": {
"end": 327,
"name": "filletR",
"start": 320,
"type": "Identifier",
"type": "Identifier"
}
},
{
"end": 339,
"key": {
"end": 335,
"name": "offset",
"start": 329,
"type": "Identifier"
},
"start": 329,
"type": "ObjectProperty",
"value": {
"end": 339,
"raw": "90",
"start": 337,
"type": "Literal",
"type": "Literal",
"value": 90
}
}
],
"start": 310,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 344,
"start": 343,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 309,
"name": "tangentialArc",
"start": 296,
"type": "Identifier"
},
"end": 345,
"optional": false,
"start": 296,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"argument": {
"end": 369,
"name": "shelfMountL",
"start": 358,
"type": "Identifier",
"type": "Identifier"
},
"end": 369,
"operator": "-",
"start": 357,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"end": 372,
"raw": "0",
"start": 371,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 373,
"start": 356,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 376,
"start": 375,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 355,
"name": "line",
"start": 351,
"type": "Identifier"
},
"end": 377,
"optional": false,
"start": 351,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 390,
"raw": "0",
"start": 389,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 402,
"name": "thickness",
"start": 393,
"type": "Identifier",
"type": "Identifier"
},
"end": 402,
"operator": "-",
"start": 392,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 403,
"start": 388,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 406,
"start": 405,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 387,
"name": "line",
"start": 383,
"type": "Identifier"
},
"end": 407,
"optional": false,
"start": 383,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 430,
"name": "shelfMountL",
"start": 419,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 433,
"raw": "0",
"start": 432,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 434,
"start": 418,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 437,
"start": 436,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 417,
"name": "line",
"start": 413,
"type": "Identifier"
},
"end": 438,
"optional": false,
"start": 413,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 521,
"properties": [
{
"end": 494,
"key": {
"end": 473,
"name": "radius",
"start": 467,
"type": "Identifier"
},
"start": 467,
"type": "ObjectProperty",
"value": {
"end": 494,
"left": {
"end": 482,
"name": "filletR",
"start": 475,
"type": "Identifier",
"type": "Identifier"
},
"operator": "-",
"right": {
"end": 494,
"name": "thickness",
"start": 485,
"type": "Identifier",
"type": "Identifier"
},
"start": 475,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"end": 514,
"key": {
"end": 509,
"name": "offset",
"start": 503,
"type": "Identifier"
},
"start": 503,
"type": "ObjectProperty",
"value": {
"argument": {
"end": 514,
"raw": "90",
"start": 512,
"type": "Literal",
"type": "Literal",
"value": 90
},
"end": 514,
"operator": "-",
"start": 511,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
}
],
"start": 458,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 524,
"start": 523,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 457,
"name": "tangentialArc",
"start": 444,
"type": "Identifier"
},
"end": 525,
"optional": false,
"start": 444,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 538,
"raw": "0",
"start": 537,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 551,
"name": "wallMountL",
"start": 541,
"type": "Identifier",
"type": "Identifier"
},
"end": 551,
"operator": "-",
"start": 540,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 552,
"start": 536,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 555,
"start": 554,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 535,
"name": "line",
"start": 531,
"type": "Identifier"
},
"end": 556,
"optional": false,
"start": 531,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 569,
"start": 568,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 567,
"name": "close",
"start": 562,
"type": "Identifier"
},
"end": 570,
"optional": false,
"start": 562,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 589,
"name": "width",
"start": 584,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 592,
"start": 591,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 583,
"name": "extrude",
"start": 576,
"type": "Identifier"
},
"end": 593,
"optional": false,
"start": 576,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 593,
"start": 239,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 229,
"type": "VariableDeclarator"
}
],
"end": 593,
"kind": "const",
"start": 229,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 594,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 25,
"start": 18,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "psi",
"style": "line"
}
}
],
"1": [
{
"end": 44,
"start": 36,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inch",
"style": "line"
}
}
],
"2": [
{
"end": 76,
"start": 52,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "Force on shelf - lbs",
"style": "line"
}
}
],
"3": [
{
"end": 100,
"start": 90,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inches",
"style": "line"
}
}
],
"8": [
{
"end": 229,
"start": 227,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}

View File

@ -0,0 +1,23 @@
sigmaAllow = 15000 // psi
width = 11 // inch
p = 150 // Force on shelf - lbs
distance = 12 // inches
FOS = 2
thickness = sqrt(distance * p * FOS * 6 / (sigmaAllow * width))
filletR = thickness * 2
shelfMountL = 9
wallMountL = 8
bracket = startSketchAt([0, 0])
|> line([0, wallMountL], %)
|> tangentialArc({ radius: filletR, offset: 90 }, %)
|> line([-shelfMountL, 0], %)
|> line([0, -thickness], %)
|> line([shelfMountL, 0], %)
|> tangentialArc({
radius: filletR - thickness,
offset: -90
}, %)
|> line([0, -wallMountL], %)
|> close(%)
|> extrude(width, %)

View File

@ -0,0 +1,497 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing parametric_with_tan_arc.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"FOS": {
"type": "Int",
"value": 2,
"__meta": [
{
"sourceRange": [
107,
108,
0
]
}
]
},
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"bracket": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
266,
290,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
296,
345,
0
],
"tag": null,
"type": "extrudeArc"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
351,
377,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
383,
407,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
413,
438,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
444,
525,
0
],
"tag": null,
"type": "extrudeArc"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
531,
556,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
562,
570,
0
],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
266,
290,
0
]
},
"from": [
0.0,
0.0
],
"tag": null,
"to": [
0.0,
8.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
296,
345,
0
]
},
"ccw": true,
"center": [
-0.7236272269866327,
8.0
],
"from": [
0.0,
8.0
],
"tag": null,
"to": [
-0.7236,
8.7236
],
"type": "TangentialArc"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
351,
377,
0
]
},
"from": [
-0.7236,
8.7236
],
"tag": null,
"to": [
-9.7236,
8.7236
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
383,
407,
0
]
},
"from": [
-9.7236,
8.7236
],
"tag": null,
"to": [
-9.7236,
8.3618
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
413,
438,
0
]
},
"from": [
-9.7236,
8.3618
],
"tag": null,
"to": [
-0.7236,
8.3618
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
444,
525,
0
]
},
"ccw": false,
"center": [
-0.7236272269866326,
8.0
],
"from": [
-0.7236,
8.3618
],
"tag": null,
"to": [
-0.3618,
8.0
],
"type": "TangentialArc"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
531,
556,
0
]
},
"from": [
-0.3618,
8.0
],
"tag": null,
"to": [
-0.3618,
0.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
562,
570,
0
]
},
"from": [
-0.3618,
0.0
],
"tag": null,
"to": [
0.0,
0.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
239,
260,
0
]
}
},
"__meta": [
{
"sourceRange": [
239,
260,
0
]
}
]
},
"height": 11.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"__meta": [
{
"sourceRange": [
239,
260,
0
]
}
]
},
"distance": {
"type": "Int",
"value": 12,
"__meta": [
{
"sourceRange": [
88,
90,
0
]
}
]
},
"filletR": {
"type": "Number",
"value": 0.7236272269866327,
"__meta": [
{
"sourceRange": [
121,
172,
0
]
},
{
"sourceRange": [
195,
196,
0
]
}
]
},
"p": {
"type": "Int",
"value": 150,
"__meta": [
{
"sourceRange": [
49,
52,
0
]
}
]
},
"shelfMountL": {
"type": "Int",
"value": 9,
"__meta": [
{
"sourceRange": [
211,
212,
0
]
}
]
},
"sigmaAllow": {
"type": "Int",
"value": 15000,
"__meta": [
{
"sourceRange": [
13,
18,
0
]
}
]
},
"thickness": {
"type": "Number",
"value": 0.36181361349331637,
"__meta": [
{
"sourceRange": [
121,
172,
0
]
}
]
},
"wallMountL": {
"type": "Int",
"value": 8,
"__meta": [
{
"sourceRange": [
226,
227,
0
]
}
]
},
"width": {
"type": "Int",
"value": 11,
"__meta": [
{
"sourceRange": [
34,
36,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

File diff suppressed because it is too large Load Diff

View File

@ -29,42 +29,6 @@ async fn kcl_test_fillet_duplicate_tags() {
);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute_with_function_sketch() {
let code = kcl_input!("function_sketch");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
assert_out("function_sketch", &result);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute_with_function_sketch_with_position() {
let code = kcl_input!("function_sketch_with_position");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
assert_out("function_sketch_with_position", &result);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute_with_angled_line() {
let code = kcl_input!("angled_line");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
assert_out("angled_line", &result);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute_parametric_example() {
let code = kcl_input!("parametric");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
assert_out("parametric", &result);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute_parametric_with_tan_arc_example() {
let code = kcl_input!("parametric_with_tan_arc");
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
assert_out("parametric_with_tan_arc", &result);
}
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute_engine_error_return() {
let code = r#"part001 = startSketchOn('XY')