700 lines
23 KiB
Plaintext
700 lines
23 KiB
Plaintext
![]() |
---
|
||
|
source: kcl-lib/src/simulation_tests.rs
|
||
|
description: Result of parsing washer.kcl
|
||
|
---
|
||
|
{
|
||
|
"Ok": {
|
||
|
"body": [
|
||
|
{
|
||
|
"declaration": {
|
||
|
"end": 576,
|
||
|
"id": {
|
||
|
"end": 568,
|
||
|
"name": "innerDiameter",
|
||
|
"start": 555,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"init": {
|
||
|
"end": 576,
|
||
|
"raw": "0.203",
|
||
|
"start": 571,
|
||
|
"type": "Literal",
|
||
|
"type": "Literal",
|
||
|
"value": {
|
||
|
"value": 0.203,
|
||
|
"suffix": "None"
|
||
|
}
|
||
|
},
|
||
|
"start": 555,
|
||
|
"type": "VariableDeclarator"
|
||
|
},
|
||
|
"end": 576,
|
||
|
"kind": "const",
|
||
|
"start": 555,
|
||
|
"type": "VariableDeclaration",
|
||
|
"type": "VariableDeclaration"
|
||
|
},
|
||
|
{
|
||
|
"declaration": {
|
||
|
"end": 598,
|
||
|
"id": {
|
||
|
"end": 590,
|
||
|
"name": "outerDiameter",
|
||
|
"start": 577,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"init": {
|
||
|
"end": 598,
|
||
|
"raw": "0.438",
|
||
|
"start": 593,
|
||
|
"type": "Literal",
|
||
|
"type": "Literal",
|
||
|
"value": {
|
||
|
"value": 0.438,
|
||
|
"suffix": "None"
|
||
|
}
|
||
|
},
|
||
|
"start": 577,
|
||
|
"type": "VariableDeclarator"
|
||
|
},
|
||
|
"end": 598,
|
||
|
"kind": "const",
|
||
|
"start": 577,
|
||
|
"type": "VariableDeclaration",
|
||
|
"type": "VariableDeclaration"
|
||
|
},
|
||
|
{
|
||
|
"declaration": {
|
||
|
"end": 619,
|
||
|
"id": {
|
||
|
"end": 611,
|
||
|
"name": "thicknessMax",
|
||
|
"start": 599,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"init": {
|
||
|
"end": 619,
|
||
|
"raw": "0.038",
|
||
|
"start": 614,
|
||
|
"type": "Literal",
|
||
|
"type": "Literal",
|
||
|
"value": {
|
||
|
"value": 0.038,
|
||
|
"suffix": "None"
|
||
|
}
|
||
|
},
|
||
|
"start": 599,
|
||
|
"type": "VariableDeclarator"
|
||
|
},
|
||
|
"end": 619,
|
||
|
"kind": "const",
|
||
|
"start": 599,
|
||
|
"type": "VariableDeclaration",
|
||
|
"type": "VariableDeclaration"
|
||
|
},
|
||
|
{
|
||
|
"declaration": {
|
||
|
"end": 640,
|
||
|
"id": {
|
||
|
"end": 632,
|
||
|
"name": "thicknessMin",
|
||
|
"start": 620,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"init": {
|
||
|
"end": 640,
|
||
|
"raw": "0.024",
|
||
|
"start": 635,
|
||
|
"type": "Literal",
|
||
|
"type": "Literal",
|
||
|
"value": {
|
||
|
"value": 0.024,
|
||
|
"suffix": "None"
|
||
|
}
|
||
|
},
|
||
|
"start": 620,
|
||
|
"type": "VariableDeclarator"
|
||
|
},
|
||
|
"end": 640,
|
||
|
"kind": "const",
|
||
|
"start": 620,
|
||
|
"type": "VariableDeclaration",
|
||
|
"type": "VariableDeclaration"
|
||
|
},
|
||
|
{
|
||
|
"declaration": {
|
||
|
"end": 1057,
|
||
|
"id": {
|
||
|
"end": 711,
|
||
|
"name": "washer",
|
||
|
"start": 705,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"init": {
|
||
|
"body": {
|
||
|
"body": [
|
||
|
{
|
||
|
"declaration": {
|
||
|
"end": 991,
|
||
|
"id": {
|
||
|
"end": 797,
|
||
|
"name": "washerSketch",
|
||
|
"start": 785,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"init": {
|
||
|
"body": [
|
||
|
{
|
||
|
"arguments": [
|
||
|
{
|
||
|
"end": 819,
|
||
|
"name": "plane",
|
||
|
"start": 814,
|
||
|
"type": "Identifier",
|
||
|
"type": "Identifier"
|
||
|
}
|
||
|
],
|
||
|
"callee": {
|
||
|
"end": 813,
|
||
|
"name": "startSketchOn",
|
||
|
"start": 800,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"end": 820,
|
||
|
"start": 800,
|
||
|
"type": "CallExpression",
|
||
|
"type": "CallExpression"
|
||
|
},
|
||
|
{
|
||
|
"arguments": [
|
||
|
{
|
||
|
"type": "LabeledArg",
|
||
|
"label": {
|
||
|
"end": 851,
|
||
|
"name": "center",
|
||
|
"start": 845,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"arg": {
|
||
|
"elements": [
|
||
|
{
|
||
|
"end": 856,
|
||
|
"raw": "0",
|
||
|
"start": 855,
|
||
|
"type": "Literal",
|
||
|
"type": "Literal",
|
||
|
"value": {
|
||
|
"value": 0.0,
|
||
|
"suffix": "None"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"end": 859,
|
||
|
"raw": "0",
|
||
|
"start": 858,
|
||
|
"type": "Literal",
|
||
|
"type": "Literal",
|
||
|
"value": {
|
||
|
"value": 0.0,
|
||
|
"suffix": "None"
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"end": 860,
|
||
|
"start": 854,
|
||
|
"type": "ArrayExpression",
|
||
|
"type": "ArrayExpression"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"type": "LabeledArg",
|
||
|
"label": {
|
||
|
"end": 877,
|
||
|
"name": "radius",
|
||
|
"start": 871,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"arg": {
|
||
|
"end": 892,
|
||
|
"left": {
|
||
|
"end": 888,
|
||
|
"name": "outerDia",
|
||
|
"start": 880,
|
||
|
"type": "Identifier",
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"operator": "/",
|
||
|
"right": {
|
||
|
"end": 892,
|
||
|
"raw": "2",
|
||
|
"start": 891,
|
||
|
"type": "Literal",
|
||
|
"type": "Literal",
|
||
|
"value": {
|
||
|
"value": 2.0,
|
||
|
"suffix": "None"
|
||
|
}
|
||
|
},
|
||
|
"start": 880,
|
||
|
"type": "BinaryExpression",
|
||
|
"type": "BinaryExpression"
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"callee": {
|
||
|
"end": 834,
|
||
|
"name": "circle",
|
||
|
"start": 828,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"end": 901,
|
||
|
"start": 828,
|
||
|
"type": "CallExpressionKw",
|
||
|
"type": "CallExpressionKw",
|
||
|
"unlabeled": null
|
||
|
},
|
||
|
{
|
||
|
"arguments": [
|
||
|
{
|
||
|
"arguments": [
|
||
|
{
|
||
|
"type": "LabeledArg",
|
||
|
"label": {
|
||
|
"end": 937,
|
||
|
"name": "center",
|
||
|
"start": 931,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"arg": {
|
||
|
"elements": [
|
||
|
{
|
||
|
"end": 942,
|
||
|
"raw": "0",
|
||
|
"start": 941,
|
||
|
"type": "Literal",
|
||
|
"type": "Literal",
|
||
|
"value": {
|
||
|
"value": 0.0,
|
||
|
"suffix": "None"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"end": 945,
|
||
|
"raw": "0",
|
||
|
"start": 944,
|
||
|
"type": "Literal",
|
||
|
"type": "Literal",
|
||
|
"value": {
|
||
|
"value": 0.0,
|
||
|
"suffix": "None"
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"end": 946,
|
||
|
"start": 940,
|
||
|
"type": "ArrayExpression",
|
||
|
"type": "ArrayExpression"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"type": "LabeledArg",
|
||
|
"label": {
|
||
|
"end": 963,
|
||
|
"name": "radius",
|
||
|
"start": 957,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"arg": {
|
||
|
"end": 978,
|
||
|
"left": {
|
||
|
"end": 974,
|
||
|
"name": "innerDia",
|
||
|
"start": 966,
|
||
|
"type": "Identifier",
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"operator": "/",
|
||
|
"right": {
|
||
|
"end": 978,
|
||
|
"raw": "2",
|
||
|
"start": 977,
|
||
|
"type": "Literal",
|
||
|
"type": "Literal",
|
||
|
"value": {
|
||
|
"value": 2.0,
|
||
|
"suffix": "None"
|
||
|
}
|
||
|
},
|
||
|
"start": 966,
|
||
|
"type": "BinaryExpression",
|
||
|
"type": "BinaryExpression"
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"callee": {
|
||
|
"end": 920,
|
||
|
"name": "circle",
|
||
|
"start": 914,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"end": 987,
|
||
|
"start": 914,
|
||
|
"type": "CallExpressionKw",
|
||
|
"type": "CallExpressionKw",
|
||
|
"unlabeled": null
|
||
|
},
|
||
|
{
|
||
|
"end": 990,
|
||
|
"start": 989,
|
||
|
"type": "PipeSubstitution",
|
||
|
"type": "PipeSubstitution"
|
||
|
}
|
||
|
],
|
||
|
"callee": {
|
||
|
"end": 913,
|
||
|
"name": "hole",
|
||
|
"start": 909,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"end": 991,
|
||
|
"start": 909,
|
||
|
"type": "CallExpression",
|
||
|
"type": "CallExpression"
|
||
|
}
|
||
|
],
|
||
|
"end": 991,
|
||
|
"start": 800,
|
||
|
"type": "PipeExpression",
|
||
|
"type": "PipeExpression"
|
||
|
},
|
||
|
"start": 785,
|
||
|
"type": "VariableDeclarator"
|
||
|
},
|
||
|
"end": 991,
|
||
|
"kind": "const",
|
||
|
"start": 785,
|
||
|
"type": "VariableDeclaration",
|
||
|
"type": "VariableDeclaration"
|
||
|
},
|
||
|
{
|
||
|
"declaration": {
|
||
|
"end": 1039,
|
||
|
"id": {
|
||
|
"end": 1001,
|
||
|
"name": "washer",
|
||
|
"start": 995,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"init": {
|
||
|
"arguments": [
|
||
|
{
|
||
|
"type": "LabeledArg",
|
||
|
"label": {
|
||
|
"end": 1032,
|
||
|
"name": "length",
|
||
|
"start": 1026,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"arg": {
|
||
|
"end": 1038,
|
||
|
"name": "thk",
|
||
|
"start": 1035,
|
||
|
"type": "Identifier",
|
||
|
"type": "Identifier"
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"callee": {
|
||
|
"end": 1011,
|
||
|
"name": "extrude",
|
||
|
"start": 1004,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"end": 1039,
|
||
|
"start": 1004,
|
||
|
"type": "CallExpressionKw",
|
||
|
"type": "CallExpressionKw",
|
||
|
"unlabeled": {
|
||
|
"end": 1024,
|
||
|
"name": "washerSketch",
|
||
|
"start": 1012,
|
||
|
"type": "Identifier",
|
||
|
"type": "Identifier"
|
||
|
}
|
||
|
},
|
||
|
"start": 995,
|
||
|
"type": "VariableDeclarator"
|
||
|
},
|
||
|
"end": 1039,
|
||
|
"kind": "const",
|
||
|
"start": 995,
|
||
|
"type": "VariableDeclaration",
|
||
|
"type": "VariableDeclaration"
|
||
|
},
|
||
|
{
|
||
|
"argument": {
|
||
|
"end": 1055,
|
||
|
"name": "washer",
|
||
|
"start": 1049,
|
||
|
"type": "Identifier",
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"end": 1055,
|
||
|
"start": 1042,
|
||
|
"type": "ReturnStatement",
|
||
|
"type": "ReturnStatement"
|
||
|
}
|
||
|
],
|
||
|
"end": 1057,
|
||
|
"nonCodeMeta": {
|
||
|
"nonCodeNodes": {
|
||
|
"0": [
|
||
|
{
|
||
|
"end": 995,
|
||
|
"start": 991,
|
||
|
"type": "NonCodeNode",
|
||
|
"value": {
|
||
|
"type": "newLine"
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"startNodes": [
|
||
|
{
|
||
|
"end": 783,
|
||
|
"start": 745,
|
||
|
"type": "NonCodeNode",
|
||
|
"value": {
|
||
|
"type": "blockComment",
|
||
|
"value": "Define the sketch of the washer",
|
||
|
"style": "line"
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"start": 745
|
||
|
},
|
||
|
"end": 1057,
|
||
|
"params": [
|
||
|
{
|
||
|
"type": "Parameter",
|
||
|
"identifier": {
|
||
|
"end": 717,
|
||
|
"name": "plane",
|
||
|
"start": 712,
|
||
|
"type": "Identifier"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"type": "Parameter",
|
||
|
"identifier": {
|
||
|
"end": 727,
|
||
|
"name": "innerDia",
|
||
|
"start": 719,
|
||
|
"type": "Identifier"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"type": "Parameter",
|
||
|
"identifier": {
|
||
|
"end": 737,
|
||
|
"name": "outerDia",
|
||
|
"start": 729,
|
||
|
"type": "Identifier"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"type": "Parameter",
|
||
|
"identifier": {
|
||
|
"end": 742,
|
||
|
"name": "thk",
|
||
|
"start": 739,
|
||
|
"type": "Identifier"
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"start": 711,
|
||
|
"type": "FunctionExpression",
|
||
|
"type": "FunctionExpression"
|
||
|
},
|
||
|
"start": 705,
|
||
|
"type": "VariableDeclarator"
|
||
|
},
|
||
|
"end": 1057,
|
||
|
"kind": "fn",
|
||
|
"start": 702,
|
||
|
"type": "VariableDeclaration",
|
||
|
"type": "VariableDeclaration"
|
||
|
},
|
||
|
{
|
||
|
"end": 1115,
|
||
|
"expression": {
|
||
|
"arguments": [
|
||
|
{
|
||
|
"end": 1070,
|
||
|
"raw": "'XY'",
|
||
|
"start": 1066,
|
||
|
"type": "Literal",
|
||
|
"type": "Literal",
|
||
|
"value": "XY"
|
||
|
},
|
||
|
{
|
||
|
"end": 1085,
|
||
|
"name": "innerDiameter",
|
||
|
"start": 1072,
|
||
|
"type": "Identifier",
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
{
|
||
|
"end": 1100,
|
||
|
"name": "outerDiameter",
|
||
|
"start": 1087,
|
||
|
"type": "Identifier",
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
{
|
||
|
"end": 1114,
|
||
|
"name": "thicknessMax",
|
||
|
"start": 1102,
|
||
|
"type": "Identifier",
|
||
|
"type": "Identifier"
|
||
|
}
|
||
|
],
|
||
|
"callee": {
|
||
|
"end": 1065,
|
||
|
"name": "washer",
|
||
|
"start": 1059,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"end": 1115,
|
||
|
"start": 1059,
|
||
|
"type": "CallExpression",
|
||
|
"type": "CallExpression"
|
||
|
},
|
||
|
"start": 1059,
|
||
|
"type": "ExpressionStatement",
|
||
|
"type": "ExpressionStatement"
|
||
|
}
|
||
|
],
|
||
|
"end": 1116,
|
||
|
"innerAttrs": [
|
||
|
{
|
||
|
"end": 518,
|
||
|
"name": {
|
||
|
"end": 494,
|
||
|
"name": "settings",
|
||
|
"start": 486,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"properties": [
|
||
|
{
|
||
|
"end": 517,
|
||
|
"key": {
|
||
|
"end": 512,
|
||
|
"name": "defaultLengthUnit",
|
||
|
"start": 495,
|
||
|
"type": "Identifier"
|
||
|
},
|
||
|
"start": 495,
|
||
|
"type": "ObjectProperty",
|
||
|
"value": {
|
||
|
"end": 517,
|
||
|
"name": "in",
|
||
|
"start": 515,
|
||
|
"type": "Identifier",
|
||
|
"type": "Identifier"
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"start": 485,
|
||
|
"type": "Annotation"
|
||
|
}
|
||
|
],
|
||
|
"nonCodeMeta": {
|
||
|
"nonCodeNodes": {
|
||
|
"3": [
|
||
|
{
|
||
|
"end": 701,
|
||
|
"start": 640,
|
||
|
"type": "NonCodeNode",
|
||
|
"value": {
|
||
|
"type": "newLineBlockComment",
|
||
|
"value": "Write a function that defines the washer and extrude it.",
|
||
|
"style": "line"
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"4": [
|
||
|
{
|
||
|
"end": 1059,
|
||
|
"start": 1057,
|
||
|
"type": "NonCodeNode",
|
||
|
"value": {
|
||
|
"type": "newLine"
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"startNodes": [
|
||
|
{
|
||
|
"end": 9,
|
||
|
"start": 0,
|
||
|
"type": "NonCodeNode",
|
||
|
"value": {
|
||
|
"type": "blockComment",
|
||
|
"value": "Washer",
|
||
|
"style": "line"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"end": 470,
|
||
|
"start": 10,
|
||
|
"type": "NonCodeNode",
|
||
|
"value": {
|
||
|
"type": "blockComment",
|
||
|
"value": "A small, typically disk-shaped component with a hole in the middle, used in a wide range of applications, primarily in conjunction with fasteners like bolts and screws. Washers distribute the load of a fastener across a broader area. This is especially important when the fastening surface is soft or uneven, as it helps to prevent damage to the surface and ensures the load is evenly distributed, reducing the risk of the fastener becoming loose over time.",
|
||
|
"style": "line"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"end": 472,
|
||
|
"start": 470,
|
||
|
"type": "NonCodeNode",
|
||
|
"value": {
|
||
|
"type": "newLine"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"end": 484,
|
||
|
"start": 472,
|
||
|
"type": "NonCodeNode",
|
||
|
"value": {
|
||
|
"type": "blockComment",
|
||
|
"value": "Set units",
|
||
|
"style": "line"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"end": 520,
|
||
|
"start": 518,
|
||
|
"type": "NonCodeNode",
|
||
|
"value": {
|
||
|
"type": "newLine"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"end": 554,
|
||
|
"start": 520,
|
||
|
"type": "NonCodeNode",
|
||
|
"value": {
|
||
|
"type": "blockComment",
|
||
|
"value": "Define constants in inches (in)",
|
||
|
"style": "line"
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"start": 0
|
||
|
}
|
||
|
}
|