merge main
							
								
								
									
										18
									
								
								rust/kcl-lib/tests/add_arrays/artifact_commands.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,18 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Artifact commands add_arrays.kcl | ||||
| --- | ||||
| { | ||||
|   "rust/kcl-lib/tests/add_arrays/input.kcl": [], | ||||
|   "std::appearance": [], | ||||
|   "std::array": [], | ||||
|   "std::math": [], | ||||
|   "std::prelude": [], | ||||
|   "std::sketch": [], | ||||
|   "std::solid": [], | ||||
|   "std::sweep": [], | ||||
|   "std::transform": [], | ||||
|   "std::turns": [], | ||||
|   "std::types": [], | ||||
|   "std::units": [] | ||||
| } | ||||
| @ -0,0 +1,6 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Artifact graph flowchart add_arrays.kcl | ||||
| extension: md | ||||
| snapshot_kind: binary | ||||
| --- | ||||
| @ -0,0 +1,3 @@ | ||||
| ```mermaid | ||||
| flowchart LR | ||||
| ``` | ||||
							
								
								
									
										106
									
								
								rust/kcl-lib/tests/add_arrays/ast.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,106 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Result of parsing add_arrays.kcl | ||||
| --- | ||||
| { | ||||
|   "Ok": { | ||||
|     "body": [ | ||||
|       { | ||||
|         "commentStart": 0, | ||||
|         "declaration": { | ||||
|           "commentStart": 0, | ||||
|           "end": 0, | ||||
|           "id": { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "name": "answer", | ||||
|             "start": 0, | ||||
|             "type": "Identifier" | ||||
|           }, | ||||
|           "init": { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "left": { | ||||
|               "commentStart": 0, | ||||
|               "elements": [ | ||||
|                 { | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "raw": "0", | ||||
|                   "start": 0, | ||||
|                   "type": "Literal", | ||||
|                   "type": "Literal", | ||||
|                   "value": { | ||||
|                     "value": 0.0, | ||||
|                     "suffix": "None" | ||||
|                   } | ||||
|                 }, | ||||
|                 { | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "raw": "1", | ||||
|                   "start": 0, | ||||
|                   "type": "Literal", | ||||
|                   "type": "Literal", | ||||
|                   "value": { | ||||
|                     "value": 1.0, | ||||
|                     "suffix": "None" | ||||
|                   } | ||||
|                 } | ||||
|               ], | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "start": 0, | ||||
|               "type": "ArrayExpression", | ||||
|               "type": "ArrayExpression" | ||||
|             }, | ||||
|             "moduleId": 0, | ||||
|             "operator": "+", | ||||
|             "right": { | ||||
|               "commentStart": 0, | ||||
|               "elements": [ | ||||
|                 { | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "raw": "2", | ||||
|                   "start": 0, | ||||
|                   "type": "Literal", | ||||
|                   "type": "Literal", | ||||
|                   "value": { | ||||
|                     "value": 2.0, | ||||
|                     "suffix": "None" | ||||
|                   } | ||||
|                 } | ||||
|               ], | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "start": 0, | ||||
|               "type": "ArrayExpression", | ||||
|               "type": "ArrayExpression" | ||||
|             }, | ||||
|             "start": 0, | ||||
|             "type": "BinaryExpression", | ||||
|             "type": "BinaryExpression" | ||||
|           }, | ||||
|           "moduleId": 0, | ||||
|           "start": 0, | ||||
|           "type": "VariableDeclarator" | ||||
|         }, | ||||
|         "end": 0, | ||||
|         "kind": "const", | ||||
|         "moduleId": 0, | ||||
|         "start": 0, | ||||
|         "type": "VariableDeclaration", | ||||
|         "type": "VariableDeclaration" | ||||
|       } | ||||
|     ], | ||||
|     "commentStart": 0, | ||||
|     "end": 0, | ||||
|     "moduleId": 0, | ||||
|     "start": 0 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										12
									
								
								rust/kcl-lib/tests/add_arrays/execution_error.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,12 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Error from executing add_arrays.kcl | ||||
| --- | ||||
| KCL Semantic error | ||||
|  | ||||
|   × semantic: Expected a number, but found an array of `number`, `number` | ||||
|    ╭──── | ||||
|  1 │ answer = [0, 1] + [2] | ||||
|    ·          ───┬── | ||||
|    ·             ╰── tests/add_arrays/input.kcl | ||||
|    ╰──── | ||||
							
								
								
									
										1
									
								
								rust/kcl-lib/tests/add_arrays/input.kcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1 @@ | ||||
| answer = [0, 1] + [2] | ||||
							
								
								
									
										96
									
								
								rust/kcl-lib/tests/add_arrays/ops.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,96 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Operations executed add_arrays.kcl | ||||
| --- | ||||
| { | ||||
|   "rust/kcl-lib/tests/add_arrays/input.kcl": [], | ||||
|   "std::appearance": [], | ||||
|   "std::array": [], | ||||
|   "std::math": [ | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "PI", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 3.141592653589793, | ||||
|         "ty": { | ||||
|           "type": "Unknown" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "E", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 2.718281828459045, | ||||
|         "ty": { | ||||
|           "type": "Known", | ||||
|           "type": "Count" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "TAU", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 6.283185307179586, | ||||
|         "ty": { | ||||
|           "type": "Known", | ||||
|           "type": "Count" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::prelude": [ | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "START", | ||||
|       "value": { | ||||
|         "type": "String", | ||||
|         "value": "start" | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "END", | ||||
|       "value": { | ||||
|         "type": "String", | ||||
|         "value": "end" | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::sketch": [], | ||||
|   "std::solid": [], | ||||
|   "std::sweep": [], | ||||
|   "std::transform": [], | ||||
|   "std::turns": [], | ||||
|   "std::types": [], | ||||
|   "std::units": [] | ||||
| } | ||||
							
								
								
									
										5
									
								
								rust/kcl-lib/tests/add_arrays/unparsed.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,5 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Result of unparsing add_arrays.kcl | ||||
| --- | ||||
| answer = [0, 1] + [2] | ||||
| After Width: | Height: | Size: 20 KiB | 
| After Width: | Height: | Size: 24 KiB | 
| After Width: | Height: | Size: 24 KiB | 
							
								
								
									
										381
									
								
								rust/kcl-lib/tests/plane_of/artifact_commands.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,381 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Artifact commands plane_of.kcl | ||||
| --- | ||||
| { | ||||
|   "rust/kcl-lib/tests/plane_of/input.kcl": [ | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "make_plane", | ||||
|         "origin": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "x_axis": { | ||||
|           "x": 1.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "y_axis": { | ||||
|           "x": 0.0, | ||||
|           "y": 1.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "size": 60.0, | ||||
|         "clobber": false, | ||||
|         "hide": true | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "enable_sketch_mode", | ||||
|         "entity_id": "[uuid]", | ||||
|         "ortho": false, | ||||
|         "animated": false, | ||||
|         "adjust_camera": false, | ||||
|         "planar_normal": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 1.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "start_path" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "move_path_pen", | ||||
|         "path": "[uuid]", | ||||
|         "to": { | ||||
|           "x": 2743.2, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "sketch_mode_disable" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": -1371.5999999999995, | ||||
|             "y": 2375.680887661472, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": false | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": -1371.6000000000013, | ||||
|             "y": -2375.680887661472, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": false | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": 2743.2, | ||||
|             "y": 0.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": false | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "close_path", | ||||
|         "path_id": "[uuid]" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "enable_sketch_mode", | ||||
|         "entity_id": "[uuid]", | ||||
|         "ortho": false, | ||||
|         "animated": false, | ||||
|         "adjust_camera": false, | ||||
|         "planar_normal": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 1.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extrude", | ||||
|         "target": "[uuid]", | ||||
|         "distance": 1828.8, | ||||
|         "faces": null, | ||||
|         "opposite": "None" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "sketch_mode_disable" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "object_bring_to_front", | ||||
|         "object_id": "[uuid]" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "solid3d_get_extrusion_face_info", | ||||
|         "object_id": "[uuid]", | ||||
|         "edge_id": "[uuid]" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "solid3d_get_adjacency_info", | ||||
|         "object_id": "[uuid]", | ||||
|         "edge_id": "[uuid]" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "face_is_planar", | ||||
|         "object_id": "[uuid]" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "make_plane", | ||||
|         "origin": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 3657.6 | ||||
|         }, | ||||
|         "x_axis": { | ||||
|           "x": 1.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "y_axis": { | ||||
|           "x": 0.0, | ||||
|           "y": 1.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "size": 100.0, | ||||
|         "clobber": false, | ||||
|         "hide": false | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "plane_set_color", | ||||
|         "plane_id": "[uuid]", | ||||
|         "color": { | ||||
|           "r": 0.6, | ||||
|           "g": 0.6, | ||||
|           "b": 0.6, | ||||
|           "a": 0.3 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "object_visible", | ||||
|         "object_id": "[uuid]", | ||||
|         "hidden": true | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "enable_sketch_mode", | ||||
|         "entity_id": "[uuid]", | ||||
|         "ortho": false, | ||||
|         "animated": false, | ||||
|         "adjust_camera": false, | ||||
|         "planar_normal": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 1.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "start_path" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "move_path_pen", | ||||
|         "path": "[uuid]", | ||||
|         "to": { | ||||
|           "x": 1828.8, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "sketch_mode_disable" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": 0.00000000000011198170331403397, | ||||
|             "y": 1828.8, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": false | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": -1828.8, | ||||
|             "y": 0.00000000000022396340662806795, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": false | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": -0.0000000000003359451099421019, | ||||
|             "y": -1828.8, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": false | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": 1828.8, | ||||
|             "y": 0.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": false | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "close_path", | ||||
|         "path_id": "[uuid]" | ||||
|       } | ||||
|     } | ||||
|   ], | ||||
|   "std::appearance": [], | ||||
|   "std::array": [], | ||||
|   "std::math": [], | ||||
|   "std::prelude": [], | ||||
|   "std::sketch": [], | ||||
|   "std::solid": [], | ||||
|   "std::sweep": [], | ||||
|   "std::transform": [], | ||||
|   "std::turns": [], | ||||
|   "std::types": [], | ||||
|   "std::units": [] | ||||
| } | ||||
| @ -0,0 +1,6 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Artifact graph flowchart plane_of.kcl | ||||
| extension: md | ||||
| snapshot_kind: binary | ||||
| --- | ||||
							
								
								
									
										105
									
								
								rust/kcl-lib/tests/plane_of/artifact_graph_flowchart.snap.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,105 @@ | ||||
| ```mermaid | ||||
| flowchart LR | ||||
|   subgraph path2 [Path] | ||||
|     2["Path<br>[64, 114, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] | ||||
|     3["Segment<br>[64, 114, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] | ||||
|     4["Segment<br>[64, 114, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] | ||||
|     5["Segment<br>[64, 114, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] | ||||
|     6["Segment<br>[64, 114, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] | ||||
|     7[Solid2d] | ||||
|   end | ||||
|   subgraph path21 [Path] | ||||
|     21["Path<br>[311, 361, 0]"] | ||||
|       %% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }] | ||||
|     22["Segment<br>[311, 361, 0]"] | ||||
|       %% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }] | ||||
|     23["Segment<br>[311, 361, 0]"] | ||||
|       %% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }] | ||||
|     24["Segment<br>[311, 361, 0]"] | ||||
|       %% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }] | ||||
|     25["Segment<br>[311, 361, 0]"] | ||||
|       %% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }] | ||||
|     26["Segment<br>[311, 361, 0]"] | ||||
|       %% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }] | ||||
|     27[Solid2d] | ||||
|   end | ||||
|   1["Plane<br>[41, 58, 0]"] | ||||
|     %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] | ||||
|   8["Sweep Extrusion<br>[120, 139, 0]"] | ||||
|     %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }] | ||||
|   9[Wall] | ||||
|     %% face_code_ref=Missing NodePath | ||||
|   10[Wall] | ||||
|     %% face_code_ref=Missing NodePath | ||||
|   11[Wall] | ||||
|     %% face_code_ref=Missing NodePath | ||||
|   12["Cap Start"] | ||||
|     %% face_code_ref=Missing NodePath | ||||
|   13["Cap End"] | ||||
|     %% face_code_ref=Missing NodePath | ||||
|   14["SweepEdge Opposite"] | ||||
|   15["SweepEdge Adjacent"] | ||||
|   16["SweepEdge Opposite"] | ||||
|   17["SweepEdge Adjacent"] | ||||
|   18["SweepEdge Opposite"] | ||||
|   19["SweepEdge Adjacent"] | ||||
|   20["Plane<br>[277, 304, 0]"] | ||||
|     %% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 0 }, CallKwUnlabeledArg] | ||||
|   28["StartSketchOnPlane<br>[263, 305, 0]"] | ||||
|     %% [ProgramBodyItem { index: 2 }, ExpressionStatementExpr, PipeBodyItem { index: 0 }] | ||||
|   1 --- 2 | ||||
|   2 --- 3 | ||||
|   2 --- 4 | ||||
|   2 --- 5 | ||||
|   2 --- 6 | ||||
|   2 --- 7 | ||||
|   2 ---- 8 | ||||
|   3 --- 9 | ||||
|   3 x--> 12 | ||||
|   3 --- 14 | ||||
|   3 --- 15 | ||||
|   4 --- 10 | ||||
|   4 x--> 12 | ||||
|   4 --- 16 | ||||
|   4 --- 17 | ||||
|   5 --- 11 | ||||
|   5 x--> 12 | ||||
|   5 --- 18 | ||||
|   5 --- 19 | ||||
|   8 --- 9 | ||||
|   8 --- 10 | ||||
|   8 --- 11 | ||||
|   8 --- 12 | ||||
|   8 --- 13 | ||||
|   8 --- 14 | ||||
|   8 --- 15 | ||||
|   8 --- 16 | ||||
|   8 --- 17 | ||||
|   8 --- 18 | ||||
|   8 --- 19 | ||||
|   9 --- 14 | ||||
|   9 --- 15 | ||||
|   19 <--x 9 | ||||
|   15 <--x 10 | ||||
|   10 --- 16 | ||||
|   10 --- 17 | ||||
|   17 <--x 11 | ||||
|   11 --- 18 | ||||
|   11 --- 19 | ||||
|   14 <--x 13 | ||||
|   16 <--x 13 | ||||
|   18 <--x 13 | ||||
|   20 --- 21 | ||||
|   20 <--x 28 | ||||
|   21 --- 22 | ||||
|   21 --- 23 | ||||
|   21 --- 24 | ||||
|   21 --- 25 | ||||
|   21 --- 26 | ||||
|   21 --- 27 | ||||
| ``` | ||||
							
								
								
									
										705
									
								
								rust/kcl-lib/tests/plane_of/ast.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,705 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Result of parsing plane_of.kcl | ||||
| --- | ||||
| { | ||||
|   "Ok": { | ||||
|     "body": [ | ||||
|       { | ||||
|         "commentStart": 0, | ||||
|         "declaration": { | ||||
|           "commentStart": 0, | ||||
|           "end": 0, | ||||
|           "id": { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "name": "tri", | ||||
|             "start": 0, | ||||
|             "type": "Identifier" | ||||
|           }, | ||||
|           "init": { | ||||
|             "body": [ | ||||
|               { | ||||
|                 "arguments": [], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "startSketchOn", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "XY", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name", | ||||
|                   "type": "Name" | ||||
|                 } | ||||
|               }, | ||||
|               { | ||||
|                 "arguments": [ | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "radius", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "raw": "3", | ||||
|                       "start": 0, | ||||
|                       "type": "Literal", | ||||
|                       "type": "Literal", | ||||
|                       "value": { | ||||
|                         "value": 3.0, | ||||
|                         "suffix": "None" | ||||
|                       } | ||||
|                     } | ||||
|                   }, | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "numSides", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "raw": "3", | ||||
|                       "start": 0, | ||||
|                       "type": "Literal", | ||||
|                       "type": "Literal", | ||||
|                       "value": { | ||||
|                         "value": 3.0, | ||||
|                         "suffix": "None" | ||||
|                       } | ||||
|                     } | ||||
|                   }, | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "center", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "elements": [ | ||||
|                         { | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "raw": "0", | ||||
|                           "start": 0, | ||||
|                           "type": "Literal", | ||||
|                           "type": "Literal", | ||||
|                           "value": { | ||||
|                             "value": 0.0, | ||||
|                             "suffix": "None" | ||||
|                           } | ||||
|                         }, | ||||
|                         { | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "raw": "0", | ||||
|                           "start": 0, | ||||
|                           "type": "Literal", | ||||
|                           "type": "Literal", | ||||
|                           "value": { | ||||
|                             "value": 0.0, | ||||
|                             "suffix": "None" | ||||
|                           } | ||||
|                         } | ||||
|                       ], | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "start": 0, | ||||
|                       "type": "ArrayExpression", | ||||
|                       "type": "ArrayExpression" | ||||
|                     } | ||||
|                   } | ||||
|                 ], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "polygon", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": null | ||||
|               }, | ||||
|               { | ||||
|                 "arguments": [ | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "length", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "raw": "2", | ||||
|                       "start": 0, | ||||
|                       "type": "Literal", | ||||
|                       "type": "Literal", | ||||
|                       "value": { | ||||
|                         "value": 2.0, | ||||
|                         "suffix": "None" | ||||
|                       } | ||||
|                     } | ||||
|                   } | ||||
|                 ], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "extrude", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": null | ||||
|               } | ||||
|             ], | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "nonCodeMeta": { | ||||
|               "nonCodeNodes": { | ||||
|                 "2": [ | ||||
|                   { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "start": 0, | ||||
|                     "type": "NonCodeNode", | ||||
|                     "value": { | ||||
|                       "type": "newLineBlockComment", | ||||
|                       "value": "Get the plane which `tri` ends on.", | ||||
|                       "style": "line" | ||||
|                     } | ||||
|                   } | ||||
|                 ] | ||||
|               }, | ||||
|               "startNodes": [] | ||||
|             }, | ||||
|             "start": 0, | ||||
|             "type": "PipeExpression", | ||||
|             "type": "PipeExpression" | ||||
|           }, | ||||
|           "moduleId": 0, | ||||
|           "start": 0, | ||||
|           "type": "VariableDeclarator" | ||||
|         }, | ||||
|         "end": 0, | ||||
|         "kind": "const", | ||||
|         "moduleId": 0, | ||||
|         "start": 0, | ||||
|         "type": "VariableDeclaration", | ||||
|         "type": "VariableDeclaration" | ||||
|       }, | ||||
|       { | ||||
|         "commentStart": 0, | ||||
|         "declaration": { | ||||
|           "commentStart": 0, | ||||
|           "end": 0, | ||||
|           "id": { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "name": "p0", | ||||
|             "start": 0, | ||||
|             "type": "Identifier" | ||||
|           }, | ||||
|           "init": { | ||||
|             "arguments": [ | ||||
|               { | ||||
|                 "type": "LabeledArg", | ||||
|                 "label": { | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": "face", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 }, | ||||
|                 "arg": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "END", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name", | ||||
|                   "type": "Name" | ||||
|                 } | ||||
|               } | ||||
|             ], | ||||
|             "callee": { | ||||
|               "abs_path": false, | ||||
|               "commentStart": 0, | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "name": { | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "name": "planeOf", | ||||
|                 "start": 0, | ||||
|                 "type": "Identifier" | ||||
|               }, | ||||
|               "path": [], | ||||
|               "start": 0, | ||||
|               "type": "Name" | ||||
|             }, | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "start": 0, | ||||
|             "type": "CallExpressionKw", | ||||
|             "type": "CallExpressionKw", | ||||
|             "unlabeled": { | ||||
|               "abs_path": false, | ||||
|               "commentStart": 0, | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "name": { | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "name": "tri", | ||||
|                 "start": 0, | ||||
|                 "type": "Identifier" | ||||
|               }, | ||||
|               "path": [], | ||||
|               "start": 0, | ||||
|               "type": "Name", | ||||
|               "type": "Name" | ||||
|             } | ||||
|           }, | ||||
|           "moduleId": 0, | ||||
|           "start": 0, | ||||
|           "type": "VariableDeclarator" | ||||
|         }, | ||||
|         "end": 0, | ||||
|         "kind": "const", | ||||
|         "moduleId": 0, | ||||
|         "start": 0, | ||||
|         "type": "VariableDeclaration", | ||||
|         "type": "VariableDeclaration" | ||||
|       }, | ||||
|       { | ||||
|         "commentStart": 0, | ||||
|         "end": 0, | ||||
|         "expression": { | ||||
|           "body": [ | ||||
|             { | ||||
|               "arguments": [], | ||||
|               "callee": { | ||||
|                 "abs_path": false, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "name": { | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": "startSketchOn", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 }, | ||||
|                 "path": [], | ||||
|                 "start": 0, | ||||
|                 "type": "Name" | ||||
|               }, | ||||
|               "commentStart": 0, | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "start": 0, | ||||
|               "type": "CallExpressionKw", | ||||
|               "type": "CallExpressionKw", | ||||
|               "unlabeled": { | ||||
|                 "arguments": [ | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "offset", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "raw": "2", | ||||
|                       "start": 0, | ||||
|                       "type": "Literal", | ||||
|                       "type": "Literal", | ||||
|                       "value": { | ||||
|                         "value": 2.0, | ||||
|                         "suffix": "None" | ||||
|                       } | ||||
|                     } | ||||
|                   } | ||||
|                 ], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "offsetPlane", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "p0", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name", | ||||
|                   "type": "Name" | ||||
|                 } | ||||
|               } | ||||
|             }, | ||||
|             { | ||||
|               "arguments": [ | ||||
|                 { | ||||
|                   "type": "LabeledArg", | ||||
|                   "label": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "radius", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "arg": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "raw": "2", | ||||
|                     "start": 0, | ||||
|                     "type": "Literal", | ||||
|                     "type": "Literal", | ||||
|                     "value": { | ||||
|                       "value": 2.0, | ||||
|                       "suffix": "None" | ||||
|                     } | ||||
|                   } | ||||
|                 }, | ||||
|                 { | ||||
|                   "type": "LabeledArg", | ||||
|                   "label": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "numSides", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "arg": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "raw": "4", | ||||
|                     "start": 0, | ||||
|                     "type": "Literal", | ||||
|                     "type": "Literal", | ||||
|                     "value": { | ||||
|                       "value": 4.0, | ||||
|                       "suffix": "None" | ||||
|                     } | ||||
|                   } | ||||
|                 }, | ||||
|                 { | ||||
|                   "type": "LabeledArg", | ||||
|                   "label": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "center", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "arg": { | ||||
|                     "commentStart": 0, | ||||
|                     "elements": [ | ||||
|                       { | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "raw": "0", | ||||
|                         "start": 0, | ||||
|                         "type": "Literal", | ||||
|                         "type": "Literal", | ||||
|                         "value": { | ||||
|                           "value": 0.0, | ||||
|                           "suffix": "None" | ||||
|                         } | ||||
|                       }, | ||||
|                       { | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "raw": "0", | ||||
|                         "start": 0, | ||||
|                         "type": "Literal", | ||||
|                         "type": "Literal", | ||||
|                         "value": { | ||||
|                           "value": 0.0, | ||||
|                           "suffix": "None" | ||||
|                         } | ||||
|                       } | ||||
|                     ], | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "start": 0, | ||||
|                     "type": "ArrayExpression", | ||||
|                     "type": "ArrayExpression" | ||||
|                   } | ||||
|                 } | ||||
|               ], | ||||
|               "callee": { | ||||
|                 "abs_path": false, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "name": { | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": "polygon", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 }, | ||||
|                 "path": [], | ||||
|                 "start": 0, | ||||
|                 "type": "Name" | ||||
|               }, | ||||
|               "commentStart": 0, | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "start": 0, | ||||
|               "type": "CallExpressionKw", | ||||
|               "type": "CallExpressionKw", | ||||
|               "unlabeled": null | ||||
|             } | ||||
|           ], | ||||
|           "commentStart": 0, | ||||
|           "end": 0, | ||||
|           "moduleId": 0, | ||||
|           "start": 0, | ||||
|           "type": "PipeExpression", | ||||
|           "type": "PipeExpression" | ||||
|         }, | ||||
|         "moduleId": 0, | ||||
|         "preComments": [ | ||||
|           "", | ||||
|           "", | ||||
|           "// Offset that plane by 2, then draw a square on it." | ||||
|         ], | ||||
|         "start": 0, | ||||
|         "type": "ExpressionStatement", | ||||
|         "type": "ExpressionStatement" | ||||
|       } | ||||
|     ], | ||||
|     "commentStart": 0, | ||||
|     "end": 0, | ||||
|     "innerAttrs": [ | ||||
|       { | ||||
|         "commentStart": 0, | ||||
|         "end": 0, | ||||
|         "moduleId": 0, | ||||
|         "name": { | ||||
|           "commentStart": 0, | ||||
|           "end": 0, | ||||
|           "moduleId": 0, | ||||
|           "name": "settings", | ||||
|           "start": 0, | ||||
|           "type": "Identifier" | ||||
|         }, | ||||
|         "properties": [ | ||||
|           { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "key": { | ||||
|               "commentStart": 0, | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "name": "defaultLengthUnit", | ||||
|               "start": 0, | ||||
|               "type": "Identifier" | ||||
|             }, | ||||
|             "moduleId": 0, | ||||
|             "start": 0, | ||||
|             "type": "ObjectProperty", | ||||
|             "value": { | ||||
|               "abs_path": false, | ||||
|               "commentStart": 0, | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "name": { | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "name": "yd", | ||||
|                 "start": 0, | ||||
|                 "type": "Identifier" | ||||
|               }, | ||||
|               "path": [], | ||||
|               "start": 0, | ||||
|               "type": "Name", | ||||
|               "type": "Name" | ||||
|             } | ||||
|           } | ||||
|         ], | ||||
|         "start": 0, | ||||
|         "type": "Annotation" | ||||
|       } | ||||
|     ], | ||||
|     "moduleId": 0, | ||||
|     "nonCodeMeta": { | ||||
|       "nonCodeNodes": { | ||||
|         "2": [ | ||||
|           { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "start": 0, | ||||
|             "type": "NonCodeNode", | ||||
|             "value": { | ||||
|               "type": "newLine" | ||||
|             } | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "startNodes": [ | ||||
|         { | ||||
|           "commentStart": 0, | ||||
|           "end": 0, | ||||
|           "moduleId": 0, | ||||
|           "start": 0, | ||||
|           "type": "NonCodeNode", | ||||
|           "value": { | ||||
|             "type": "newLine" | ||||
|           } | ||||
|         } | ||||
|       ] | ||||
|     }, | ||||
|     "start": 0 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										13
									
								
								rust/kcl-lib/tests/plane_of/input.kcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,13 @@ | ||||
| @settings(defaultLengthUnit = yd) | ||||
|  | ||||
| tri = startSketchOn(XY) | ||||
|   |> polygon(radius = 3, numSides = 3, center = [0, 0]) | ||||
|   |> extrude(length = 2) | ||||
|  | ||||
| // Get the plane which `tri` ends on. | ||||
| p0 = planeOf(tri, face = END) | ||||
|  | ||||
| // Offset that plane by 2, then draw a square on it. | ||||
| startSketchOn(offsetPlane(p0, offset = 2)) | ||||
|   |> polygon(radius = 2, numSides = 4, center = [0, 0]) | ||||
|  | ||||
							
								
								
									
										254
									
								
								rust/kcl-lib/tests/plane_of/ops.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,254 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Operations executed plane_of.kcl | ||||
| --- | ||||
| { | ||||
|   "rust/kcl-lib/tests/plane_of/input.kcl": [ | ||||
|     { | ||||
|       "type": "StdLibCall", | ||||
|       "name": "startSketchOn", | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Plane", | ||||
|           "artifact_id": "[uuid]" | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": {}, | ||||
|       "nodePath": { | ||||
|         "steps": [ | ||||
|           { | ||||
|             "type": "ProgramBodyItem", | ||||
|             "index": 0 | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationDeclaration" | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationInit" | ||||
|           }, | ||||
|           { | ||||
|             "type": "PipeBodyItem", | ||||
|             "index": 0 | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "StdLibCall", | ||||
|       "name": "extrude", | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Sketch", | ||||
|           "value": { | ||||
|             "artifactId": "[uuid]" | ||||
|           } | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": { | ||||
|         "length": { | ||||
|           "value": { | ||||
|             "type": "Number", | ||||
|             "value": 2.0, | ||||
|             "ty": { | ||||
|               "type": "Default", | ||||
|               "len": { | ||||
|                 "type": "Yards" | ||||
|               }, | ||||
|               "angle": { | ||||
|                 "type": "Degrees" | ||||
|               } | ||||
|             } | ||||
|           }, | ||||
|           "sourceRange": [] | ||||
|         } | ||||
|       }, | ||||
|       "nodePath": { | ||||
|         "steps": [ | ||||
|           { | ||||
|             "type": "ProgramBodyItem", | ||||
|             "index": 0 | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationDeclaration" | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationInit" | ||||
|           }, | ||||
|           { | ||||
|             "type": "PipeBodyItem", | ||||
|             "index": 2 | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "StdLibCall", | ||||
|       "name": "offsetPlane", | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Plane", | ||||
|           "artifact_id": "[uuid]" | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": { | ||||
|         "offset": { | ||||
|           "value": { | ||||
|             "type": "Number", | ||||
|             "value": 2.0, | ||||
|             "ty": { | ||||
|               "type": "Default", | ||||
|               "len": { | ||||
|                 "type": "Yards" | ||||
|               }, | ||||
|               "angle": { | ||||
|                 "type": "Degrees" | ||||
|               } | ||||
|             } | ||||
|           }, | ||||
|           "sourceRange": [] | ||||
|         } | ||||
|       }, | ||||
|       "nodePath": { | ||||
|         "steps": [ | ||||
|           { | ||||
|             "type": "ProgramBodyItem", | ||||
|             "index": 2 | ||||
|           }, | ||||
|           { | ||||
|             "type": "ExpressionStatementExpr" | ||||
|           }, | ||||
|           { | ||||
|             "type": "PipeBodyItem", | ||||
|             "index": 0 | ||||
|           }, | ||||
|           { | ||||
|             "type": "CallKwUnlabeledArg" | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "StdLibCall", | ||||
|       "name": "startSketchOn", | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Plane", | ||||
|           "artifact_id": "[uuid]" | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": {}, | ||||
|       "nodePath": { | ||||
|         "steps": [ | ||||
|           { | ||||
|             "type": "ProgramBodyItem", | ||||
|             "index": 2 | ||||
|           }, | ||||
|           { | ||||
|             "type": "ExpressionStatementExpr" | ||||
|           }, | ||||
|           { | ||||
|             "type": "PipeBodyItem", | ||||
|             "index": 0 | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::appearance": [], | ||||
|   "std::array": [], | ||||
|   "std::math": [ | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "PI", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 3.141592653589793, | ||||
|         "ty": { | ||||
|           "type": "Unknown" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "E", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 2.718281828459045, | ||||
|         "ty": { | ||||
|           "type": "Known", | ||||
|           "type": "Count" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "TAU", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 6.283185307179586, | ||||
|         "ty": { | ||||
|           "type": "Known", | ||||
|           "type": "Count" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::prelude": [ | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "START", | ||||
|       "value": { | ||||
|         "type": "String", | ||||
|         "value": "start" | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "END", | ||||
|       "value": { | ||||
|         "type": "String", | ||||
|         "value": "end" | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::sketch": [], | ||||
|   "std::solid": [], | ||||
|   "std::sweep": [], | ||||
|   "std::transform": [], | ||||
|   "std::turns": [], | ||||
|   "std::types": [], | ||||
|   "std::units": [] | ||||
| } | ||||
							
								
								
									
										192
									
								
								rust/kcl-lib/tests/plane_of/program_memory.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,192 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Variables in memory after executing plane_of.kcl | ||||
| --- | ||||
| { | ||||
|   "p0": { | ||||
|     "type": "Plane", | ||||
|     "value": { | ||||
|       "artifactId": "[uuid]", | ||||
|       "id": "[uuid]", | ||||
|       "origin": { | ||||
|         "x": 0.0, | ||||
|         "y": 0.0, | ||||
|         "z": 1828.8, | ||||
|         "units": { | ||||
|           "type": "Mm" | ||||
|         } | ||||
|       }, | ||||
|       "value": "Uninit", | ||||
|       "xAxis": { | ||||
|         "x": 1.0, | ||||
|         "y": 0.0, | ||||
|         "z": 0.0, | ||||
|         "units": { | ||||
|           "type": "Mm" | ||||
|         } | ||||
|       }, | ||||
|       "yAxis": { | ||||
|         "x": 0.0, | ||||
|         "y": 1.0, | ||||
|         "z": 0.0, | ||||
|         "units": { | ||||
|           "type": "Mm" | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   "tri": { | ||||
|     "type": "Solid", | ||||
|     "value": { | ||||
|       "type": "Solid", | ||||
|       "id": "[uuid]", | ||||
|       "artifactId": "[uuid]", | ||||
|       "value": [ | ||||
|         { | ||||
|           "faceId": "[uuid]", | ||||
|           "id": "[uuid]", | ||||
|           "sourceRange": [], | ||||
|           "tag": null, | ||||
|           "type": "extrudePlane" | ||||
|         }, | ||||
|         { | ||||
|           "faceId": "[uuid]", | ||||
|           "id": "[uuid]", | ||||
|           "sourceRange": [], | ||||
|           "tag": null, | ||||
|           "type": "extrudePlane" | ||||
|         }, | ||||
|         { | ||||
|           "faceId": "[uuid]", | ||||
|           "id": "[uuid]", | ||||
|           "sourceRange": [], | ||||
|           "tag": null, | ||||
|           "type": "extrudePlane" | ||||
|         } | ||||
|       ], | ||||
|       "sketch": { | ||||
|         "type": "Sketch", | ||||
|         "id": "[uuid]", | ||||
|         "paths": [ | ||||
|           { | ||||
|             "__geoMeta": { | ||||
|               "id": "[uuid]", | ||||
|               "sourceRange": [] | ||||
|             }, | ||||
|             "from": [ | ||||
|               3.0, | ||||
|               0.0 | ||||
|             ], | ||||
|             "tag": null, | ||||
|             "to": [ | ||||
|               -1.4999999999999993, | ||||
|               2.598076211353316 | ||||
|             ], | ||||
|             "type": "ToPoint", | ||||
|             "units": { | ||||
|               "type": "Yards" | ||||
|             } | ||||
|           }, | ||||
|           { | ||||
|             "__geoMeta": { | ||||
|               "id": "[uuid]", | ||||
|               "sourceRange": [] | ||||
|             }, | ||||
|             "from": [ | ||||
|               -1.4999999999999993, | ||||
|               2.598076211353316 | ||||
|             ], | ||||
|             "tag": null, | ||||
|             "to": [ | ||||
|               -1.5000000000000013, | ||||
|               -2.5980762113533156 | ||||
|             ], | ||||
|             "type": "ToPoint", | ||||
|             "units": { | ||||
|               "type": "Yards" | ||||
|             } | ||||
|           }, | ||||
|           { | ||||
|             "__geoMeta": { | ||||
|               "id": "[uuid]", | ||||
|               "sourceRange": [] | ||||
|             }, | ||||
|             "from": [ | ||||
|               -1.5000000000000013, | ||||
|               -2.5980762113533156 | ||||
|             ], | ||||
|             "tag": null, | ||||
|             "to": [ | ||||
|               3.0, | ||||
|               0.0 | ||||
|             ], | ||||
|             "type": "ToPoint", | ||||
|             "units": { | ||||
|               "type": "Yards" | ||||
|             } | ||||
|           } | ||||
|         ], | ||||
|         "on": { | ||||
|           "artifactId": "[uuid]", | ||||
|           "id": "[uuid]", | ||||
|           "origin": { | ||||
|             "x": 0.0, | ||||
|             "y": 0.0, | ||||
|             "z": 0.0, | ||||
|             "units": { | ||||
|               "type": "Mm" | ||||
|             } | ||||
|           }, | ||||
|           "type": "plane", | ||||
|           "value": "XY", | ||||
|           "xAxis": { | ||||
|             "x": 1.0, | ||||
|             "y": 0.0, | ||||
|             "z": 0.0, | ||||
|             "units": { | ||||
|               "type": "Unknown" | ||||
|             } | ||||
|           }, | ||||
|           "yAxis": { | ||||
|             "x": 0.0, | ||||
|             "y": 1.0, | ||||
|             "z": 0.0, | ||||
|             "units": { | ||||
|               "type": "Unknown" | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         "start": { | ||||
|           "from": [ | ||||
|             3.0, | ||||
|             0.0 | ||||
|           ], | ||||
|           "to": [ | ||||
|             3.0, | ||||
|             0.0 | ||||
|           ], | ||||
|           "units": { | ||||
|             "type": "Yards" | ||||
|           }, | ||||
|           "tag": null, | ||||
|           "__geoMeta": { | ||||
|             "id": "[uuid]", | ||||
|             "sourceRange": [] | ||||
|           } | ||||
|         }, | ||||
|         "artifactId": "[uuid]", | ||||
|         "originalId": "[uuid]", | ||||
|         "units": { | ||||
|           "type": "Yards" | ||||
|         } | ||||
|       }, | ||||
|       "height": 2.0, | ||||
|       "startCapId": "[uuid]", | ||||
|       "endCapId": "[uuid]", | ||||
|       "units": { | ||||
|         "type": "Yards" | ||||
|       }, | ||||
|       "sectional": false | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								rust/kcl-lib/tests/plane_of/rendered_model.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 53 KiB | 
							
								
								
									
										16
									
								
								rust/kcl-lib/tests/plane_of/unparsed.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,16 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Result of unparsing plane_of.kcl | ||||
| --- | ||||
| @settings(defaultLengthUnit = yd) | ||||
|  | ||||
| tri = startSketchOn(XY) | ||||
|   |> polygon(radius = 3, numSides = 3, center = [0, 0]) | ||||
|   |> extrude(length = 2) | ||||
|  | ||||
| // Get the plane which `tri` ends on. | ||||
| p0 = planeOf(tri, face = END) | ||||
|  | ||||
| // Offset that plane by 2, then draw a square on it. | ||||
| startSketchOn(offsetPlane(p0, offset = 2)) | ||||
|   |> polygon(radius = 2, numSides = 4, center = [0, 0]) | ||||
| @ -0,0 +1,206 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Artifact commands property_access_not_found_on_solid.kcl | ||||
| --- | ||||
| { | ||||
|   "rust/kcl-lib/tests/property_access_not_found_on_solid/input.kcl": [ | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "make_plane", | ||||
|         "origin": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "x_axis": { | ||||
|           "x": 1.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "y_axis": { | ||||
|           "x": 0.0, | ||||
|           "y": 1.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "size": 60.0, | ||||
|         "clobber": false, | ||||
|         "hide": true | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "enable_sketch_mode", | ||||
|         "entity_id": "[uuid]", | ||||
|         "ortho": false, | ||||
|         "animated": false, | ||||
|         "adjust_camera": false, | ||||
|         "planar_normal": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 1.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "start_path" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "move_path_pen", | ||||
|         "path": "[uuid]", | ||||
|         "to": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "sketch_mode_disable" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": 10.0, | ||||
|             "y": 10.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": -20.0, | ||||
|             "y": 0.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": 10.0, | ||||
|             "y": -10.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "close_path", | ||||
|         "path_id": "[uuid]" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "enable_sketch_mode", | ||||
|         "entity_id": "[uuid]", | ||||
|         "ortho": false, | ||||
|         "animated": false, | ||||
|         "adjust_camera": false, | ||||
|         "planar_normal": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 1.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extrude", | ||||
|         "target": "[uuid]", | ||||
|         "distance": 5.0, | ||||
|         "faces": null, | ||||
|         "opposite": "None" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "sketch_mode_disable" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "object_bring_to_front", | ||||
|         "object_id": "[uuid]" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "solid3d_get_extrusion_face_info", | ||||
|         "object_id": "[uuid]", | ||||
|         "edge_id": "[uuid]" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "solid3d_get_adjacency_info", | ||||
|         "object_id": "[uuid]", | ||||
|         "edge_id": "[uuid]" | ||||
|       } | ||||
|     } | ||||
|   ], | ||||
|   "std::appearance": [], | ||||
|   "std::array": [], | ||||
|   "std::math": [], | ||||
|   "std::prelude": [], | ||||
|   "std::sketch": [], | ||||
|   "std::solid": [], | ||||
|   "std::sweep": [], | ||||
|   "std::transform": [], | ||||
|   "std::turns": [], | ||||
|   "std::types": [], | ||||
|   "std::units": [] | ||||
| } | ||||
| @ -0,0 +1,6 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Artifact graph flowchart property_access_not_found_on_solid.kcl | ||||
| extension: md | ||||
| snapshot_kind: binary | ||||
| --- | ||||
| @ -0,0 +1,78 @@ | ||||
| ```mermaid | ||||
| flowchart LR | ||||
|   subgraph path2 [Path] | ||||
|     2["Path<br>[52, 77, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 1 }] | ||||
|     3["Segment<br>[85, 119, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 2 }] | ||||
|     4["Segment<br>[127, 147, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 3 }] | ||||
|     5["Segment<br>[155, 176, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 4 }] | ||||
|     6["Segment<br>[184, 191, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 5 }] | ||||
|     7[Solid2d] | ||||
|   end | ||||
|   1["Plane<br>[27, 44, 0]"] | ||||
|     %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 0 }] | ||||
|   8["Sweep Extrusion<br>[199, 235, 0]"] | ||||
|     %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, ReturnStatementArg, PipeBodyItem { index: 6 }] | ||||
|   9[Wall] | ||||
|     %% face_code_ref=Missing NodePath | ||||
|   10[Wall] | ||||
|     %% face_code_ref=Missing NodePath | ||||
|   11[Wall] | ||||
|     %% face_code_ref=Missing NodePath | ||||
|   12["Cap Start"] | ||||
|     %% face_code_ref=Missing NodePath | ||||
|   13["Cap End"] | ||||
|     %% face_code_ref=Missing NodePath | ||||
|   14["SweepEdge Opposite"] | ||||
|   15["SweepEdge Adjacent"] | ||||
|   16["SweepEdge Opposite"] | ||||
|   17["SweepEdge Adjacent"] | ||||
|   18["SweepEdge Opposite"] | ||||
|   19["SweepEdge Adjacent"] | ||||
|   1 --- 2 | ||||
|   2 --- 3 | ||||
|   2 --- 4 | ||||
|   2 --- 5 | ||||
|   2 --- 6 | ||||
|   2 --- 7 | ||||
|   2 ---- 8 | ||||
|   3 --- 9 | ||||
|   3 x--> 12 | ||||
|   3 --- 14 | ||||
|   3 --- 15 | ||||
|   4 --- 10 | ||||
|   4 x--> 12 | ||||
|   4 --- 16 | ||||
|   4 --- 17 | ||||
|   5 --- 11 | ||||
|   5 x--> 12 | ||||
|   5 --- 18 | ||||
|   5 --- 19 | ||||
|   8 --- 9 | ||||
|   8 --- 10 | ||||
|   8 --- 11 | ||||
|   8 --- 12 | ||||
|   8 --- 13 | ||||
|   8 --- 14 | ||||
|   8 --- 15 | ||||
|   8 --- 16 | ||||
|   8 --- 17 | ||||
|   8 --- 18 | ||||
|   8 --- 19 | ||||
|   9 --- 14 | ||||
|   9 --- 15 | ||||
|   19 <--x 9 | ||||
|   15 <--x 10 | ||||
|   10 --- 16 | ||||
|   10 --- 17 | ||||
|   17 <--x 11 | ||||
|   11 --- 18 | ||||
|   11 --- 19 | ||||
|   14 <--x 13 | ||||
|   16 <--x 13 | ||||
|   18 <--x 13 | ||||
| ``` | ||||
							
								
								
									
										780
									
								
								rust/kcl-lib/tests/property_access_not_found_on_solid/ast.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,780 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Result of parsing property_access_not_found_on_solid.kcl | ||||
| --- | ||||
| { | ||||
|   "Ok": { | ||||
|     "body": [ | ||||
|       { | ||||
|         "commentStart": 0, | ||||
|         "declaration": { | ||||
|           "commentStart": 0, | ||||
|           "end": 0, | ||||
|           "id": { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "name": "myFunction", | ||||
|             "start": 0, | ||||
|             "type": "Identifier" | ||||
|           }, | ||||
|           "init": { | ||||
|             "body": { | ||||
|               "body": [ | ||||
|                 { | ||||
|                   "argument": { | ||||
|                     "body": [ | ||||
|                       { | ||||
|                         "arguments": [], | ||||
|                         "callee": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "startSketchOn", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name" | ||||
|                         }, | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "start": 0, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "XY", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name", | ||||
|                           "type": "Name" | ||||
|                         } | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [ | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "name": "at", | ||||
|                               "start": 0, | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "commentStart": 0, | ||||
|                               "elements": [ | ||||
|                                 { | ||||
|                                   "commentStart": 0, | ||||
|                                   "end": 0, | ||||
|                                   "moduleId": 0, | ||||
|                                   "raw": "0", | ||||
|                                   "start": 0, | ||||
|                                   "type": "Literal", | ||||
|                                   "type": "Literal", | ||||
|                                   "value": { | ||||
|                                     "value": 0.0, | ||||
|                                     "suffix": "None" | ||||
|                                   } | ||||
|                                 }, | ||||
|                                 { | ||||
|                                   "commentStart": 0, | ||||
|                                   "end": 0, | ||||
|                                   "moduleId": 0, | ||||
|                                   "raw": "0", | ||||
|                                   "start": 0, | ||||
|                                   "type": "Literal", | ||||
|                                   "type": "Literal", | ||||
|                                   "value": { | ||||
|                                     "value": 0.0, | ||||
|                                     "suffix": "None" | ||||
|                                   } | ||||
|                                 } | ||||
|                               ], | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "start": 0, | ||||
|                               "type": "ArrayExpression", | ||||
|                               "type": "ArrayExpression" | ||||
|                             } | ||||
|                           } | ||||
|                         ], | ||||
|                         "callee": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "startProfile", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name" | ||||
|                         }, | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "start": 0, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": null | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [ | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "name": "end", | ||||
|                               "start": 0, | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "commentStart": 0, | ||||
|                               "elements": [ | ||||
|                                 { | ||||
|                                   "commentStart": 0, | ||||
|                                   "end": 0, | ||||
|                                   "moduleId": 0, | ||||
|                                   "raw": "10", | ||||
|                                   "start": 0, | ||||
|                                   "type": "Literal", | ||||
|                                   "type": "Literal", | ||||
|                                   "value": { | ||||
|                                     "value": 10.0, | ||||
|                                     "suffix": "None" | ||||
|                                   } | ||||
|                                 }, | ||||
|                                 { | ||||
|                                   "commentStart": 0, | ||||
|                                   "end": 0, | ||||
|                                   "moduleId": 0, | ||||
|                                   "raw": "10", | ||||
|                                   "start": 0, | ||||
|                                   "type": "Literal", | ||||
|                                   "type": "Literal", | ||||
|                                   "value": { | ||||
|                                     "value": 10.0, | ||||
|                                     "suffix": "None" | ||||
|                                   } | ||||
|                                 } | ||||
|                               ], | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "start": 0, | ||||
|                               "type": "ArrayExpression", | ||||
|                               "type": "ArrayExpression" | ||||
|                             } | ||||
|                           }, | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "name": "tag", | ||||
|                               "start": 0, | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "start": 0, | ||||
|                               "type": "TagDeclarator", | ||||
|                               "type": "TagDeclarator", | ||||
|                               "value": "seg01" | ||||
|                             } | ||||
|                           } | ||||
|                         ], | ||||
|                         "callee": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "line", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name" | ||||
|                         }, | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "start": 0, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": null | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [ | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "name": "end", | ||||
|                               "start": 0, | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "commentStart": 0, | ||||
|                               "elements": [ | ||||
|                                 { | ||||
|                                   "argument": { | ||||
|                                     "commentStart": 0, | ||||
|                                     "end": 0, | ||||
|                                     "moduleId": 0, | ||||
|                                     "raw": "20", | ||||
|                                     "start": 0, | ||||
|                                     "type": "Literal", | ||||
|                                     "type": "Literal", | ||||
|                                     "value": { | ||||
|                                       "value": 20.0, | ||||
|                                       "suffix": "None" | ||||
|                                     } | ||||
|                                   }, | ||||
|                                   "commentStart": 0, | ||||
|                                   "end": 0, | ||||
|                                   "moduleId": 0, | ||||
|                                   "operator": "-", | ||||
|                                   "start": 0, | ||||
|                                   "type": "UnaryExpression", | ||||
|                                   "type": "UnaryExpression" | ||||
|                                 }, | ||||
|                                 { | ||||
|                                   "commentStart": 0, | ||||
|                                   "end": 0, | ||||
|                                   "moduleId": 0, | ||||
|                                   "raw": "0", | ||||
|                                   "start": 0, | ||||
|                                   "type": "Literal", | ||||
|                                   "type": "Literal", | ||||
|                                   "value": { | ||||
|                                     "value": 0.0, | ||||
|                                     "suffix": "None" | ||||
|                                   } | ||||
|                                 } | ||||
|                               ], | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "start": 0, | ||||
|                               "type": "ArrayExpression", | ||||
|                               "type": "ArrayExpression" | ||||
|                             } | ||||
|                           } | ||||
|                         ], | ||||
|                         "callee": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "line", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name" | ||||
|                         }, | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "start": 0, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": null | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [ | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "name": "end", | ||||
|                               "start": 0, | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "commentStart": 0, | ||||
|                               "elements": [ | ||||
|                                 { | ||||
|                                   "commentStart": 0, | ||||
|                                   "end": 0, | ||||
|                                   "moduleId": 0, | ||||
|                                   "raw": "10", | ||||
|                                   "start": 0, | ||||
|                                   "type": "Literal", | ||||
|                                   "type": "Literal", | ||||
|                                   "value": { | ||||
|                                     "value": 10.0, | ||||
|                                     "suffix": "None" | ||||
|                                   } | ||||
|                                 }, | ||||
|                                 { | ||||
|                                   "argument": { | ||||
|                                     "commentStart": 0, | ||||
|                                     "end": 0, | ||||
|                                     "moduleId": 0, | ||||
|                                     "raw": "10", | ||||
|                                     "start": 0, | ||||
|                                     "type": "Literal", | ||||
|                                     "type": "Literal", | ||||
|                                     "value": { | ||||
|                                       "value": 10.0, | ||||
|                                       "suffix": "None" | ||||
|                                     } | ||||
|                                   }, | ||||
|                                   "commentStart": 0, | ||||
|                                   "end": 0, | ||||
|                                   "moduleId": 0, | ||||
|                                   "operator": "-", | ||||
|                                   "start": 0, | ||||
|                                   "type": "UnaryExpression", | ||||
|                                   "type": "UnaryExpression" | ||||
|                                 } | ||||
|                               ], | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "start": 0, | ||||
|                               "type": "ArrayExpression", | ||||
|                               "type": "ArrayExpression" | ||||
|                             } | ||||
|                           } | ||||
|                         ], | ||||
|                         "callee": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "line", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name" | ||||
|                         }, | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "start": 0, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": null | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [], | ||||
|                         "callee": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "close", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name" | ||||
|                         }, | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "start": 0, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": null | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [ | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "name": "length", | ||||
|                               "start": 0, | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "raw": "5", | ||||
|                               "start": 0, | ||||
|                               "type": "Literal", | ||||
|                               "type": "Literal", | ||||
|                               "value": { | ||||
|                                 "value": 5.0, | ||||
|                                 "suffix": "None" | ||||
|                               } | ||||
|                             } | ||||
|                           }, | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "name": "tagEnd", | ||||
|                               "start": 0, | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "start": 0, | ||||
|                               "type": "TagDeclarator", | ||||
|                               "type": "TagDeclarator", | ||||
|                               "value": "end01" | ||||
|                             } | ||||
|                           } | ||||
|                         ], | ||||
|                         "callee": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "extrude", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name" | ||||
|                         }, | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "start": 0, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": null | ||||
|                       } | ||||
|                     ], | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "start": 0, | ||||
|                     "type": "PipeExpression", | ||||
|                     "type": "PipeExpression" | ||||
|                   }, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "start": 0, | ||||
|                   "type": "ReturnStatement", | ||||
|                   "type": "ReturnStatement" | ||||
|                 } | ||||
|               ], | ||||
|               "commentStart": 0, | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "start": 0 | ||||
|             }, | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "params": [], | ||||
|             "start": 0, | ||||
|             "type": "FunctionExpression", | ||||
|             "type": "FunctionExpression" | ||||
|           }, | ||||
|           "moduleId": 0, | ||||
|           "start": 0, | ||||
|           "type": "VariableDeclarator" | ||||
|         }, | ||||
|         "end": 0, | ||||
|         "kind": "fn", | ||||
|         "moduleId": 0, | ||||
|         "start": 0, | ||||
|         "type": "VariableDeclaration", | ||||
|         "type": "VariableDeclaration" | ||||
|       }, | ||||
|       { | ||||
|         "commentStart": 0, | ||||
|         "declaration": { | ||||
|           "commentStart": 0, | ||||
|           "end": 0, | ||||
|           "id": { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "name": "myShape", | ||||
|             "start": 0, | ||||
|             "type": "Identifier" | ||||
|           }, | ||||
|           "init": { | ||||
|             "arguments": [], | ||||
|             "callee": { | ||||
|               "abs_path": false, | ||||
|               "commentStart": 0, | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "name": { | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "name": "myFunction", | ||||
|                 "start": 0, | ||||
|                 "type": "Identifier" | ||||
|               }, | ||||
|               "path": [], | ||||
|               "start": 0, | ||||
|               "type": "Name" | ||||
|             }, | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "start": 0, | ||||
|             "type": "CallExpressionKw", | ||||
|             "type": "CallExpressionKw", | ||||
|             "unlabeled": null | ||||
|           }, | ||||
|           "moduleId": 0, | ||||
|           "start": 0, | ||||
|           "type": "VariableDeclarator" | ||||
|         }, | ||||
|         "end": 0, | ||||
|         "kind": "const", | ||||
|         "moduleId": 0, | ||||
|         "start": 0, | ||||
|         "type": "VariableDeclaration", | ||||
|         "type": "VariableDeclaration" | ||||
|       }, | ||||
|       { | ||||
|         "commentStart": 0, | ||||
|         "declaration": { | ||||
|           "commentStart": 0, | ||||
|           "end": 0, | ||||
|           "id": { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "name": "sketch001", | ||||
|             "start": 0, | ||||
|             "type": "Identifier" | ||||
|           }, | ||||
|           "init": { | ||||
|             "arguments": [ | ||||
|               { | ||||
|                 "type": "LabeledArg", | ||||
|                 "label": { | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": "face", | ||||
|                   "start": 0, | ||||
|                   "type": "Identifier" | ||||
|                 }, | ||||
|                 "arg": { | ||||
|                   "commentStart": 0, | ||||
|                   "computed": false, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "object": { | ||||
|                     "commentStart": 0, | ||||
|                     "computed": false, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "object": { | ||||
|                       "abs_path": false, | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": { | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "name": "myShape", | ||||
|                         "start": 0, | ||||
|                         "type": "Identifier" | ||||
|                       }, | ||||
|                       "path": [], | ||||
|                       "start": 0, | ||||
|                       "type": "Name", | ||||
|                       "type": "Name" | ||||
|                     }, | ||||
|                     "property": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "tags", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier", | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "start": 0, | ||||
|                     "type": "MemberExpression", | ||||
|                     "type": "MemberExpression" | ||||
|                   }, | ||||
|                   "property": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "seg01", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier", | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "start": 0, | ||||
|                   "type": "MemberExpression", | ||||
|                   "type": "MemberExpression" | ||||
|                 } | ||||
|               } | ||||
|             ], | ||||
|             "callee": { | ||||
|               "abs_path": false, | ||||
|               "commentStart": 0, | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "name": { | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "name": "startSketchOn", | ||||
|                 "start": 0, | ||||
|                 "type": "Identifier" | ||||
|               }, | ||||
|               "path": [], | ||||
|               "start": 0, | ||||
|               "type": "Name" | ||||
|             }, | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "start": 0, | ||||
|             "type": "CallExpressionKw", | ||||
|             "type": "CallExpressionKw", | ||||
|             "unlabeled": { | ||||
|               "abs_path": false, | ||||
|               "commentStart": 0, | ||||
|               "end": 0, | ||||
|               "moduleId": 0, | ||||
|               "name": { | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "name": "myShape", | ||||
|                 "start": 0, | ||||
|                 "type": "Identifier" | ||||
|               }, | ||||
|               "path": [], | ||||
|               "start": 0, | ||||
|               "type": "Name", | ||||
|               "type": "Name" | ||||
|             } | ||||
|           }, | ||||
|           "moduleId": 0, | ||||
|           "start": 0, | ||||
|           "type": "VariableDeclarator" | ||||
|         }, | ||||
|         "end": 0, | ||||
|         "kind": "const", | ||||
|         "moduleId": 0, | ||||
|         "start": 0, | ||||
|         "type": "VariableDeclaration", | ||||
|         "type": "VariableDeclaration" | ||||
|       } | ||||
|     ], | ||||
|     "commentStart": 0, | ||||
|     "end": 0, | ||||
|     "moduleId": 0, | ||||
|     "nonCodeMeta": { | ||||
|       "nonCodeNodes": { | ||||
|         "0": [ | ||||
|           { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "start": 0, | ||||
|             "type": "NonCodeNode", | ||||
|             "value": { | ||||
|               "type": "newLine" | ||||
|             } | ||||
|           } | ||||
|         ], | ||||
|         "1": [ | ||||
|           { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "start": 0, | ||||
|             "type": "NonCodeNode", | ||||
|             "value": { | ||||
|               "type": "newLine" | ||||
|             } | ||||
|           } | ||||
|         ], | ||||
|         "2": [ | ||||
|           { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "start": 0, | ||||
|             "type": "NonCodeNode", | ||||
|             "value": { | ||||
|               "type": "newLine" | ||||
|             } | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "startNodes": [] | ||||
|     }, | ||||
|     "start": 0 | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,15 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Error from executing property_access_not_found_on_solid.kcl | ||||
| --- | ||||
| KCL Semantic error | ||||
|  | ||||
|   × semantic: Property `tags` not found on a solid. You can get a solid's tags | ||||
|   │ through its sketch, as in, `exampleSolid.sketch.tags`. | ||||
|     ╭─[13:43] | ||||
|  12 │  | ||||
|  13 │ sketch001 = startSketchOn(myShape, face = myShape.tags.seg01) | ||||
|     ·                                           ──────┬───── | ||||
|     ·                                                 ╰── tests/property_access_not_found_on_solid/input.kcl | ||||
|  14 │  | ||||
|     ╰──── | ||||
| @ -0,0 +1,14 @@ | ||||
| fn myFunction() { | ||||
|   return startSketchOn(XY) | ||||
|     |> startProfile(at = [0, 0]) | ||||
|     |> line(end = [10, 10], tag = $seg01) | ||||
|     |> line(end = [-20, 0]) | ||||
|     |> line(end = [10, -10]) | ||||
|     |> close() | ||||
|     |> extrude(length = 5, tagEnd = $end01) | ||||
| } | ||||
|  | ||||
| myShape = myFunction() | ||||
|  | ||||
| sketch001 = startSketchOn(myShape, face = myShape.tags.seg01) | ||||
|  | ||||
							
								
								
									
										233
									
								
								rust/kcl-lib/tests/property_access_not_found_on_solid/ops.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,233 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Operations executed property_access_not_found_on_solid.kcl | ||||
| --- | ||||
| { | ||||
|   "rust/kcl-lib/tests/property_access_not_found_on_solid/input.kcl": [ | ||||
|     { | ||||
|       "type": "GroupBegin", | ||||
|       "group": { | ||||
|         "type": "FunctionCall", | ||||
|         "name": "myFunction", | ||||
|         "functionSourceRange": [], | ||||
|         "unlabeledArg": null, | ||||
|         "labeledArgs": {} | ||||
|       }, | ||||
|       "nodePath": { | ||||
|         "steps": [ | ||||
|           { | ||||
|             "type": "ProgramBodyItem", | ||||
|             "index": 1 | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationDeclaration" | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationInit" | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "StdLibCall", | ||||
|       "name": "startSketchOn", | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Plane", | ||||
|           "artifact_id": "[uuid]" | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": {}, | ||||
|       "nodePath": { | ||||
|         "steps": [ | ||||
|           { | ||||
|             "type": "ProgramBodyItem", | ||||
|             "index": 0 | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationDeclaration" | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationInit" | ||||
|           }, | ||||
|           { | ||||
|             "type": "FunctionExpressionBody" | ||||
|           }, | ||||
|           { | ||||
|             "type": "FunctionExpressionBodyItem", | ||||
|             "index": 0 | ||||
|           }, | ||||
|           { | ||||
|             "type": "ReturnStatementArg" | ||||
|           }, | ||||
|           { | ||||
|             "type": "PipeBodyItem", | ||||
|             "index": 0 | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "StdLibCall", | ||||
|       "name": "extrude", | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Sketch", | ||||
|           "value": { | ||||
|             "artifactId": "[uuid]" | ||||
|           } | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": { | ||||
|         "length": { | ||||
|           "value": { | ||||
|             "type": "Number", | ||||
|             "value": 5.0, | ||||
|             "ty": { | ||||
|               "type": "Default", | ||||
|               "len": { | ||||
|                 "type": "Mm" | ||||
|               }, | ||||
|               "angle": { | ||||
|                 "type": "Degrees" | ||||
|               } | ||||
|             } | ||||
|           }, | ||||
|           "sourceRange": [] | ||||
|         }, | ||||
|         "tagEnd": { | ||||
|           "value": { | ||||
|             "type": "TagDeclarator", | ||||
|             "name": "end01" | ||||
|           }, | ||||
|           "sourceRange": [] | ||||
|         } | ||||
|       }, | ||||
|       "nodePath": { | ||||
|         "steps": [ | ||||
|           { | ||||
|             "type": "ProgramBodyItem", | ||||
|             "index": 0 | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationDeclaration" | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationInit" | ||||
|           }, | ||||
|           { | ||||
|             "type": "FunctionExpressionBody" | ||||
|           }, | ||||
|           { | ||||
|             "type": "FunctionExpressionBodyItem", | ||||
|             "index": 0 | ||||
|           }, | ||||
|           { | ||||
|             "type": "ReturnStatementArg" | ||||
|           }, | ||||
|           { | ||||
|             "type": "PipeBodyItem", | ||||
|             "index": 6 | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "GroupEnd" | ||||
|     } | ||||
|   ], | ||||
|   "std::appearance": [], | ||||
|   "std::array": [], | ||||
|   "std::math": [ | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "PI", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 3.141592653589793, | ||||
|         "ty": { | ||||
|           "type": "Unknown" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "E", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 2.718281828459045, | ||||
|         "ty": { | ||||
|           "type": "Known", | ||||
|           "type": "Count" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "TAU", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 6.283185307179586, | ||||
|         "ty": { | ||||
|           "type": "Known", | ||||
|           "type": "Count" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::prelude": [ | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "START", | ||||
|       "value": { | ||||
|         "type": "String", | ||||
|         "value": "start" | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "END", | ||||
|       "value": { | ||||
|         "type": "String", | ||||
|         "value": "end" | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::sketch": [], | ||||
|   "std::solid": [], | ||||
|   "std::sweep": [], | ||||
|   "std::transform": [], | ||||
|   "std::turns": [], | ||||
|   "std::types": [], | ||||
|   "std::units": [] | ||||
| } | ||||
| @ -0,0 +1,17 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Result of unparsing property_access_not_found_on_solid.kcl | ||||
| --- | ||||
| fn myFunction() { | ||||
|   return startSketchOn(XY) | ||||
|     |> startProfile(at = [0, 0]) | ||||
|     |> line(end = [10, 10], tag = $seg01) | ||||
|     |> line(end = [-20, 0]) | ||||
|     |> line(end = [10, -10]) | ||||
|     |> close() | ||||
|     |> extrude(length = 5, tagEnd = $end01) | ||||
| } | ||||
|  | ||||
| myShape = myFunction() | ||||
|  | ||||
| sketch001 = startSketchOn(myShape, face = myShape.tags.seg01) | ||||
							
								
								
									
										163
									
								
								rust/kcl-lib/tests/rect/artifact_commands.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,163 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Artifact commands rect.kcl | ||||
| --- | ||||
| { | ||||
|   "rust/kcl-lib/tests/rect/input.kcl": [ | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "make_plane", | ||||
|         "origin": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "x_axis": { | ||||
|           "x": 1.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "y_axis": { | ||||
|           "x": 0.0, | ||||
|           "y": 1.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "size": 60.0, | ||||
|         "clobber": false, | ||||
|         "hide": true | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "enable_sketch_mode", | ||||
|         "entity_id": "[uuid]", | ||||
|         "ortho": false, | ||||
|         "animated": false, | ||||
|         "adjust_camera": false, | ||||
|         "planar_normal": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 1.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "start_path" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "move_path_pen", | ||||
|         "path": "[uuid]", | ||||
|         "to": { | ||||
|           "x": -2.0, | ||||
|           "y": -1.0, | ||||
|           "z": 0.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "sketch_mode_disable" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": 3.0, | ||||
|             "y": 0.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": 0.00000000000000012246467991473532, | ||||
|             "y": 2.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": -3.0, | ||||
|             "y": -0.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": -2.0, | ||||
|             "y": -1.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": false | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "close_path", | ||||
|         "path_id": "[uuid]" | ||||
|       } | ||||
|     } | ||||
|   ], | ||||
|   "std::appearance": [], | ||||
|   "std::array": [], | ||||
|   "std::math": [], | ||||
|   "std::prelude": [], | ||||
|   "std::sketch": [], | ||||
|   "std::solid": [], | ||||
|   "std::sweep": [], | ||||
|   "std::transform": [], | ||||
|   "std::turns": [], | ||||
|   "std::types": [], | ||||
|   "std::units": [] | ||||
| } | ||||
							
								
								
									
										6
									
								
								rust/kcl-lib/tests/rect/artifact_graph_flowchart.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,6 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Artifact graph flowchart rect.kcl | ||||
| extension: md | ||||
| snapshot_kind: binary | ||||
| --- | ||||
							
								
								
									
										27
									
								
								rust/kcl-lib/tests/rect/artifact_graph_flowchart.snap.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,27 @@ | ||||
| ```mermaid | ||||
| flowchart LR | ||||
|   subgraph path2 [Path] | ||||
|     2["Path<br>[27, 54, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] | ||||
|     3["Segment<br>[60, 103, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }] | ||||
|     4["Segment<br>[109, 155, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }] | ||||
|     5["Segment<br>[161, 211, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }] | ||||
|     6["Segment<br>[217, 273, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }] | ||||
|     7["Segment<br>[279, 286, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }] | ||||
|     8[Solid2d] | ||||
|   end | ||||
|   1["Plane<br>[4, 21, 0]"] | ||||
|     %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] | ||||
|   1 --- 2 | ||||
|   2 --- 3 | ||||
|   2 --- 4 | ||||
|   2 --- 5 | ||||
|   2 --- 6 | ||||
|   2 --- 7 | ||||
|   2 --- 8 | ||||
| ``` | ||||
							
								
								
									
										701
									
								
								rust/kcl-lib/tests/rect/ast.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,701 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Result of parsing rect.kcl | ||||
| --- | ||||
| { | ||||
|   "Ok": { | ||||
|     "body": [ | ||||
|       { | ||||
|         "commentStart": 0, | ||||
|         "declaration": { | ||||
|           "commentStart": 0, | ||||
|           "end": 0, | ||||
|           "id": { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "name": "x", | ||||
|             "start": 0, | ||||
|             "type": "Identifier" | ||||
|           }, | ||||
|           "init": { | ||||
|             "body": [ | ||||
|               { | ||||
|                 "arguments": [], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "startSketchOn", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "XY", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name", | ||||
|                   "type": "Name" | ||||
|                 } | ||||
|               }, | ||||
|               { | ||||
|                 "arguments": [ | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "at", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "elements": [ | ||||
|                         { | ||||
|                           "argument": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "raw": "2", | ||||
|                             "start": 0, | ||||
|                             "type": "Literal", | ||||
|                             "type": "Literal", | ||||
|                             "value": { | ||||
|                               "value": 2.0, | ||||
|                               "suffix": "None" | ||||
|                             } | ||||
|                           }, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "operator": "-", | ||||
|                           "start": 0, | ||||
|                           "type": "UnaryExpression", | ||||
|                           "type": "UnaryExpression" | ||||
|                         }, | ||||
|                         { | ||||
|                           "argument": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "raw": "1", | ||||
|                             "start": 0, | ||||
|                             "type": "Literal", | ||||
|                             "type": "Literal", | ||||
|                             "value": { | ||||
|                               "value": 1.0, | ||||
|                               "suffix": "None" | ||||
|                             } | ||||
|                           }, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "operator": "-", | ||||
|                           "start": 0, | ||||
|                           "type": "UnaryExpression", | ||||
|                           "type": "UnaryExpression" | ||||
|                         } | ||||
|                       ], | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "start": 0, | ||||
|                       "type": "ArrayExpression", | ||||
|                       "type": "ArrayExpression" | ||||
|                     } | ||||
|                   } | ||||
|                 ], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "startProfile", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": null | ||||
|               }, | ||||
|               { | ||||
|                 "arguments": [ | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "angle", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "raw": "0", | ||||
|                       "start": 0, | ||||
|                       "type": "Literal", | ||||
|                       "type": "Literal", | ||||
|                       "value": { | ||||
|                         "value": 0.0, | ||||
|                         "suffix": "None" | ||||
|                       } | ||||
|                     } | ||||
|                   }, | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "length", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "raw": "3", | ||||
|                       "start": 0, | ||||
|                       "type": "Literal", | ||||
|                       "type": "Literal", | ||||
|                       "value": { | ||||
|                         "value": 3.0, | ||||
|                         "suffix": "None" | ||||
|                       } | ||||
|                     } | ||||
|                   }, | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "tag", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "start": 0, | ||||
|                       "type": "TagDeclarator", | ||||
|                       "type": "TagDeclarator", | ||||
|                       "value": "a" | ||||
|                     } | ||||
|                   } | ||||
|                 ], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "angledLine", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": null | ||||
|               }, | ||||
|               { | ||||
|                 "arguments": [ | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "angle", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "left": { | ||||
|                         "arguments": [], | ||||
|                         "callee": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "segAng", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name" | ||||
|                         }, | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "start": 0, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "a", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name", | ||||
|                           "type": "Name" | ||||
|                         } | ||||
|                       }, | ||||
|                       "moduleId": 0, | ||||
|                       "operator": "+", | ||||
|                       "right": { | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "raw": "90", | ||||
|                         "start": 0, | ||||
|                         "type": "Literal", | ||||
|                         "type": "Literal", | ||||
|                         "value": { | ||||
|                           "value": 90.0, | ||||
|                           "suffix": "None" | ||||
|                         } | ||||
|                       }, | ||||
|                       "start": 0, | ||||
|                       "type": "BinaryExpression", | ||||
|                       "type": "BinaryExpression" | ||||
|                     } | ||||
|                   }, | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "length", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "raw": "2", | ||||
|                       "start": 0, | ||||
|                       "type": "Literal", | ||||
|                       "type": "Literal", | ||||
|                       "value": { | ||||
|                         "value": 2.0, | ||||
|                         "suffix": "None" | ||||
|                       } | ||||
|                     } | ||||
|                   } | ||||
|                 ], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "angledLine", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": null | ||||
|               }, | ||||
|               { | ||||
|                 "arguments": [ | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "angle", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "arguments": [], | ||||
|                       "callee": { | ||||
|                         "abs_path": false, | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "name": { | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": "segAng", | ||||
|                           "start": 0, | ||||
|                           "type": "Identifier" | ||||
|                         }, | ||||
|                         "path": [], | ||||
|                         "start": 0, | ||||
|                         "type": "Name" | ||||
|                       }, | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "start": 0, | ||||
|                       "type": "CallExpressionKw", | ||||
|                       "type": "CallExpressionKw", | ||||
|                       "unlabeled": { | ||||
|                         "abs_path": false, | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "name": { | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": "a", | ||||
|                           "start": 0, | ||||
|                           "type": "Identifier" | ||||
|                         }, | ||||
|                         "path": [], | ||||
|                         "start": 0, | ||||
|                         "type": "Name", | ||||
|                         "type": "Name" | ||||
|                       } | ||||
|                     } | ||||
|                   }, | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "length", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "argument": { | ||||
|                         "arguments": [], | ||||
|                         "callee": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "segLen", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name" | ||||
|                         }, | ||||
|                         "commentStart": 0, | ||||
|                         "end": 0, | ||||
|                         "moduleId": 0, | ||||
|                         "start": 0, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": { | ||||
|                           "abs_path": false, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "name": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": "a", | ||||
|                             "start": 0, | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "path": [], | ||||
|                           "start": 0, | ||||
|                           "type": "Name", | ||||
|                           "type": "Name" | ||||
|                         } | ||||
|                       }, | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "operator": "-", | ||||
|                       "start": 0, | ||||
|                       "type": "UnaryExpression", | ||||
|                       "type": "UnaryExpression" | ||||
|                     } | ||||
|                   } | ||||
|                 ], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "angledLine", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": null | ||||
|               }, | ||||
|               { | ||||
|                 "arguments": [ | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "endAbsolute", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "elements": [ | ||||
|                         { | ||||
|                           "arguments": [], | ||||
|                           "callee": { | ||||
|                             "abs_path": false, | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "name": "profileStartX", | ||||
|                               "start": 0, | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "path": [], | ||||
|                             "start": 0, | ||||
|                             "type": "Name" | ||||
|                           }, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "start": 0, | ||||
|                           "type": "CallExpressionKw", | ||||
|                           "type": "CallExpressionKw", | ||||
|                           "unlabeled": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "start": 0, | ||||
|                             "type": "PipeSubstitution", | ||||
|                             "type": "PipeSubstitution" | ||||
|                           } | ||||
|                         }, | ||||
|                         { | ||||
|                           "arguments": [], | ||||
|                           "callee": { | ||||
|                             "abs_path": false, | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "name": { | ||||
|                               "commentStart": 0, | ||||
|                               "end": 0, | ||||
|                               "moduleId": 0, | ||||
|                               "name": "profileStartY", | ||||
|                               "start": 0, | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "path": [], | ||||
|                             "start": 0, | ||||
|                             "type": "Name" | ||||
|                           }, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "start": 0, | ||||
|                           "type": "CallExpressionKw", | ||||
|                           "type": "CallExpressionKw", | ||||
|                           "unlabeled": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "start": 0, | ||||
|                             "type": "PipeSubstitution", | ||||
|                             "type": "PipeSubstitution" | ||||
|                           } | ||||
|                         } | ||||
|                       ], | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "start": 0, | ||||
|                       "type": "ArrayExpression", | ||||
|                       "type": "ArrayExpression" | ||||
|                     } | ||||
|                   } | ||||
|                 ], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "line", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": null | ||||
|               }, | ||||
|               { | ||||
|                 "arguments": [], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "close", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": null | ||||
|               } | ||||
|             ], | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "start": 0, | ||||
|             "type": "PipeExpression", | ||||
|             "type": "PipeExpression" | ||||
|           }, | ||||
|           "moduleId": 0, | ||||
|           "start": 0, | ||||
|           "type": "VariableDeclarator" | ||||
|         }, | ||||
|         "end": 0, | ||||
|         "kind": "const", | ||||
|         "moduleId": 0, | ||||
|         "start": 0, | ||||
|         "type": "VariableDeclaration", | ||||
|         "type": "VariableDeclaration" | ||||
|       } | ||||
|     ], | ||||
|     "commentStart": 0, | ||||
|     "end": 0, | ||||
|     "moduleId": 0, | ||||
|     "start": 0 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										7
									
								
								rust/kcl-lib/tests/rect/input.kcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,7 @@ | ||||
| x = startSketchOn(XY) | ||||
|   |> startProfile(at = [-2, -1]) | ||||
|   |> angledLine(angle = 0, length = 3, tag = $a) | ||||
|   |> angledLine(angle = segAng(a) + 90, length = 2) | ||||
|   |> angledLine(angle = segAng(a), length = -segLen(a)) | ||||
|   |> line(endAbsolute = [profileStartX(%), profileStartY(%)]) | ||||
|   |> close() | ||||
							
								
								
									
										128
									
								
								rust/kcl-lib/tests/rect/ops.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,128 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Operations executed rect.kcl | ||||
| --- | ||||
| { | ||||
|   "rust/kcl-lib/tests/rect/input.kcl": [ | ||||
|     { | ||||
|       "type": "StdLibCall", | ||||
|       "name": "startSketchOn", | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Plane", | ||||
|           "artifact_id": "[uuid]" | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": {}, | ||||
|       "nodePath": { | ||||
|         "steps": [ | ||||
|           { | ||||
|             "type": "ProgramBodyItem", | ||||
|             "index": 0 | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationDeclaration" | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationInit" | ||||
|           }, | ||||
|           { | ||||
|             "type": "PipeBodyItem", | ||||
|             "index": 0 | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::appearance": [], | ||||
|   "std::array": [], | ||||
|   "std::math": [ | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "PI", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 3.141592653589793, | ||||
|         "ty": { | ||||
|           "type": "Unknown" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "E", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 2.718281828459045, | ||||
|         "ty": { | ||||
|           "type": "Known", | ||||
|           "type": "Count" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "TAU", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 6.283185307179586, | ||||
|         "ty": { | ||||
|           "type": "Known", | ||||
|           "type": "Count" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::prelude": [ | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "START", | ||||
|       "value": { | ||||
|         "type": "String", | ||||
|         "value": "start" | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "END", | ||||
|       "value": { | ||||
|         "type": "String", | ||||
|         "value": "end" | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::sketch": [], | ||||
|   "std::solid": [], | ||||
|   "std::sweep": [], | ||||
|   "std::transform": [], | ||||
|   "std::turns": [], | ||||
|   "std::types": [], | ||||
|   "std::units": [] | ||||
| } | ||||
							
								
								
									
										181
									
								
								rust/kcl-lib/tests/rect/program_memory.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,181 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Variables in memory after executing rect.kcl | ||||
| --- | ||||
| { | ||||
|   "a": { | ||||
|     "type": "TagIdentifier", | ||||
|     "type": "TagIdentifier", | ||||
|     "value": "a" | ||||
|   }, | ||||
|   "x": { | ||||
|     "type": "Sketch", | ||||
|     "value": { | ||||
|       "type": "Sketch", | ||||
|       "id": "[uuid]", | ||||
|       "paths": [ | ||||
|         { | ||||
|           "__geoMeta": { | ||||
|             "id": "[uuid]", | ||||
|             "sourceRange": [] | ||||
|           }, | ||||
|           "from": [ | ||||
|             -2.0, | ||||
|             -1.0 | ||||
|           ], | ||||
|           "tag": { | ||||
|             "commentStart": 100, | ||||
|             "end": 102, | ||||
|             "moduleId": 0, | ||||
|             "start": 100, | ||||
|             "type": "TagDeclarator", | ||||
|             "value": "a" | ||||
|           }, | ||||
|           "to": [ | ||||
|             1.0, | ||||
|             -1.0 | ||||
|           ], | ||||
|           "type": "ToPoint", | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           } | ||||
|         }, | ||||
|         { | ||||
|           "__geoMeta": { | ||||
|             "id": "[uuid]", | ||||
|             "sourceRange": [] | ||||
|           }, | ||||
|           "from": [ | ||||
|             1.0, | ||||
|             -1.0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "to": [ | ||||
|             1.0000000000000002, | ||||
|             1.0 | ||||
|           ], | ||||
|           "type": "ToPoint", | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           } | ||||
|         }, | ||||
|         { | ||||
|           "__geoMeta": { | ||||
|             "id": "[uuid]", | ||||
|             "sourceRange": [] | ||||
|           }, | ||||
|           "from": [ | ||||
|             1.0000000000000002, | ||||
|             1.0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "to": [ | ||||
|             -1.9999999999999998, | ||||
|             1.0 | ||||
|           ], | ||||
|           "type": "ToPoint", | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           } | ||||
|         }, | ||||
|         { | ||||
|           "__geoMeta": { | ||||
|             "id": "[uuid]", | ||||
|             "sourceRange": [] | ||||
|           }, | ||||
|           "from": [ | ||||
|             -1.9999999999999998, | ||||
|             1.0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "to": [ | ||||
|             -2.0, | ||||
|             -1.0 | ||||
|           ], | ||||
|           "type": "ToPoint", | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           } | ||||
|         }, | ||||
|         { | ||||
|           "__geoMeta": { | ||||
|             "id": "[uuid]", | ||||
|             "sourceRange": [] | ||||
|           }, | ||||
|           "from": [ | ||||
|             -2.0, | ||||
|             -1.0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "to": [ | ||||
|             -2.0, | ||||
|             -1.0 | ||||
|           ], | ||||
|           "type": "ToPoint", | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           } | ||||
|         } | ||||
|       ], | ||||
|       "on": { | ||||
|         "artifactId": "[uuid]", | ||||
|         "id": "[uuid]", | ||||
|         "origin": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0, | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           } | ||||
|         }, | ||||
|         "type": "plane", | ||||
|         "value": "XY", | ||||
|         "xAxis": { | ||||
|           "x": 1.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0, | ||||
|           "units": { | ||||
|             "type": "Unknown" | ||||
|           } | ||||
|         }, | ||||
|         "yAxis": { | ||||
|           "x": 0.0, | ||||
|           "y": 1.0, | ||||
|           "z": 0.0, | ||||
|           "units": { | ||||
|             "type": "Unknown" | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|       "start": { | ||||
|         "from": [ | ||||
|           -2.0, | ||||
|           -1.0 | ||||
|         ], | ||||
|         "to": [ | ||||
|           -2.0, | ||||
|           -1.0 | ||||
|         ], | ||||
|         "units": { | ||||
|           "type": "Mm" | ||||
|         }, | ||||
|         "tag": null, | ||||
|         "__geoMeta": { | ||||
|           "id": "[uuid]", | ||||
|           "sourceRange": [] | ||||
|         } | ||||
|       }, | ||||
|       "tags": { | ||||
|         "a": { | ||||
|           "type": "TagIdentifier", | ||||
|           "value": "a" | ||||
|         } | ||||
|       }, | ||||
|       "artifactId": "[uuid]", | ||||
|       "originalId": "[uuid]", | ||||
|       "units": { | ||||
|         "type": "Mm" | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								rust/kcl-lib/tests/rect/rendered_model.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 26 KiB | 
							
								
								
									
										11
									
								
								rust/kcl-lib/tests/rect/unparsed.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,11 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Result of unparsing rect.kcl | ||||
| --- | ||||
| x = startSketchOn(XY) | ||||
|   |> startProfile(at = [-2, -1]) | ||||
|   |> angledLine(angle = 0, length = 3, tag = $a) | ||||
|   |> angledLine(angle = segAng(a) + 90, length = 2) | ||||
|   |> angledLine(angle = segAng(a), length = -segLen(a)) | ||||
|   |> line(endAbsolute = [profileStartX(%), profileStartY(%)]) | ||||
|   |> close() | ||||
							
								
								
									
										163
									
								
								rust/kcl-lib/tests/rect_helper/artifact_commands.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,163 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Artifact commands rect_helper.kcl | ||||
| --- | ||||
| { | ||||
|   "rust/kcl-lib/tests/rect_helper/input.kcl": [ | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "make_plane", | ||||
|         "origin": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "x_axis": { | ||||
|           "x": 1.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "y_axis": { | ||||
|           "x": 0.0, | ||||
|           "y": 1.0, | ||||
|           "z": 0.0 | ||||
|         }, | ||||
|         "size": 60.0, | ||||
|         "clobber": false, | ||||
|         "hide": true | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "enable_sketch_mode", | ||||
|         "entity_id": "[uuid]", | ||||
|         "ortho": false, | ||||
|         "animated": false, | ||||
|         "adjust_camera": false, | ||||
|         "planar_normal": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 1.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "start_path" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "move_path_pen", | ||||
|         "path": "[uuid]", | ||||
|         "to": { | ||||
|           "x": -2.0, | ||||
|           "y": -1.0, | ||||
|           "z": 0.0 | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "sketch_mode_disable" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": 3.0, | ||||
|             "y": 0.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": 0.0, | ||||
|             "y": 2.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": -3.0, | ||||
|             "y": 0.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "extend_path", | ||||
|         "path": "[uuid]", | ||||
|         "segment": { | ||||
|           "type": "line", | ||||
|           "end": { | ||||
|             "x": 0.0, | ||||
|             "y": -2.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "relative": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "cmdId": "[uuid]", | ||||
|       "range": [], | ||||
|       "command": { | ||||
|         "type": "close_path", | ||||
|         "path_id": "[uuid]" | ||||
|       } | ||||
|     } | ||||
|   ], | ||||
|   "std::appearance": [], | ||||
|   "std::array": [], | ||||
|   "std::math": [], | ||||
|   "std::prelude": [], | ||||
|   "std::sketch": [], | ||||
|   "std::solid": [], | ||||
|   "std::sweep": [], | ||||
|   "std::transform": [], | ||||
|   "std::turns": [], | ||||
|   "std::types": [], | ||||
|   "std::units": [] | ||||
| } | ||||
| @ -0,0 +1,6 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Artifact graph flowchart rect_helper.kcl | ||||
| extension: md | ||||
| snapshot_kind: binary | ||||
| --- | ||||
| @ -0,0 +1,24 @@ | ||||
| ```mermaid | ||||
| flowchart LR | ||||
|   subgraph path2 [Path] | ||||
|     2["Path<br>[25, 76, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] | ||||
|     3["Segment<br>[25, 76, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] | ||||
|     4["Segment<br>[25, 76, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] | ||||
|     5["Segment<br>[25, 76, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] | ||||
|     6["Segment<br>[25, 76, 0]"] | ||||
|       %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] | ||||
|     7[Solid2d] | ||||
|   end | ||||
|   1["Plane<br>[4, 21, 0]"] | ||||
|     %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] | ||||
|   1 --- 2 | ||||
|   2 --- 3 | ||||
|   2 --- 4 | ||||
|   2 --- 5 | ||||
|   2 --- 6 | ||||
|   2 --- 7 | ||||
| ``` | ||||
							
								
								
									
										233
									
								
								rust/kcl-lib/tests/rect_helper/ast.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,233 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Result of parsing rect_helper.kcl | ||||
| --- | ||||
| { | ||||
|   "Ok": { | ||||
|     "body": [ | ||||
|       { | ||||
|         "commentStart": 0, | ||||
|         "declaration": { | ||||
|           "commentStart": 0, | ||||
|           "end": 0, | ||||
|           "id": { | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "name": "x", | ||||
|             "start": 0, | ||||
|             "type": "Identifier" | ||||
|           }, | ||||
|           "init": { | ||||
|             "body": [ | ||||
|               { | ||||
|                 "arguments": [], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "startSketchOn", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "XY", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name", | ||||
|                   "type": "Name" | ||||
|                 } | ||||
|               }, | ||||
|               { | ||||
|                 "arguments": [ | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "width", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "raw": "3", | ||||
|                       "start": 0, | ||||
|                       "type": "Literal", | ||||
|                       "type": "Literal", | ||||
|                       "value": { | ||||
|                         "value": 3.0, | ||||
|                         "suffix": "None" | ||||
|                       } | ||||
|                     } | ||||
|                   }, | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "height", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "raw": "2", | ||||
|                       "start": 0, | ||||
|                       "type": "Literal", | ||||
|                       "type": "Literal", | ||||
|                       "value": { | ||||
|                         "value": 2.0, | ||||
|                         "suffix": "None" | ||||
|                       } | ||||
|                     } | ||||
|                   }, | ||||
|                   { | ||||
|                     "type": "LabeledArg", | ||||
|                     "label": { | ||||
|                       "commentStart": 0, | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "name": "corner", | ||||
|                       "start": 0, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "arg": { | ||||
|                       "commentStart": 0, | ||||
|                       "elements": [ | ||||
|                         { | ||||
|                           "argument": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "raw": "2", | ||||
|                             "start": 0, | ||||
|                             "type": "Literal", | ||||
|                             "type": "Literal", | ||||
|                             "value": { | ||||
|                               "value": 2.0, | ||||
|                               "suffix": "None" | ||||
|                             } | ||||
|                           }, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "operator": "-", | ||||
|                           "start": 0, | ||||
|                           "type": "UnaryExpression", | ||||
|                           "type": "UnaryExpression" | ||||
|                         }, | ||||
|                         { | ||||
|                           "argument": { | ||||
|                             "commentStart": 0, | ||||
|                             "end": 0, | ||||
|                             "moduleId": 0, | ||||
|                             "raw": "1", | ||||
|                             "start": 0, | ||||
|                             "type": "Literal", | ||||
|                             "type": "Literal", | ||||
|                             "value": { | ||||
|                               "value": 1.0, | ||||
|                               "suffix": "None" | ||||
|                             } | ||||
|                           }, | ||||
|                           "commentStart": 0, | ||||
|                           "end": 0, | ||||
|                           "moduleId": 0, | ||||
|                           "operator": "-", | ||||
|                           "start": 0, | ||||
|                           "type": "UnaryExpression", | ||||
|                           "type": "UnaryExpression" | ||||
|                         } | ||||
|                       ], | ||||
|                       "end": 0, | ||||
|                       "moduleId": 0, | ||||
|                       "start": 0, | ||||
|                       "type": "ArrayExpression", | ||||
|                       "type": "ArrayExpression" | ||||
|                     } | ||||
|                   } | ||||
|                 ], | ||||
|                 "callee": { | ||||
|                   "abs_path": false, | ||||
|                   "commentStart": 0, | ||||
|                   "end": 0, | ||||
|                   "moduleId": 0, | ||||
|                   "name": { | ||||
|                     "commentStart": 0, | ||||
|                     "end": 0, | ||||
|                     "moduleId": 0, | ||||
|                     "name": "rectangle", | ||||
|                     "start": 0, | ||||
|                     "type": "Identifier" | ||||
|                   }, | ||||
|                   "path": [], | ||||
|                   "start": 0, | ||||
|                   "type": "Name" | ||||
|                 }, | ||||
|                 "commentStart": 0, | ||||
|                 "end": 0, | ||||
|                 "moduleId": 0, | ||||
|                 "start": 0, | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "type": "CallExpressionKw", | ||||
|                 "unlabeled": null | ||||
|               } | ||||
|             ], | ||||
|             "commentStart": 0, | ||||
|             "end": 0, | ||||
|             "moduleId": 0, | ||||
|             "start": 0, | ||||
|             "type": "PipeExpression", | ||||
|             "type": "PipeExpression" | ||||
|           }, | ||||
|           "moduleId": 0, | ||||
|           "start": 0, | ||||
|           "type": "VariableDeclarator" | ||||
|         }, | ||||
|         "end": 0, | ||||
|         "kind": "const", | ||||
|         "moduleId": 0, | ||||
|         "start": 0, | ||||
|         "type": "VariableDeclaration", | ||||
|         "type": "VariableDeclaration" | ||||
|       } | ||||
|     ], | ||||
|     "commentStart": 0, | ||||
|     "end": 0, | ||||
|     "moduleId": 0, | ||||
|     "start": 0 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										2
									
								
								rust/kcl-lib/tests/rect_helper/input.kcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,2 @@ | ||||
| x = startSketchOn(XY) | ||||
| |> rectangle(width = 3, height = 2, corner = [-2, -1]) | ||||
							
								
								
									
										128
									
								
								rust/kcl-lib/tests/rect_helper/ops.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,128 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Operations executed rect_helper.kcl | ||||
| --- | ||||
| { | ||||
|   "rust/kcl-lib/tests/rect_helper/input.kcl": [ | ||||
|     { | ||||
|       "type": "StdLibCall", | ||||
|       "name": "startSketchOn", | ||||
|       "unlabeledArg": { | ||||
|         "value": { | ||||
|           "type": "Plane", | ||||
|           "artifact_id": "[uuid]" | ||||
|         }, | ||||
|         "sourceRange": [] | ||||
|       }, | ||||
|       "labeledArgs": {}, | ||||
|       "nodePath": { | ||||
|         "steps": [ | ||||
|           { | ||||
|             "type": "ProgramBodyItem", | ||||
|             "index": 0 | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationDeclaration" | ||||
|           }, | ||||
|           { | ||||
|             "type": "VariableDeclarationInit" | ||||
|           }, | ||||
|           { | ||||
|             "type": "PipeBodyItem", | ||||
|             "index": 0 | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::appearance": [], | ||||
|   "std::array": [], | ||||
|   "std::math": [ | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "PI", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 3.141592653589793, | ||||
|         "ty": { | ||||
|           "type": "Unknown" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "E", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 2.718281828459045, | ||||
|         "ty": { | ||||
|           "type": "Known", | ||||
|           "type": "Count" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "TAU", | ||||
|       "value": { | ||||
|         "type": "Number", | ||||
|         "value": 6.283185307179586, | ||||
|         "ty": { | ||||
|           "type": "Known", | ||||
|           "type": "Count" | ||||
|         } | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::prelude": [ | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "START", | ||||
|       "value": { | ||||
|         "type": "String", | ||||
|         "value": "start" | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     }, | ||||
|     { | ||||
|       "type": "VariableDeclaration", | ||||
|       "name": "END", | ||||
|       "value": { | ||||
|         "type": "String", | ||||
|         "value": "end" | ||||
|       }, | ||||
|       "visibility": "export", | ||||
|       "nodePath": { | ||||
|         "steps": [] | ||||
|       }, | ||||
|       "sourceRange": [] | ||||
|     } | ||||
|   ], | ||||
|   "std::sketch": [], | ||||
|   "std::solid": [], | ||||
|   "std::sweep": [], | ||||
|   "std::transform": [], | ||||
|   "std::turns": [], | ||||
|   "std::types": [], | ||||
|   "std::units": [] | ||||
| } | ||||
							
								
								
									
										144
									
								
								rust/kcl-lib/tests/rect_helper/program_memory.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,144 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Variables in memory after executing rect_helper.kcl | ||||
| --- | ||||
| { | ||||
|   "x": { | ||||
|     "type": "Sketch", | ||||
|     "value": { | ||||
|       "type": "Sketch", | ||||
|       "id": "[uuid]", | ||||
|       "paths": [ | ||||
|         { | ||||
|           "__geoMeta": { | ||||
|             "id": "[uuid]", | ||||
|             "sourceRange": [] | ||||
|           }, | ||||
|           "from": [ | ||||
|             -2.0, | ||||
|             -1.0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "to": [ | ||||
|             1.0, | ||||
|             -1.0 | ||||
|           ], | ||||
|           "type": "ToPoint", | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           } | ||||
|         }, | ||||
|         { | ||||
|           "__geoMeta": { | ||||
|             "id": "[uuid]", | ||||
|             "sourceRange": [] | ||||
|           }, | ||||
|           "from": [ | ||||
|             1.0, | ||||
|             -1.0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "to": [ | ||||
|             1.0, | ||||
|             1.0 | ||||
|           ], | ||||
|           "type": "ToPoint", | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           } | ||||
|         }, | ||||
|         { | ||||
|           "__geoMeta": { | ||||
|             "id": "[uuid]", | ||||
|             "sourceRange": [] | ||||
|           }, | ||||
|           "from": [ | ||||
|             1.0, | ||||
|             1.0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "to": [ | ||||
|             -2.0, | ||||
|             1.0 | ||||
|           ], | ||||
|           "type": "ToPoint", | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           } | ||||
|         }, | ||||
|         { | ||||
|           "__geoMeta": { | ||||
|             "id": "[uuid]", | ||||
|             "sourceRange": [] | ||||
|           }, | ||||
|           "from": [ | ||||
|             -2.0, | ||||
|             1.0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "to": [ | ||||
|             -2.0, | ||||
|             -1.0 | ||||
|           ], | ||||
|           "type": "ToPoint", | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           } | ||||
|         } | ||||
|       ], | ||||
|       "on": { | ||||
|         "artifactId": "[uuid]", | ||||
|         "id": "[uuid]", | ||||
|         "origin": { | ||||
|           "x": 0.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0, | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           } | ||||
|         }, | ||||
|         "type": "plane", | ||||
|         "value": "XY", | ||||
|         "xAxis": { | ||||
|           "x": 1.0, | ||||
|           "y": 0.0, | ||||
|           "z": 0.0, | ||||
|           "units": { | ||||
|             "type": "Unknown" | ||||
|           } | ||||
|         }, | ||||
|         "yAxis": { | ||||
|           "x": 0.0, | ||||
|           "y": 1.0, | ||||
|           "z": 0.0, | ||||
|           "units": { | ||||
|             "type": "Unknown" | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|       "start": { | ||||
|         "from": [ | ||||
|           -2.0, | ||||
|           -1.0 | ||||
|         ], | ||||
|         "to": [ | ||||
|           -2.0, | ||||
|           -1.0 | ||||
|         ], | ||||
|         "units": { | ||||
|           "type": "Mm" | ||||
|         }, | ||||
|         "tag": null, | ||||
|         "__geoMeta": { | ||||
|           "id": "[uuid]", | ||||
|           "sourceRange": [] | ||||
|         } | ||||
|       }, | ||||
|       "artifactId": "[uuid]", | ||||
|       "originalId": "[uuid]", | ||||
|       "units": { | ||||
|         "type": "Mm" | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								rust/kcl-lib/tests/rect_helper/rendered_model.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 26 KiB | 
							
								
								
									
										6
									
								
								rust/kcl-lib/tests/rect_helper/unparsed.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,6 @@ | ||||
| --- | ||||
| source: kcl-lib/src/simulation_tests.rs | ||||
| description: Result of unparsing rect_helper.kcl | ||||
| --- | ||||
| x = startSketchOn(XY) | ||||
|   |> rectangle(width = 3, height = 2, corner = [-2, -1]) | ||||
| Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |