Fix translate scale & better docs (#6053)

* change translate & scale to be better & docs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* autocomplete

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* gen std

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* kcl-samples

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2025-03-28 14:14:29 -07:00
committed by GitHub
parent 9973e5fde3
commit 358b34de4c
22 changed files with 9311 additions and 2633 deletions

View File

@ -151,54 +151,65 @@ description: Result of parsing import_transform.kcl
"label": {
"commentStart": 159,
"end": 0,
"name": "translate",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 171,
"elements": [
{
"commentStart": 172,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 178,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 184,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
],
"commentStart": 163,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 169,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 173,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 179,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 183,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
}
],
@ -235,65 +246,76 @@ description: Result of parsing import_transform.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 205,
"commentStart": 203,
"end": 0,
"name": "scale",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 213,
"elements": [
{
"commentStart": 214,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 220,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 226,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
],
"commentStart": 207,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 213,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 217,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 223,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 227,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
}
],
"callee": {
"abs_path": false,
"commentStart": 196,
"commentStart": 194,
"end": 0,
"name": {
"commentStart": 196,
"commentStart": 194,
"end": 0,
"name": "scale",
"start": 0,
@ -303,13 +325,13 @@ description: Result of parsing import_transform.kcl
"start": 0,
"type": "Name"
},
"commentStart": 196,
"commentStart": 194,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"commentStart": 202,
"commentStart": 200,
"end": 0,
"start": 0,
"type": "PipeSubstitution",

View File

@ -7,5 +7,5 @@ screw
pitch = 3.14,
yaw = 3.14,
)
|> translate(%, translate = [3.14, 3.14, 3.14])
|> scale(%, scale = [3.14, 3.14, 3.14])
|> translate(%, x = 3.14, y = 3.14, z = 3.14)
|> scale(%, x = 3.14, y = 3.14, z = 3.14)

View File

@ -11,5 +11,15 @@ screw
pitch = 3.14,
yaw = 3.14,
)
|> translate(%, translate = [3.14, 3.14, 3.14])
|> scale(%, scale = [3.14, 3.14, 3.14])
|> translate(
%,
x = 3.14,
y = 3.14,
z = 3.14,
)
|> scale(
%,
x = 3.14,
y = 3.14,
z = 3.14,
)

View File

