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

@ -6,6 +6,10 @@ layout: manual
Rotate a solid or a sketch.
This is really useful for assembling parts together. You can create a part and then rotate it to the correct orientation.
For sketches, you can use this to rotate a sketch and then loft it with another sketch.
### Using Roll, Pitch, and Yaw
When rotating a part in 3D space, "roll," "pitch," and "yaw" refer to the three rotational axes used to describe its orientation: roll is rotation around the longitudinal axis (front-to-back), pitch is rotation around the lateral axis (wing-to-wing), and yaw is rotation around the vertical axis (up-down); essentially, it's like tilting the part on its side (roll), tipping the nose up or down (pitch), and turning it left or right (yaw).
@ -166,7 +170,7 @@ fn square() {
profile001 = square()
profile002 = square()
|> translate(translate = [0, 0, 20])
|> translate(x = 0, y = 0, z = 20)
|> rotate(axis = [0, 0, 1.0], angle = 45)
loft([profile001, profile002])

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@ import "car-tire.kcl" as carTire
import lugCount from "globals.kcl"
carRotor
|> translate(translate = [0, 0.5, 0])
|> translate(x = 0, y = 0.5, z = 0)
carWheel
lugNut
|> patternCircular3d(
@ -23,5 +23,5 @@ lugNut
rotateDuplicates = false,
)
brakeCaliper
|> translate(translate = [0, 0.5, 0])
|> translate(x = 0, y = 0.5, z = 0)
carTire

View File

@ -19,27 +19,27 @@ import pipe from "1120t74-pipe.kcl"
flange()
flange()
|> rotate(axis = [0, 1, 0], angle = 180)
|> translate(translate = [
0,
0,
flangeBackHeight * 2 + gasketThickness
])
|> translate(
x = 0,
y = 0,
z = flangeBackHeight * 2 + gasketThickness,
)
// place gasket between the flanges
gasket()
|> translate(translate = [
0,
0,
-flangeBackHeight - gasketThickness
])
|> translate(
x = 0,
y = 0,
z = -flangeBackHeight - gasketThickness
)
// place eight washers (four front, four back)
washer()
|> translate(translate = [
mountingHolePlacementDiameter / 2,
0,
flangeBaseThickness
])
|> translate(
x = mountingHolePlacementDiameter / 2,
y = 0,
z = flangeBaseThickness
)
|> patternCircular3d(
%,
instances = 4,
@ -57,11 +57,11 @@ washer()
// place four bolts
bolt()
|> translate(translate = [
mountingHolePlacementDiameter / 2,
0,
flangeBaseThickness + washerThickness
])
|> translate(
x = mountingHolePlacementDiameter / 2,
y = 0,
z = flangeBaseThickness + washerThickness,
)
|> rotate(roll = 90, pitch = 0, yaw = 0)
|> patternCircular3d(
%,
@ -74,11 +74,11 @@ bolt()
// place four hex nuts
hexNut()
|> translate(translate = [
mountingHolePlacementDiameter / 2,
0,
-(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness)
])
|> translate(
x = mountingHolePlacementDiameter / 2,
y = 0,
z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness),
)
|> patternCircular3d(
%,
instances = 4,
@ -98,11 +98,9 @@ pipe()
)
|> translate(
%,
translate = [
0,
0,
flangeBaseThickness + flangeFrontHeight - 0.5
],
x = 0,
y = 0,
z = flangeBaseThickness + flangeFrontHeight - 0.5,
global = true,
)
@ -115,10 +113,8 @@ pipe()
)
|> translate(
%,
translate = [
0,
0,
-(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + flangeFrontHeight - 0.5)
],
x = 0,
y = 0,
z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + flangeFrontHeight - 0.5),
global = true,
)

View File

