Type check and coerce arguments to user functions and return values from std Rust functions (#6958)

* Shuffle around function call code

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Refactor function calls to share more code

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Hack to leave the result of revolve as a singleton rather than array

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-05-19 16:50:15 +12:00
committed by GitHub
parent f3e9d110c0
commit b19acd550d
197 changed files with 13837 additions and 14317 deletions

View File

@ -4,32 +4,43 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
---
[
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "extrude",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"length": {
"value": {
@ -48,18 +59,7 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "GroupBegin",
@ -79,7 +79,7 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "offsetPlane",
"unlabeledArg": {
"value": {
@ -109,6 +109,17 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternCircular3d",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"arcDegrees": {
"value": {
@ -244,21 +255,10 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "patternCircular3d",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "revolve",
"unlabeledArg": {
"value": {
@ -382,7 +382,7 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "offsetPlane",
"unlabeledArg": {
"value": {
@ -412,6 +412,17 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternCircular3d",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"arcDegrees": {
"value": {
@ -547,20 +558,43 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "patternCircular3d",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternLinear3d",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
},
"labeledArgs": {
"axis": {
"value": {
@ -642,13 +676,39 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "patternLinear3d",
"sourceRange": [],
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternLinear3d",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
@ -676,9 +736,7 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
]
},
"sourceRange": []
}
},
{
},
"labeledArgs": {
"axis": {
"value": {
@ -760,37 +818,15 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "patternLinear3d",
"sourceRange": [],
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternLinear3d",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
@ -818,9 +854,7 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
]
},
"sourceRange": []
}
},
{
},
"labeledArgs": {
"axis": {
"value": {
@ -902,13 +936,39 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "patternLinear3d",
"sourceRange": [],
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternLinear3d",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
@ -936,9 +996,7 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
]
},
"sourceRange": []
}
},
{
},
"labeledArgs": {
"axis": {
"value": {
@ -1020,119 +1078,72 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "patternLinear3d",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
}
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "subtract2d",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"tool": {
"value": {
@ -1144,9 +1155,11 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "subtract2d",
"sourceRange": [],
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "subtract2d",
"unlabeledArg": {
"value": {
"type": "Sketch",
@ -1155,9 +1168,7 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
}
},
"sourceRange": []
}
},
{
},
"labeledArgs": {
"tool": {
"value": {
@ -1169,18 +1180,7 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "subtract2d",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "GroupBegin",
@ -1217,17 +1217,17 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "GroupBegin",
@ -1247,6 +1247,17 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "subtract2d",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"tool": {
"value": {
@ -1281,9 +1292,11 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "subtract2d",
"sourceRange": [],
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "extrude",
"unlabeledArg": {
"value": {
"type": "Sketch",
@ -1292,9 +1305,7 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
}
},
"sourceRange": []
}
},
{
},
"labeledArgs": {
"length": {
"value": {
@ -1313,21 +1324,10 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "fillet",
"unlabeledArg": {
"value": {
@ -1400,7 +1400,7 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "offsetPlane",
"unlabeledArg": {
"value": {
@ -1430,6 +1430,17 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "extrude",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"length": {
"value": {
@ -1448,21 +1459,10 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "fillet",
"unlabeledArg": {
"value": {
@ -1518,6 +1518,17 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternLinear3d",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"axis": {
"value": {
@ -1599,20 +1610,31 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "patternLinear3d",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternLinear3d",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
},
"labeledArgs": {
"axis": {
"value": {
@ -1694,31 +1716,20 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "patternLinear3d",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternLinear3d",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"axis": {
"value": {
@ -1800,20 +1811,31 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "patternLinear3d",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternLinear3d",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
},
"labeledArgs": {
"axis": {
"value": {
@ -1895,29 +1917,7 @@ description: Operations executed gridfinity-baseplate-magnets.kcl
"sourceRange": []
}
},
"name": "patternLinear3d",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "GroupEnd"