@ -168,54 +168,65 @@ description: Result of parsing car-wheel-assembly.kcl
"label": {
"commentStart": 366,
"end": 0,
"name": "translate",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 378,
"elements": [
{
"commentStart": 379,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"commentStart": 382,
"end": 0,
"raw": "0.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.5,
"suffix": "None"
}
},
{
"commentStart": 387,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"commentStart": 370,
"end": 0,
"raw": "0",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 373,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 377,
"end": 0,
"raw": "0.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.5,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 382,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 386,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
}
],
@ -253,14 +264,14 @@ description: Result of parsing car-wheel-assembly.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 391,
"commentStart": 389,
"end": 0,
"expression": {
"abs_path": false,
"commentStart": 391,
"commentStart": 389,
"end": 0,
"name": {
"commentStart": 391,
"commentStart": 389,
"end": 0,
"name": "carWheel",
"start": 0,
@ -276,16 +287,16 @@ description: Result of parsing car-wheel-assembly.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 400,
"commentStart": 398,
"end": 0,
"expression": {
"body": [
{
"abs_path": false,
"commentStart": 400,
"commentStart": 398,
"end": 0,
"name": {
"commentStart": 400,
"commentStart": 398,
"end": 0,
"name": "lugNut",
"start": 0,
@ -301,14 +312,14 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 438,
"commentStart": 436,
"end": 0,
"name": "arcDegrees",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 451,
"commentStart": 449,
"end": 0,
"raw": "360",
"start": 0,
@ -323,17 +334,17 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 463,
"commentStart": 461,
"end": 0,
"name": "axis",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 470,
"commentStart": 468,
"elements": [
{
"commentStart": 471,
"commentStart": 469,
"end": 0,
"raw": "0",
"start": 0,
@ -345,7 +356,7 @@ description: Result of parsing car-wheel-assembly.kcl
}
},
{
"commentStart": 474,
"commentStart": 472,
"end": 0,
"raw": "1",
"start": 0,
@ -357,7 +368,7 @@ description: Result of parsing car-wheel-assembly.kcl
}
},
{
"commentStart": 477,
"commentStart": 475,
"end": 0,
"raw": "0",
"start": 0,
@ -378,17 +389,17 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 488,
"commentStart": 486,
"end": 0,
"name": "center",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 497,
"commentStart": 495,
"elements": [
{
"commentStart": 498,
"commentStart": 496,
"end": 0,
"raw": "0",
"start": 0,
@ -400,7 +411,7 @@ description: Result of parsing car-wheel-assembly.kcl
}
},
{
"commentStart": 501,
"commentStart": 499,
"end": 0,
"raw": "0",
"start": 0,
@ -412,7 +423,7 @@ description: Result of parsing car-wheel-assembly.kcl
}
},
{
"commentStart": 504,
"commentStart": 502,
"end": 0,
"raw": "0",
"start": 0,
@ -433,7 +444,7 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 515,
"commentStart": 513,
"end": 0,
"name": "instances",
"start": 0,
@ -441,10 +452,10 @@ description: Result of parsing car-wheel-assembly.kcl
},
"arg": {
"abs_path": false,
"commentStart": 527,
"commentStart": 525,
"end": 0,
"name": {
"commentStart": 527,
"commentStart": 525,
"end": 0,
"name": "lugCount",
"start": 0,
@ -459,14 +470,14 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 544,
"commentStart": 542,
"end": 0,
"name": "rotateDuplicates",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 563,
"commentStart": 561,
"end": 0,
"raw": "false",
"start": 0,
@ -478,10 +489,10 @@ description: Result of parsing car-wheel-assembly.kcl
],
"callee": {
"abs_path": false,
"commentStart": 412,
"commentStart": 410,
"end": 0,
"name": {
"commentStart": 412,
"commentStart": 410,
"end": 0,
"name": "patternCircular3d",
"start": 0,
@ -491,7 +502,7 @@ description: Result of parsing car-wheel-assembly.kcl
"start": 0,
"type": "Name"
},
"commentStart": 412,
"commentStart": 410,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
@ -499,7 +510,7 @@ description: Result of parsing car-wheel-assembly.kcl
"unlabeled": null
}
],
"commentStart": 400,
"commentStart": 398,
"end": 0,
"start": 0,
"type": "PipeExpression",
@ -510,16 +521,16 @@ description: Result of parsing car-wheel-assembly.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 577,
"commentStart": 575,
"end": 0,
"expression": {
"body": [
{
"abs_path": false,
"commentStart": 577,
"commentStart": 575,
"end": 0,
"name": {
"commentStart": 577,
"commentStart": 575,
"end": 0,
"name": "brakeCaliper",
"start": 0,
@ -535,65 +546,76 @@ description: Result of parsing car-wheel-assembly.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 605,
"commentStart": 603,
"end": 0,
"name": "translate",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 617,
"elements": [
{
"commentStart": 618,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"commentStart": 621,
"end": 0,
"raw": "0.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.5,
"suffix": "None"
}
},
{
"commentStart": 626,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"commentStart": 607,
"end": 0,
"raw": "0",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 610,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 614,
"end": 0,
"raw": "0.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.5,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 619,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 623,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
}
],
"callee": {
"abs_path": false,
"commentStart": 595,
"commentStart": 593,
"end": 0,
"name": {
"commentStart": 595,
"commentStart": 593,
"end": 0,
"name": "translate",
"start": 0,
@ -603,7 +625,7 @@ description: Result of parsing car-wheel-assembly.kcl
"start": 0,
"type": "Name"
},
"commentStart": 595,
"commentStart": 593,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
@ -611,7 +633,7 @@ description: Result of parsing car-wheel-assembly.kcl
"unlabeled": null
}
],
"commentStart": 577,
"commentStart": 575,
"end": 0,
"start": 0,
"type": "PipeExpression",
@ -622,14 +644,14 @@ description: Result of parsing car-wheel-assembly.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 630,
"commentStart": 626,
"end": 0,
"expression": {
"abs_path": false,
"commentStart": 630,
"commentStart": 626,
"end": 0,
"name": {
"commentStart": 630,
"commentStart": 626,
"end": 0,
"name": "carTire",
"start": 0,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2097,54 +2097,65 @@ description: Result of parsing scale_after_fillet.kcl
"label": {
"commentStart": 1593,
"end": 0,
"name": "scale",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1601,
"elements": [
{
"commentStart": 1602,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 1608,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
},
{
"commentStart": 1614,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
],
"commentStart": 1597,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 1603,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1607,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 1613,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1617,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
}
],
@ -2177,7 +2188,7 @@ description: Result of parsing scale_after_fillet.kcl
"nonCodeNodes": {
"1": [
{
"commentStart": 1620,
"commentStart": 1622,
"end": 0,
"start": 0,
"type": "NonCodeNode",

View File

@ -52,6 +52,6 @@ export fn bolt() {
}
bolt()
|> scale(scale = [3.14, 3.14, 3.14])
|> scale(x = 3.14, y = 3.14, z = 3.14)
// https://www.mcmaster.com/91251a404/

View File

@ -56,6 +56,6 @@ export fn bolt() {
}
bolt()
|> scale(scale = [3.14, 3.14, 3.14])
|> scale(x = 3.14, y = 3.14, z = 3.14)
// https://www.mcmaster.com/91251a404/

View File

@ -2097,54 +2097,65 @@ description: Result of parsing translate_after_fillet.kcl
"label": {
"commentStart": 1597,
"end": 0,
"name": "translate",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1601,
"end": 0,
"raw": "10",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 1605,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1609,
"elements": [
{
"commentStart": 1610,
"end": 0,
"raw": "10",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
},
{
"commentStart": 1614,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"commentStart": 1617,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 0,
"raw": "0",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 1612,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1616,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
}
],
@ -2177,7 +2188,7 @@ description: Result of parsing translate_after_fillet.kcl
"nonCodeNodes": {
"1": [
{
"commentStart": 1620,
"commentStart": 1618,
"end": 0,
"start": 0,
"type": "NonCodeNode",

View File

@ -52,6 +52,6 @@ export fn bolt() {
}
bolt()
|> translate(translate = [10, 0, 0])
|> translate(x = 10, y = 0, z = 0)
// https://www.mcmaster.com/91251a404/

View File

@ -56,6 +56,6 @@ export fn bolt() {
}
bolt()
|> translate(translate = [10, 0, 0])
|> translate(x = 10, y = 0, z = 0)
// https://www.mcmaster.com/91251a404/