@ -20,37 +20,37 @@ body()
// import the antenna
antenna()
|> translate(translate = [-width / 2 + .45, -0.10, height / 2])
|> translate(x = -width / 2 + .45, y = -0.10, z = height / 2)
// import the case
case()
|> translate(translate = [0, -1, 0])
|> translate(x = 0, y = -1, z = 0)
// import the talk button
talkButton()
|> translate(translate = [width / 2, -thickness / 2, .5])
|> translate(x = width / 2, y = -thickness / 2, z = .5)
// import the frequency knob
knob()
|> translate(translate = [
width / 2 - 0.70,
-thickness / 2,
height / 2
])
|> translate(
x = width / 2 - 0.70,
y = -thickness / 2,
z = height / 2
)
// import the buttons
button()
|> translate(translate = [
-(screenWidth / 2 + tolerance),
-1,
screenYPosition
])
|> translate(
x = -(screenWidth / 2 + tolerance),
y = -1,
z = screenYPosition
)
button()
|> translate(translate = [
-(screenWidth / 2 + tolerance),
-1,
screenYPosition - buttonHeight - (tolerance * 2)
])
|> translate(
x = -(screenWidth / 2 + tolerance),
y = -1,
z = screenYPosition - buttonHeight - (tolerance * 2)
)
button()
|> rotate(
%,
@ -59,11 +59,9 @@ button()
yaw = 0,
)
|> translate(
translate = [
screenWidth / 2 + tolerance,
-1,
screenYPosition - buttonHeight
],
x = screenWidth / 2 + tolerance,
y = -1,
z = screenYPosition - buttonHeight,
global = true,
)
button()
@ -74,10 +72,8 @@ button()
yaw = 0,
)
|> translate(
translate = [
screenWidth / 2 + tolerance,
-1,
screenYPosition - (buttonHeight * 2) - (tolerance * 2)
],
x = screenWidth / 2 + tolerance,
y = -1,
z = screenYPosition - (buttonHeight * 2) - (tolerance * 2),
global = true,
)

View File

@ -1141,7 +1141,7 @@ mod tests {
let snippet = scale_fn.to_autocomplete_snippet().unwrap();
assert_eq!(
snippet,
r#"scale(${0:%}, scale = [${1:3.14}, ${2:3.14}, ${3:3.14}])${}"#
r#"scale(${0:%}, x = ${1:3.14}, y = ${2:3.14}, z = ${3:3.14})${}"#
);
}
@ -1152,7 +1152,7 @@ mod tests {
let snippet = translate_fn.to_autocomplete_snippet().unwrap();
assert_eq!(
snippet,
r#"translate(${0:%}, translate = [${1:3.14}, ${2:3.14}, ${3:3.14}])${}"#
r#"translate(${0:%}, x = ${1:3.14}, y = ${2:3.14}, z = ${3:3.14})${}"#
);
}

View File

@ -2044,6 +2044,8 @@ let w = f() + f()
// Ensure the settings are as expected.
assert_eq!(settings_state, ctx.settings);
ctx.close().await;
}
#[tokio::test(flavor = "multi_thread")]
@ -2057,6 +2059,9 @@ let w = f() + f()
let program2 = crate::Program::parse_no_errs("z = x + 1").unwrap();
let result = ctx2.run_mock(program2, true).await.unwrap();
assert_eq!(result.variables.get("z").unwrap().as_f64().unwrap(), 3.0);
ctx.close().await;
ctx2.close().await;
}
#[tokio::test(flavor = "multi_thread")]

View File

