Change trig functions to return number with Default units (#7425)
* Change trig functions to return number with Default units * Update docs * Update output
This commit is contained in:
@ -0,0 +1,133 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Artifact commands coerce_from_trig_to_point.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": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"size": 60.0,
|
||||
"clobber": false,
|
||||
"hide": 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": -1.0,
|
||||
"z": 0.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "extend_path",
|
||||
"path": "[uuid]",
|
||||
"segment": {
|
||||
"type": "arc",
|
||||
"center": {
|
||||
"x": 0.918,
|
||||
"y": 0.397
|
||||
},
|
||||
"radius": 1.0,
|
||||
"start": {
|
||||
"unit": "degrees",
|
||||
"value": 0.0
|
||||
},
|
||||
"end": {
|
||||
"unit": "degrees",
|
||||
"value": 360.0
|
||||
},
|
||||
"relative": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "move_path_pen",
|
||||
"path": "[uuid]",
|
||||
"to": {
|
||||
"x": 1.918,
|
||||
"y": 0.397,
|
||||
"z": 0.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "sketch_mode_disable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "start_path"
|
||||
}
|
||||
}
|
||||
]
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Artifact graph flowchart error_with_point_shows_numeric_units.kcl
|
||||
description: Artifact graph flowchart coerce_from_trig_to_point.kcl
|
||||
extension: md
|
||||
snapshot_kind: binary
|
||||
---
|
@ -0,0 +1,15 @@
|
||||
```mermaid
|
||||
flowchart LR
|
||||
subgraph path2 [Path]
|
||||
2["Path<br>[23, 92, 0]"]
|
||||
%% [ProgramBodyItem { index: 0 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }]
|
||||
3["Segment<br>[23, 92, 0]"]
|
||||
%% [ProgramBodyItem { index: 0 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }]
|
||||
4[Solid2d]
|
||||
end
|
||||
1["Plane<br>[0, 17, 0]"]
|
||||
%% [ProgramBodyItem { index: 0 }, ExpressionStatementExpr, PipeBodyItem { index: 0 }]
|
||||
1 --- 2
|
||||
2 --- 3
|
||||
2 --- 4
|
||||
```
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Variables in memory after executing coerce_from_trig_to_point.kcl
|
||||
---
|
||||
{}
|
BIN
rust/kcl-lib/tests/coerce_from_trig_to_point/rendered_model.png
Normal file
BIN
rust/kcl-lib/tests/coerce_from_trig_to_point/rendered_model.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
@ -134,8 +134,13 @@ description: Variables in memory after executing computed_var.kcl
|
||||
"type": "Number",
|
||||
"value": 1.0,
|
||||
"ty": {
|
||||
"type": "Known",
|
||||
"type": "Count"
|
||||
"type": "Default",
|
||||
"len": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"angle": {
|
||||
"type": "Degrees"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Artifact commands error_with_point_shows_numeric_units.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": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"size": 60.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
}
|
||||
]
|
@ -1,5 +0,0 @@
|
||||
```mermaid
|
||||
flowchart LR
|
||||
1["Plane<br>[0, 17, 0]"]
|
||||
%% [ProgramBodyItem { index: 0 }, ExpressionStatementExpr, PipeBodyItem { index: 0 }]
|
||||
```
|
@ -1,29 +0,0 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Error from executing error_with_point_shows_numeric_units.kcl
|
||||
---
|
||||
KCL Semantic error
|
||||
|
||||
× semantic: center requires a value with type `Point2d`, but found array of
|
||||
│ number(Count), number(Count) with 2 values
|
||||
╭─[2:6]
|
||||
1 │ startSketchOn(XZ)
|
||||
2 │ ╭──▶ |> circle(center = [
|
||||
3 │ ││ sin(66.6deg),
|
||||
4 │ ││ cos(66.6deg)
|
||||
5 │ ├──▶ ], radius = 1)
|
||||
· ╰───── tests/error_with_point_shows_numeric_units/input.kcl
|
||||
· ╰───── tests/error_with_point_shows_numeric_units/input.kcl
|
||||
╰────
|
||||
╰─▶ KCL Semantic error
|
||||
|
||||
× semantic: center requires a value with type `Point2d`, but found
|
||||
│ array of number(Count), number(Count) with 2 values
|
||||
╭─[2:22]
|
||||
1 │ startSketchOn(XZ)
|
||||
2 │ ╭─▶ |> circle(center = [
|
||||
3 │ │ sin(66.6deg),
|
||||
4 │ │ cos(66.6deg)
|
||||
5 │ ├─▶ ], radius = 1)
|
||||
· ╰──── tests/error_with_point_shows_numeric_units/input.kcl
|
||||
╰────
|
@ -173,8 +173,13 @@ description: Variables in memory after executing keyboard.kcl
|
||||
"type": "Number",
|
||||
"value": 0.122,
|
||||
"ty": {
|
||||
"type": "Known",
|
||||
"type": "Count"
|
||||
"type": "Default",
|
||||
"len": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"angle": {
|
||||
"type": "Degrees"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -349,8 +354,13 @@ description: Variables in memory after executing keyboard.kcl
|
||||
"type": "Number",
|
||||
"value": 0.122,
|
||||
"ty": {
|
||||
"type": "Known",
|
||||
"type": "Count"
|
||||
"type": "Default",
|
||||
"len": {
|
||||
"type": "Inches"
|
||||
},
|
||||
"angle": {
|
||||
"type": "Degrees"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
Reference in New Issue
Block a user