diff --git a/rust/kcl-lib/src/simulation_tests.rs b/rust/kcl-lib/src/simulation_tests.rs index 440de3139..38fafec14 100644 --- a/rust/kcl-lib/src/simulation_tests.rs +++ b/rust/kcl-lib/src/simulation_tests.rs @@ -2748,7 +2748,6 @@ mod import_mesh_clone { /// Test that KCL is executed correctly. #[tokio::test(flavor = "multi_thread")] - #[ignore = "turn on when katie fixes the mesh import"] async fn kcl_test_execute() { super::execute(TEST_NAME, true).await } diff --git a/rust/kcl-lib/tests/import_mesh_clone/artifact_commands.snap b/rust/kcl-lib/tests/import_mesh_clone/artifact_commands.snap index d9f68b0cb..010fe11a1 100644 --- a/rust/kcl-lib/tests/import_mesh_clone/artifact_commands.snap +++ b/rust/kcl-lib/tests/import_mesh_clone/artifact_commands.snap @@ -996,10 +996,51 @@ description: Artifact commands import_mesh_clone.kcl "direction": "positive" } }, - "units": "mm" + "units": "m" } } }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "set_object_transform", + "object_id": "[uuid]", + "transforms": [ + { + "translate": { + "property": { + "x": -2000.0, + "y": -2000.0, + "z": 0.0 + }, + "set": false, + "is_local": true + }, + "rotate_rpy": null, + "rotate_angle_axis": null, + "scale": null + } + ] + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_set_material_params_pbr", + "object_id": "[uuid]", + "color": { + "r": 1.0, + "g": 1.0, + "b": 0.0, + "a": 100.0 + }, + "metalness": 0.0, + "roughness": 0.0, + "ambient_occlusion": 0.0 + } + }, { "cmdId": "[uuid]", "range": [], @@ -1008,6 +1049,22 @@ description: Artifact commands import_mesh_clone.kcl "entity_id": "[uuid]" } }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_get_all_child_uuids", + "entity_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_get_all_child_uuids", + "entity_id": "[uuid]" + } + }, { "cmdId": "[uuid]", "range": [], @@ -1018,7 +1075,7 @@ description: Artifact commands import_mesh_clone.kcl { "translate": { "property": { - "x": 1020.0, + "x": 4000.0, "y": 0.0, "z": 0.0 }, @@ -1044,8 +1101,138 @@ description: Artifact commands import_mesh_clone.kcl "b": 0.0, "a": 100.0 }, - "metalness": 0.5, - "roughness": 0.5, + "metalness": 0.0, + "roughness": 0.0, + "ambient_occlusion": 0.0 + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_clone", + "entity_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_get_all_child_uuids", + "entity_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_get_all_child_uuids", + "entity_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "set_object_transform", + "object_id": "[uuid]", + "transforms": [ + { + "translate": { + "property": { + "x": 0.0, + "y": 4000.0, + "z": 0.0 + }, + "set": false, + "is_local": true + }, + "rotate_rpy": null, + "rotate_angle_axis": null, + "scale": null + } + ] + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_set_material_params_pbr", + "object_id": "[uuid]", + "color": { + "r": 0.0, + "g": 1.0, + "b": 0.0, + "a": 100.0 + }, + "metalness": 0.0, + "roughness": 0.0, + "ambient_occlusion": 0.0 + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_clone", + "entity_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_get_all_child_uuids", + "entity_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_get_all_child_uuids", + "entity_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "set_object_transform", + "object_id": "[uuid]", + "transforms": [ + { + "translate": { + "property": { + "x": 0.0, + "y": 4000.0, + "z": 0.0 + }, + "set": false, + "is_local": true + }, + "rotate_rpy": null, + "rotate_angle_axis": null, + "scale": null + } + ] + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_set_material_params_pbr", + "object_id": "[uuid]", + "color": { + "r": 0.0, + "g": 0.0, + "b": 1.0, + "a": 100.0 + }, + "metalness": 0.0, + "roughness": 0.0, "ambient_occlusion": 0.0 } } diff --git a/rust/kcl-lib/tests/import_mesh_clone/ast.snap b/rust/kcl-lib/tests/import_mesh_clone/ast.snap index 9fe25bb38..f3b8c8dc7 100644 --- a/rust/kcl-lib/tests/import_mesh_clone/ast.snap +++ b/rust/kcl-lib/tests/import_mesh_clone/ast.snap @@ -8,6 +8,46 @@ description: Result of parsing import_mesh_clone.kcl { "commentStart": 0, "end": 0, + "outerAttrs": [ + { + "commentStart": 0, + "end": 0, + "name": null, + "properties": [ + { + "commentStart": 0, + "end": 0, + "key": { + "commentStart": 0, + "end": 0, + "name": "lengthUnit", + "start": 0, + "type": "Identifier" + }, + "start": 0, + "type": "ObjectProperty", + "value": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "m", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + } + ], + "start": 0, + "type": "Annotation" + } + ], "path": { "type": "Foreign", "path": "../inputs/cube.obj" @@ -17,7 +57,7 @@ description: Result of parsing import_mesh_clone.kcl "alias": { "commentStart": 0, "end": 0, - "name": "cube", + "name": "yellow", "start": 0, "type": "Identifier" } @@ -28,24 +68,180 @@ description: Result of parsing import_mesh_clone.kcl }, { "commentStart": 0, - "declaration": { + "end": 0, + "expression": { + "body": [ + { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "yellow", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "x", + "start": 0, + "type": "Identifier" + }, + "arg": { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "2000", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2000.0, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "y", + "start": 0, + "type": "Identifier" + }, + "arg": { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "2000", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2000.0, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "translate", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeSubstitution", + "type": "PipeSubstitution" + } + } + ], "commentStart": 0, "end": 0, - "id": { - "commentStart": 0, - "end": 0, - "name": "model", - "start": 0, - "type": "Identifier" - }, - "init": { + "start": 0, + "type": "PipeExpression", + "type": "PipeExpression" + }, + "start": 0, + "type": "ExpressionStatement", + "type": "ExpressionStatement" + }, + { + "commentStart": 0, + "end": 0, + "expression": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "color", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "\"#ffff00\"", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": "#ffff00" + } + } + ], + "callee": { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, - "name": "cube", + "name": "appearance", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "yellow", "start": 0, "type": "Identifier" }, @@ -53,15 +249,11 @@ description: Result of parsing import_mesh_clone.kcl "start": 0, "type": "Name", "type": "Name" - }, - "start": 0, - "type": "VariableDeclarator" + } }, - "end": 0, - "kind": "const", "start": 0, - "type": "VariableDeclaration", - "type": "VariableDeclaration" + "type": "ExpressionStatement", + "type": "ExpressionStatement" }, { "commentStart": 0, @@ -71,7 +263,7 @@ description: Result of parsing import_mesh_clone.kcl "id": { "commentStart": 0, "end": 0, - "name": "model2", + "name": "red", "start": 0, "type": "Identifier" }, @@ -105,7 +297,7 @@ description: Result of parsing import_mesh_clone.kcl "name": { "commentStart": 0, "end": 0, - "name": "model", + "name": "yellow", "start": 0, "type": "Identifier" }, @@ -129,12 +321,12 @@ description: Result of parsing import_mesh_clone.kcl "arg": { "commentStart": 0, "end": 0, - "raw": "1020", + "raw": "4000", "start": 0, "type": "Literal", "type": "Literal", "value": { - "value": 1020.0, + "value": 4000.0, "suffix": "None" } } @@ -160,95 +352,13 @@ description: Result of parsing import_mesh_clone.kcl "start": 0, "type": "CallExpressionKw", "type": "CallExpressionKw", - "unlabeled": null - }, - { - "arguments": [ - { - "type": "LabeledArg", - "label": { - "commentStart": 0, - "end": 0, - "name": "color", - "start": 0, - "type": "Identifier" - }, - "arg": { - "commentStart": 0, - "end": 0, - "raw": "\"#ff0000\"", - "start": 0, - "type": "Literal", - "type": "Literal", - "value": "#ff0000" - } - }, - { - "type": "LabeledArg", - "label": { - "commentStart": 0, - "end": 0, - "name": "metalness", - "start": 0, - "type": "Identifier" - }, - "arg": { - "commentStart": 0, - "end": 0, - "raw": "50", - "start": 0, - "type": "Literal", - "type": "Literal", - "value": { - "value": 50.0, - "suffix": "None" - } - } - }, - { - "type": "LabeledArg", - "label": { - "commentStart": 0, - "end": 0, - "name": "roughness", - "start": 0, - "type": "Identifier" - }, - "arg": { - "commentStart": 0, - "end": 0, - "raw": "50", - "start": 0, - "type": "Literal", - "type": "Literal", - "value": { - "value": 50.0, - "suffix": "None" - } - } - } - ], - "callee": { - "abs_path": false, + "unlabeled": { "commentStart": 0, "end": 0, - "name": { - "commentStart": 0, - "end": 0, - "name": "appearance", - "start": 0, - "type": "Identifier" - }, - "path": [], "start": 0, - "type": "Name" - }, - "commentStart": 0, - "end": 0, - "start": 0, - "type": "CallExpressionKw", - "type": "CallExpressionKw", - "unlabeled": null + "type": "PipeSubstitution", + "type": "PipeSubstitution" + } } ], "commentStart": 0, @@ -265,6 +375,446 @@ description: Result of parsing import_mesh_clone.kcl "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "end": 0, + "expression": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "color", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "\"#ff0000\"", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": "#ff0000" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "appearance", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "red", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "start": 0, + "type": "ExpressionStatement", + "type": "ExpressionStatement" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "green", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": [ + { + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "clone", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "yellow", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "y", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "4000", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 4000.0, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "translate", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeSubstitution", + "type": "PipeSubstitution" + } + } + ], + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeExpression", + "type": "PipeExpression" + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "end": 0, + "expression": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "color", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "\"#00ff00\"", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": "#00ff00" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "appearance", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "green", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "start": 0, + "type": "ExpressionStatement", + "type": "ExpressionStatement" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "blue", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": [ + { + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "clone", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "red", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "y", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "4000", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 4000.0, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "translate", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeSubstitution", + "type": "PipeSubstitution" + } + } + ], + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeExpression", + "type": "PipeExpression" + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "end": 0, + "expression": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "color", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "\"#0000ff\"", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": "#0000ff" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "appearance", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "blue", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "start": 0, + "type": "ExpressionStatement", + "type": "ExpressionStatement" } ], "commentStart": 0, @@ -282,7 +832,29 @@ description: Result of parsing import_mesh_clone.kcl } } ], - "1": [ + "2": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "4": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "6": [ { "commentStart": 0, "end": 0, diff --git a/rust/kcl-lib/tests/import_mesh_clone/execution_error.snap b/rust/kcl-lib/tests/import_mesh_clone/execution_error.snap deleted file mode 100644 index a711be032..000000000 --- a/rust/kcl-lib/tests/import_mesh_clone/execution_error.snap +++ /dev/null @@ -1,10 +0,0 @@ ---- -source: kcl-lib/src/simulation_tests.rs -description: Error from executing import_mesh_clone.kcl ---- -KCL Engine error - - × engine: Modeling command failed: websocket closed early - ╭──── - 13 │ ) - ╰──── diff --git a/rust/kcl-lib/tests/import_mesh_clone/input.kcl b/rust/kcl-lib/tests/import_mesh_clone/input.kcl index 4643458ca..ee6895f41 100644 --- a/rust/kcl-lib/tests/import_mesh_clone/input.kcl +++ b/rust/kcl-lib/tests/import_mesh_clone/input.kcl @@ -1,13 +1,18 @@ -import "../inputs/cube.obj" as cube +@(lengthUnit = m) +import "../inputs/cube.obj" as yellow -model = cube +yellow + |> translate(%, x = -2000, y = -2000) +appearance(yellow, color = "#ffff00") -model2 = clone(model) - |> translate( - x = 1020, - ) - |> appearance( - color = "#ff0000", - metalness = 50, - roughness = 50 - ) +red = clone(yellow) + |> translate(%, x = 4000) +appearance(red, color = "#ff0000") + +green = clone(yellow) + |> translate(%, y = 4000) +appearance(green, color = "#00ff00") + +blue = clone(red) + |> translate(%, y = 4000) +appearance(blue, color = "#0000ff") diff --git a/rust/kcl-lib/tests/import_mesh_clone/ops.snap b/rust/kcl-lib/tests/import_mesh_clone/ops.snap index 35463302d..2fb6173c9 100644 --- a/rust/kcl-lib/tests/import_mesh_clone/ops.snap +++ b/rust/kcl-lib/tests/import_mesh_clone/ops.snap @@ -25,6 +25,32 @@ description: Operations executed import_mesh_clone.kcl "labeledArgs": {}, "sourceRange": [] }, + { + "type": "KclStdLibCall", + "name": "clone", + "unlabeledArg": { + "value": { + "type": "ImportedGeometry", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + }, + "labeledArgs": {}, + "sourceRange": [] + }, + { + "type": "KclStdLibCall", + "name": "clone", + "unlabeledArg": { + "value": { + "type": "ImportedGeometry", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + }, + "labeledArgs": {}, + "sourceRange": [] + }, { "type": "GroupEnd" } diff --git a/rust/kcl-lib/tests/import_mesh_clone/program_memory.snap b/rust/kcl-lib/tests/import_mesh_clone/program_memory.snap new file mode 100644 index 000000000..8b581fcf6 --- /dev/null +++ b/rust/kcl-lib/tests/import_mesh_clone/program_memory.snap @@ -0,0 +1,31 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Variables in memory after executing import_mesh_clone.kcl +--- +{ + "blue": { + "type": "ImportedGeometry", + "id": "[uuid]", + "value": [ + "cube.obj" + ] + }, + "green": { + "type": "ImportedGeometry", + "id": "[uuid]", + "value": [ + "cube.obj" + ] + }, + "red": { + "type": "ImportedGeometry", + "id": "[uuid]", + "value": [ + "cube.obj" + ] + }, + "yellow": { + "type": "Module", + "value": 1 + } +} diff --git a/rust/kcl-lib/tests/import_mesh_clone/rendered_model.png b/rust/kcl-lib/tests/import_mesh_clone/rendered_model.png new file mode 100644 index 000000000..5ed234f31 Binary files /dev/null and b/rust/kcl-lib/tests/import_mesh_clone/rendered_model.png differ diff --git a/rust/kcl-lib/tests/import_mesh_clone/unparsed.snap b/rust/kcl-lib/tests/import_mesh_clone/unparsed.snap index c1771d1ee..b17476cde 100644 --- a/rust/kcl-lib/tests/import_mesh_clone/unparsed.snap +++ b/rust/kcl-lib/tests/import_mesh_clone/unparsed.snap @@ -2,10 +2,21 @@ source: kcl-lib/src/simulation_tests.rs description: Result of unparsing import_mesh_clone.kcl --- -import "../inputs/cube.obj" as cube +@(lengthUnit = m) +import "../inputs/cube.obj" as yellow -model = cube +yellow + |> translate(%, x = -2000, y = -2000) +appearance(yellow, color = "#ffff00") -model2 = clone(model) - |> translate(x = 1020) - |> appearance(color = "#ff0000", metalness = 50, roughness = 50) +red = clone(yellow) + |> translate(%, x = 4000) +appearance(red, color = "#ff0000") + +green = clone(yellow) + |> translate(%, y = 4000) +appearance(green, color = "#00ff00") + +blue = clone(red) + |> translate(%, y = 4000) +appearance(blue, color = "#0000ff")