@ -28,15 +28,22 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
]),
exec_state,
)?;
let scale = args.get_kw_arg("scale")?;
let scale_x = args.get_kw_arg("x")?;
let scale_y = args.get_kw_arg("y")?;
let scale_z = args.get_kw_arg("z")?;
let global = args.get_kw_arg_opt("global")?;
let objects = inner_scale(objects, scale, global, exec_state, args).await?;
let objects = inner_scale(objects, scale_x, scale_y, scale_z, global, exec_state, args).await?;
Ok(objects.into())
}
/// Scale a solid or a sketch.
///
/// This is really useful for resizing parts. You can create a part and then scale it to the
/// correct size.
///
/// For sketches, you can use this to scale a sketch and then loft it with another sketch.
///
/// By default the transform is applied in local sketch axis, therefore the origin will not move.
///
/// If you want to apply the transform in global space, set `global` to `true`. The origin of the
@ -78,7 +85,9 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// |> hole(pipeHole, %)
/// |> sweep(path = sweepPath)
/// |> scale(
/// scale = [1.0, 1.0, 2.5],
/// x = 1.0,
/// y = 1.0,
/// z = 2.5,
/// )
/// ```
///
@ -89,7 +98,9 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
///
/// cube
/// |> scale(
/// scale = [1.0, 1.0, 2.5],
/// x = 1.0,
/// y = 1.0,
/// z = 2.5,
/// )
/// ```
///
@ -124,7 +135,7 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// parts = sweep([rectangleSketch, circleSketch], path = sweepPath)
///
/// // Scale the sweep.
/// scale(parts, scale = [1.0, 1.0, 0.5])
/// scale(parts, x = 1.0, y = 1.0, z = 0.5)
/// ```
#[stdlib {
name = "scale",
@ -133,13 +144,17 @@ pub async fn scale(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
unlabeled_first = true,
args = {
objects = {docs = "The solid, sketch, or set of solids or sketches to scale."},
scale = {docs = "The scale factor for the x, y, and z axes."},
x = {docs = "The scale factor for the x axis."},
y = {docs = "The scale factor for the y axis."},
z = {docs = "The scale factor for the z axis."},
global = {docs = "If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move."}
}
}]
async fn inner_scale(
objects: SolidOrSketchOrImportedGeometry,
scale: [f64; 3],
x: f64,
y: f64,
z: f64,
global: Option<bool>,
exec_state: &mut ExecState,
args: Args,
@ -159,11 +174,7 @@ async fn inner_scale(
object_id,
transforms: vec![shared::ComponentTransform {
scale: Some(shared::TransformBy::<Point3d<f64>> {
property: Point3d {
x: scale[0],
y: scale[1],
z: scale[2],
},
property: Point3d { x, y, z },
set: false,
is_local: !global.unwrap_or(false),
}),
@ -190,15 +201,23 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
]),
exec_state,
)?;
let translate = args.get_kw_arg("translate")?;
let translate_x = args.get_kw_arg("x")?;
let translate_y = args.get_kw_arg("y")?;
let translate_z = args.get_kw_arg("z")?;
let global = args.get_kw_arg_opt("global")?;
let objects = inner_translate(objects, translate, global, exec_state, args).await?;
let objects = inner_translate(objects, translate_x, translate_y, translate_z, global, exec_state, args).await?;
Ok(objects.into())
}
/// Move a solid or a sketch.
///
/// This is really useful for assembling parts together. You can create a part
/// and then move it to the correct location.
///
/// Translate is really useful for sketches if you want to move a sketch
/// and then rotate it using the `rotate` function to create a loft.
///
/// ```no_run
/// // Move a pipe.
///
@ -232,7 +251,9 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
/// |> hole(pipeHole, %)
/// |> sweep(path = sweepPath)
/// |> translate(
/// translate = [1.0, 1.0, 2.5],
/// x = 1.0,
/// y = 1.0,
/// z = 2.5,
/// )
/// ```
///
@ -243,7 +264,9 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
///
/// cube
/// |> translate(
/// translate = [1.0, 1.0, 2.5],
/// x = 1.0,
/// y = 1.0,
/// z = 2.5,
/// )
/// ```
///
@ -278,7 +301,7 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
/// parts = sweep([rectangleSketch, circleSketch], path = sweepPath)
///
/// // Move the sweeps.
/// translate(parts, translate = [1.0, 1.0, 2.5])
/// translate(parts, x = 1.0, y = 1.0, z = 2.5)
/// ```
///
/// ```no_run
@ -301,7 +324,9 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
///
/// square(10)
/// |> translate(
/// translate = [5, 5, 0],
/// x = 5,
/// y = 5,
/// z = 0,
/// )
/// |> extrude(
/// length = 10,
@ -324,7 +349,7 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
/// profile001 = square()
///
/// profile002 = square()
/// |> translate(translate = [0, 0, 20])
/// |> translate(x = 0, y = 0, z = 20)
/// |> rotate(axis = [0, 0, 1.0], angle = 45)
///
/// loft([profile001, profile002])
@ -336,13 +361,17 @@ pub async fn translate(exec_state: &mut ExecState, args: Args) -> Result<KclValu
unlabeled_first = true,
args = {
objects = {docs = "The solid, sketch, or set of solids or sketches to move."},
translate = {docs = "The amount to move the solid or sketch in all three axes."},
x = {docs = "The amount to move the solid or sketch along the x axis."},
y = {docs = "The amount to move the solid or sketch along the y axis."},
z = {docs = "The amount to move the solid or sketch along the z axis."},
global = {docs = "If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move."}
}
}]
async fn inner_translate(
objects: SolidOrSketchOrImportedGeometry,
translate: [f64; 3],
x: f64,
y: f64,
z: f64,
global: Option<bool>,
exec_state: &mut ExecState,
args: Args,
@ -363,9 +392,9 @@ async fn inner_translate(
transforms: vec![shared::ComponentTransform {
translate: Some(shared::TransformBy::<Point3d<LengthUnit>> {
property: shared::Point3d {
x: LengthUnit(translate[0]),
y: LengthUnit(translate[1]),
z: LengthUnit(translate[2]),
x: LengthUnit(x),
y: LengthUnit(y),
z: LengthUnit(z),
},
set: false,
is_local: !global.unwrap_or(false),
@ -506,6 +535,11 @@ pub async fn rotate(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// Rotate a solid or a sketch.
///
/// This is really useful for assembling parts together. You can create a part
/// and then rotate it to the correct orientation.
///
/// For sketches, you can use this to rotate a sketch and then loft it with another sketch.
///
/// ### Using Roll, Pitch, and Yaw
///
/// When rotating a part in 3D space, "roll," "pitch," and "yaw" refer to the
@ -667,7 +701,7 @@ pub async fn rotate(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// profile001 = square()
///
/// profile002 = square()
/// |> translate(translate = [0, 0, 20])
/// |> translate(x = 0, y = 0, z = 20)
/// |> rotate(axis = [0, 0, 1.0], angle = 45)
///
/// loft([profile001, profile002])

View File

@ -151,15 +151,12 @@ 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,
"commentStart": 163,
"end": 0,
"raw": "3.14",
"start": 0,
@ -169,9 +166,19 @@ description: Result of parsing import_transform.kcl
"value": 3.14,
"suffix": "None"
}
}
},
{
"commentStart": 178,
"type": "LabeledArg",
"label": {
"commentStart": 169,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 173,
"end": 0,
"raw": "3.14",
"start": 0,
@ -181,9 +188,19 @@ description: Result of parsing import_transform.kcl
"value": 3.14,
"suffix": "None"
}
}
},
{
"commentStart": 184,
"type": "LabeledArg",
"label": {
"commentStart": 179,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 183,
"end": 0,
"raw": "3.14",
"start": 0,
@ -194,12 +211,6 @@ description: Result of parsing import_transform.kcl
"suffix": "None"
}
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
@ -235,17 +246,36 @@ 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": 207,
"end": 0,
"raw": "3.14",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 213,
"elements": [
{
"commentStart": 214,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 217,
"end": 0,
"raw": "3.14",
"start": 0,
@ -255,21 +285,19 @@ description: Result of parsing import_transform.kcl
"value": 3.14,
"suffix": "None"
}
}
},
{
"commentStart": 220,
"type": "LabeledArg",
"label": {
"commentStart": 223,
"end": 0,
"raw": "3.14",
"name": "z",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.14,
"suffix": "None"
}
"type": "Identifier"
},
{
"commentStart": 226,
"arg": {
"commentStart": 227,
"end": 0,
"raw": "3.14",
"start": 0,
@ -280,20 +308,14 @@ description: Result of parsing import_transform.kcl
"suffix": "None"
}
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"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,15 +168,12 @@ 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,
"commentStart": 370,
"end": 0,
"raw": "0",
"start": 0,
@ -186,9 +183,19 @@ description: Result of parsing car-wheel-assembly.kcl
"value": 0.0,
"suffix": "None"
}
}
},
{
"commentStart": 382,
"type": "LabeledArg",
"label": {
"commentStart": 373,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 377,
"end": 0,
"raw": "0.5",
"start": 0,
@ -198,9 +205,19 @@ description: Result of parsing car-wheel-assembly.kcl
"value": 0.5,
"suffix": "None"
}
}
},
{
"commentStart": 387,
"type": "LabeledArg",
"label": {
"commentStart": 382,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 386,
"end": 0,
"raw": "0",
"start": 0,
@ -211,12 +228,6 @@ description: Result of parsing car-wheel-assembly.kcl
"suffix": "None"
}
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
@ -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,17 +546,14 @@ 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,
"commentStart": 607,
"end": 0,
"raw": "0",
"start": 0,
@ -555,9 +563,19 @@ description: Result of parsing car-wheel-assembly.kcl
"value": 0.0,
"suffix": "None"
}
}
},
{
"commentStart": 621,
"type": "LabeledArg",
"label": {
"commentStart": 610,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 614,
"end": 0,
"raw": "0.5",
"start": 0,
@ -567,9 +585,19 @@ description: Result of parsing car-wheel-assembly.kcl
"value": 0.5,
"suffix": "None"
}
}
},
{
"commentStart": 626,
"type": "LabeledArg",
"label": {
"commentStart": 619,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 623,
"end": 0,
"raw": "0",
"start": 0,
@ -580,20 +608,14 @@ description: Result of parsing car-wheel-assembly.kcl
"suffix": "None"
}
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"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,15 +2097,12 @@ 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,
"commentStart": 1597,
"end": 0,
"raw": "3.14",
"start": 0,
@ -2115,9 +2112,19 @@ description: Result of parsing scale_after_fillet.kcl
"value": 3.14,
"suffix": "None"
}
}
},
{
"commentStart": 1608,
"type": "LabeledArg",
"label": {
"commentStart": 1603,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1607,
"end": 0,
"raw": "3.14",
"start": 0,
@ -2127,9 +2134,19 @@ description: Result of parsing scale_after_fillet.kcl
"value": 3.14,
"suffix": "None"
}
}
},
{
"commentStart": 1614,
"type": "LabeledArg",
"label": {
"commentStart": 1613,
"end": 0,
"name": "z",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1617,
"end": 0,
"raw": "3.14",
"start": 0,
@ -2140,12 +2157,6 @@ description: Result of parsing scale_after_fillet.kcl
"suffix": "None"
}
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
@ -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,15 +2097,12 @@ description: Result of parsing translate_after_fillet.kcl
"label": {
"commentStart": 1597,
"end": 0,
"name": "translate",
"name": "x",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1609,
"elements": [
{
"commentStart": 1610,
"commentStart": 1601,
"end": 0,
"raw": "10",
"start": 0,
@ -2115,21 +2112,19 @@ description: Result of parsing translate_after_fillet.kcl
"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,
"type": "LabeledArg",
"label": {
"commentStart": 1605,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1609,
"end": 0,
"raw": "0",
"start": 0,
@ -2140,11 +2135,27 @@ description: Result of parsing translate_after_fillet.kcl
"suffix": "None"
}
}
],
},
{
"type": "LabeledArg",
"label": {
"commentStart": 1612,
"end": 0,
"name": "z",
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
"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/