fix unwrap (#6825)
* fix unwrap Signed-off-by: Jess Frazelle <github@jessfraz.com> * add test Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * udaptes Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -2729,3 +2729,24 @@ mod involute_circular_units {
|
||||
super::execute(TEST_NAME, true).await
|
||||
}
|
||||
}
|
||||
mod panic_repro_cube {
|
||||
const TEST_NAME: &str = "panic_repro_cube";
|
||||
|
||||
/// Test parsing KCL.
|
||||
#[test]
|
||||
fn parse() {
|
||||
super::parse(TEST_NAME)
|
||||
}
|
||||
|
||||
/// Test that parsing and unparsing KCL produces the original KCL input.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn unparse() {
|
||||
super::unparse(TEST_NAME).await
|
||||
}
|
||||
|
||||
/// Test that KCL is executed correctly.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn kcl_test_execute() {
|
||||
super::execute(TEST_NAME, true).await
|
||||
}
|
||||
}
|
||||
|
@ -407,8 +407,15 @@ impl Args {
|
||||
})
|
||||
})?;
|
||||
|
||||
// TODO unnecessary cloning
|
||||
Ok(T::from_kcl_val(&arg).unwrap())
|
||||
T::from_kcl_val(&arg).ok_or_else(|| {
|
||||
KclError::Semantic(KclErrorDetails {
|
||||
source_ranges: vec![self.source_range],
|
||||
message: format!(
|
||||
"This function expected the input argument to be {}",
|
||||
ty.human_friendly_type(),
|
||||
),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Add a modeling command to the batch but don't fire it right away.
|
||||
|
445
rust/kcl-lib/tests/panic_repro_cube/artifact_commands.snap
Normal file
445
rust/kcl-lib/tests/panic_repro_cube/artifact_commands.snap
Normal file
@ -0,0 +1,445 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Artifact commands panic_repro_cube.kcl
|
||||
---
|
||||
[
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "edge_lines_visible",
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "object_visible",
|
||||
"object_id": "[uuid]",
|
||||
"hidden": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "object_visible",
|
||||
"object_id": "[uuid]",
|
||||
"hidden": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"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": "move_path_pen",
|
||||
"path": "[uuid]",
|
||||
"to": {
|
||||
"x": -10.0,
|
||||
"y": -10.0,
|
||||
"z": 0.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "sketch_mode_disable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "start_path"
|
||||
}
|
||||
},
|
||||
{
|
||||
"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": 0.0,
|
||||
"y": 20.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": 0.0,
|
||||
"y": -20.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": 20.0,
|
||||
"faces": null,
|
||||
"opposite": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "object_bring_to_front",
|
||||
"object_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "sketch_mode_disable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_all_edge_faces",
|
||||
"object_id": "[uuid]",
|
||||
"edge_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_next_adjacent_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_next_adjacent_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_next_adjacent_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_next_adjacent_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_opposite_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_opposite_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_opposite_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_opposite_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_next_adjacent_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_next_adjacent_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_get_next_adjacent_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]",
|
||||
"face_id": "[uuid]"
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Artifact graph flowchart panic_repro_cube.kcl
|
||||
extension: md
|
||||
snapshot_kind: binary
|
||||
---
|
@ -0,0 +1,78 @@
|
||||
```mermaid
|
||||
flowchart LR
|
||||
subgraph path2 [Path]
|
||||
2["Path<br>[565, 614, 0]"]
|
||||
3["Segment<br>[620, 644, 0]"]
|
||||
4["Segment<br>[650, 688, 0]"]
|
||||
5["Segment<br>[694, 719, 0]"]
|
||||
6["Segment<br>[725, 764, 0]"]
|
||||
7["Segment<br>[770, 777, 0]"]
|
||||
8[Solid2d]
|
||||
end
|
||||
1["Plane<br>[542, 559, 0]"]
|
||||
9["Sweep Extrusion<br>[806, 924, 0]"]
|
||||
10[Wall]
|
||||
11[Wall]
|
||||
12[Wall]
|
||||
13[Wall]
|
||||
14["Cap Start"]
|
||||
15["Cap End"]
|
||||
16["SweepEdge Opposite"]
|
||||
17["SweepEdge Opposite"]
|
||||
18["SweepEdge Opposite"]
|
||||
19["SweepEdge Opposite"]
|
||||
20["SweepEdge Adjacent"]
|
||||
21["SweepEdge Adjacent"]
|
||||
22["SweepEdge Adjacent"]
|
||||
23["SweepEdge Adjacent"]
|
||||
1 --- 2
|
||||
2 --- 3
|
||||
2 --- 4
|
||||
2 --- 5
|
||||
2 --- 6
|
||||
2 --- 7
|
||||
2 --- 8
|
||||
2 ---- 9
|
||||
3 --- 13
|
||||
3 x--> 14
|
||||
3 --- 16
|
||||
3 --- 23
|
||||
4 --- 11
|
||||
4 x--> 14
|
||||
4 --- 19
|
||||
4 --- 22
|
||||
5 --- 10
|
||||
5 x--> 14
|
||||
5 --- 18
|
||||
5 --- 21
|
||||
6 --- 12
|
||||
6 x--> 14
|
||||
6 --- 17
|
||||
6 --- 20
|
||||
9 --- 10
|
||||
9 --- 11
|
||||
9 --- 12
|
||||
9 --- 13
|
||||
9 --- 14
|
||||
9 --- 15
|
||||
9 --- 16
|
||||
9 --- 17
|
||||
9 --- 18
|
||||
9 --- 19
|
||||
9 --- 20
|
||||
9 --- 21
|
||||
9 --- 22
|
||||
9 --- 23
|
||||
18 <--x 10
|
||||
21 <--x 10
|
||||
19 <--x 11
|
||||
23 <--x 11
|
||||
17 <--x 12
|
||||
21 <--x 12
|
||||
16 <--x 13
|
||||
23 <--x 13
|
||||
16 <--x 15
|
||||
17 <--x 15
|
||||
18 <--x 15
|
||||
19 <--x 15
|
||||
```
|
1665
rust/kcl-lib/tests/panic_repro_cube/ast.snap
Normal file
1665
rust/kcl-lib/tests/panic_repro_cube/ast.snap
Normal file
File diff suppressed because it is too large
Load Diff
14
rust/kcl-lib/tests/panic_repro_cube/execution_error.snap
Normal file
14
rust/kcl-lib/tests/panic_repro_cube/execution_error.snap
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Error from executing panic_repro_cube.kcl
|
||||
---
|
||||
KCL Semantic error
|
||||
|
||||
× semantic: This function expected the input argument to be Edge
|
||||
╭─[43:5]
|
||||
42 │ // these double wrapped functions are the point of this test
|
||||
43 │ getNextAdjacentEdge(getNextAdjacentEdge(seg01)),
|
||||
· ───────────────────────┬───────────────────────
|
||||
· ╰── tests/panic_repro_cube/input.kcl
|
||||
44 │ getNextAdjacentEdge(getNextAdjacentEdge(seg02))
|
||||
╰────
|
56
rust/kcl-lib/tests/panic_repro_cube/input.kcl
Normal file
56
rust/kcl-lib/tests/panic_repro_cube/input.kcl
Normal file
@ -0,0 +1,56 @@
|
||||
/* Generated by Text-to-CAD:
|
||||
Create a cube with sides of length 20mm. On the top face, add a cylindrical boss of radius 6mm and height 2mm. Then, shell the body to 2mm thickness, leaving the top face of the cylindrical boss open. */
|
||||
@settings(defaultLengthUnit = mm)
|
||||
|
||||
// Define the dimensions of the cube
|
||||
cubeSide = 20
|
||||
|
||||
// Define the dimensions of the cylindrical boss
|
||||
bossRadius = 6
|
||||
bossHeight = 2
|
||||
|
||||
// Define the shell thickness
|
||||
shellThickness = 2
|
||||
|
||||
// Define the fillet radius
|
||||
filletRadius = 2
|
||||
|
||||
// Create a sketch for the cube
|
||||
cubeSketch = startSketchOn(XY)
|
||||
|> startProfile(at = [-cubeSide / 2, -cubeSide / 2])
|
||||
|> xLine(length = cubeSide)
|
||||
|> yLine(length = cubeSide, tag = $seg01)
|
||||
|> xLine(length = -cubeSide)
|
||||
|> yLine(length = -cubeSide, tag = $seg02)
|
||||
|> close()
|
||||
|
||||
// Extrude the cube
|
||||
cube = extrude(
|
||||
cubeSketch,
|
||||
length = cubeSide,
|
||||
tagEnd = $topFace,
|
||||
tagStart = $capStart001,
|
||||
)
|
||||
|
||||
// Apply fillets to all edges of the cube
|
||||
filletedCube = fillet(
|
||||
cube,
|
||||
radius = filletRadius,
|
||||
tags = [
|
||||
getNextAdjacentEdge(seg01),
|
||||
getNextAdjacentEdge(seg02),
|
||||
// these double wrapped functions are the point of this test
|
||||
getNextAdjacentEdge(getNextAdjacentEdge(seg01)),
|
||||
getNextAdjacentEdge(getNextAdjacentEdge(seg02))
|
||||
]
|
||||
)
|
||||
|
||||
// Create a sketch for the cylindrical boss on the top face of the cube
|
||||
bossSketch = startSketchOn(filletedCube, face = topFace)
|
||||
|> circle(center = [0, 0], radius = bossRadius)
|
||||
|
||||
// Extrude the cylindrical boss
|
||||
boss = extrude(bossSketch, length = bossHeight, tagEnd = $bossTopFace)
|
||||
|
||||
// Shell the cube, leaving the top face of the cylindrical boss open
|
||||
shell([filletedCube, boss], thickness = shellThickness, faces = [bossTopFace])
|
65
rust/kcl-lib/tests/panic_repro_cube/ops.snap
Normal file
65
rust/kcl-lib/tests/panic_repro_cube/ops.snap
Normal file
@ -0,0 +1,65 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Operations executed panic_repro_cube.kcl
|
||||
---
|
||||
[
|
||||
{
|
||||
"labeledArgs": {},
|
||||
"name": "startSketchOn",
|
||||
"sourceRange": [],
|
||||
"type": "StdLibCall",
|
||||
"unlabeledArg": {
|
||||
"value": {
|
||||
"type": "Plane",
|
||||
"artifact_id": "[uuid]"
|
||||
},
|
||||
"sourceRange": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"labeledArgs": {
|
||||
"length": {
|
||||
"value": {
|
||||
"type": "Number",
|
||||
"value": 20.0,
|
||||
"ty": {
|
||||
"type": "Default",
|
||||
"len": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"angle": {
|
||||
"type": "Degrees"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
"tagEnd": {
|
||||
"value": {
|
||||
"type": "TagDeclarator",
|
||||
"name": "topFace"
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
"tagStart": {
|
||||
"value": {
|
||||
"type": "TagDeclarator",
|
||||
"name": "capStart001"
|
||||
},
|
||||
"sourceRange": []
|
||||
}
|
||||
},
|
||||
"name": "extrude",
|
||||
"sourceRange": [],
|
||||
"type": "StdLibCall",
|
||||
"unlabeledArg": {
|
||||
"value": {
|
||||
"type": "Sketch",
|
||||
"value": {
|
||||
"artifactId": "[uuid]"
|
||||
}
|
||||
},
|
||||
"sourceRange": []
|
||||
}
|
||||
}
|
||||
]
|
60
rust/kcl-lib/tests/panic_repro_cube/unparsed.snap
Normal file
60
rust/kcl-lib/tests/panic_repro_cube/unparsed.snap
Normal file
@ -0,0 +1,60 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Result of unparsing panic_repro_cube.kcl
|
||||
---
|
||||
/* Generated by Text-to-CAD:
|
||||
Create a cube with sides of length 20mm. On the top face, add a cylindrical boss of radius 6mm and height 2mm. Then, shell the body to 2mm thickness, leaving the top face of the cylindrical boss open. */
|
||||
@settings(defaultLengthUnit = mm)
|
||||
|
||||
// Define the dimensions of the cube
|
||||
cubeSide = 20
|
||||
|
||||
// Define the dimensions of the cylindrical boss
|
||||
bossRadius = 6
|
||||
bossHeight = 2
|
||||
|
||||
// Define the shell thickness
|
||||
shellThickness = 2
|
||||
|
||||
// Define the fillet radius
|
||||
filletRadius = 2
|
||||
|
||||
// Create a sketch for the cube
|
||||
cubeSketch = startSketchOn(XY)
|
||||
|> startProfile(at = [-cubeSide / 2, -cubeSide / 2])
|
||||
|> xLine(length = cubeSide)
|
||||
|> yLine(length = cubeSide, tag = $seg01)
|
||||
|> xLine(length = -cubeSide)
|
||||
|> yLine(length = -cubeSide, tag = $seg02)
|
||||
|> close()
|
||||
|
||||
// Extrude the cube
|
||||
cube = extrude(
|
||||
cubeSketch,
|
||||
length = cubeSide,
|
||||
tagEnd = $topFace,
|
||||
tagStart = $capStart001,
|
||||
)
|
||||
|
||||
// Apply fillets to all edges of the cube
|
||||
filletedCube = fillet(
|
||||
cube,
|
||||
radius = filletRadius,
|
||||
tags = [
|
||||
getNextAdjacentEdge(seg01),
|
||||
getNextAdjacentEdge(seg02),
|
||||
// these double wrapped functions are the point of this test
|
||||
getNextAdjacentEdge(getNextAdjacentEdge(seg01)),
|
||||
getNextAdjacentEdge(getNextAdjacentEdge(seg02))
|
||||
],
|
||||
)
|
||||
|
||||
// Create a sketch for the cylindrical boss on the top face of the cube
|
||||
bossSketch = startSketchOn(filletedCube, face = topFace)
|
||||
|> circle(center = [0, 0], radius = bossRadius)
|
||||
|
||||
// Extrude the cylindrical boss
|
||||
boss = extrude(bossSketch, length = bossHeight, tagEnd = $bossTopFace)
|
||||
|
||||
// Shell the cube, leaving the top face of the cylindrical boss open
|
||||
shell([filletedCube, boss], thickness = shellThickness, faces = [bossTopFace])
|
Reference in New Issue
Block a user