KCL: Angled line should use keyword args (#5803)

We continue migrating KCL stdlib functions to use keyword arguments. Next up is the `angledLine` family of functions (except `angledLineThatIntersects, which will be a quick follow-up).

Before vs. after:

`angledLine({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, length = 3, tag = $edge)`

`angledLineOfXLength({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, lengthX = 3, tag = $edge)`

`angledLineOfYLength({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, lengthY = 3, tag = $edge)`

`angledLineToX({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, endAbsoluteX = 3, tag = $edge)`

`angledLineToY({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, endAbsoluteY = 3, tag = $edge)`
This commit is contained in:
Adam Chalmers
2025-04-09 14:55:15 -05:00
committed by GitHub
parent b03ca30379
commit d275995dfe
288 changed files with 36142 additions and 40081 deletions

View File

@ -7,17 +7,17 @@ flowchart LR
end
subgraph path13 [Path]
13["Path<br>[655, 742, 0]"]
14["Segment<br>[750, 833, 0]"]
15["Segment<br>[841, 924, 0]"]
16["Segment<br>[932, 1015, 0]"]
17["Segment<br>[1023, 1105, 0]"]
18["Segment<br>[1113, 1195, 0]"]
19["Segment<br>[1203, 1210, 0]"]
14["Segment<br>[750, 829, 0]"]
15["Segment<br>[837, 916, 0]"]
16["Segment<br>[924, 1003, 0]"]
17["Segment<br>[1011, 1089, 0]"]
18["Segment<br>[1097, 1175, 0]"]
19["Segment<br>[1183, 1190, 0]"]
20[Solid2d]
end
subgraph path41 [Path]
41["Path<br>[1311, 1380, 0]"]
42["Segment<br>[1311, 1380, 0]"]
41["Path<br>[1291, 1360, 0]"]
42["Segment<br>[1291, 1360, 0]"]
43[Solid2d]
end
1["Plane<br>[320, 339, 0]"]
@ -29,7 +29,7 @@ flowchart LR
10["SweepEdge Adjacent"]
11["EdgeCut Fillet<br>[466, 532, 0]"]
12["EdgeCut Fillet<br>[466, 532, 0]"]
21["Sweep Extrusion<br>[1218, 1258, 0]"]
21["Sweep Extrusion<br>[1198, 1238, 0]"]
22[Wall]
23[Wall]
24[Wall]
@ -49,14 +49,14 @@ flowchart LR
38["SweepEdge Adjacent"]
39["SweepEdge Opposite"]
40["SweepEdge Adjacent"]
44["Sweep Extrusion<br>[1388, 1416, 0]"]
44["Sweep Extrusion<br>[1368, 1396, 0]"]
45[Wall]
46["Cap End"]
47["SweepEdge Opposite"]
48["SweepEdge Adjacent"]
49["EdgeCut Fillet<br>[1424, 1483, 0]"]
49["EdgeCut Fillet<br>[1404, 1463, 0]"]
50["StartSketchOnFace<br>[615, 647, 0]"]
51["StartSketchOnFace<br>[1273, 1303, 0]"]
51["StartSketchOnFace<br>[1253, 1283, 0]"]
1 --- 2
2 --- 3
2 ---- 5

View File

@ -949,74 +949,52 @@ description: Result of parsing rotate_after_fillet.kcl
{
"arguments": [
{
"commentStart": 0,
"end": 0,
"properties": [
{
"commentStart": 0,
"end": 0,
"key": {
"commentStart": 0,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"commentStart": 0,
"end": 0,
"raw": "270",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 270.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"key": {
"commentStart": 0,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "boltHexFlatLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "270",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 270.0,
"suffix": "None"
}
],
"start": 0,
"type": "ObjectExpression",
"type": "ObjectExpression"
}
},
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "boltHexFlatLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
@ -1037,80 +1015,59 @@ description: Result of parsing rotate_after_fillet.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"commentStart": 0,
"end": 0,
"properties": [
{
"commentStart": 0,
"end": 0,
"key": {
"commentStart": 0,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"commentStart": 0,
"end": 0,
"raw": "210",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 210.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"key": {
"commentStart": 0,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "boltHexFlatLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "210",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 210.0,
"suffix": "None"
}
],
"start": 0,
"type": "ObjectExpression",
"type": "ObjectExpression"
}
},
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "boltHexFlatLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
@ -1131,80 +1088,59 @@ description: Result of parsing rotate_after_fillet.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"commentStart": 0,
"end": 0,
"properties": [
{
"commentStart": 0,
"end": 0,
"key": {
"commentStart": 0,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"commentStart": 0,
"end": 0,
"raw": "150",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 150.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"key": {
"commentStart": 0,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "boltHexFlatLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "150",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 150.0,
"suffix": "None"
}
],
"start": 0,
"type": "ObjectExpression",
"type": "ObjectExpression"
}
},
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "boltHexFlatLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
@ -1225,80 +1161,59 @@ description: Result of parsing rotate_after_fillet.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"commentStart": 0,
"end": 0,
"properties": [
{
"commentStart": 0,
"end": 0,
"key": {
"commentStart": 0,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"commentStart": 0,
"end": 0,
"raw": "90",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 90.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"key": {
"commentStart": 0,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "boltHexFlatLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "90",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 90.0,
"suffix": "None"
}
],
"start": 0,
"type": "ObjectExpression",
"type": "ObjectExpression"
}
},
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "boltHexFlatLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
@ -1319,80 +1234,59 @@ description: Result of parsing rotate_after_fillet.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"commentStart": 0,
"end": 0,
"properties": [
{
"commentStart": 0,
"end": 0,
"key": {
"commentStart": 0,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"commentStart": 0,
"end": 0,
"raw": "30",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 30.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"key": {
"commentStart": 0,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "boltHexFlatLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "30",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 30.0,
"suffix": "None"
}
],
"start": 0,
"type": "ObjectExpression",
"type": "ObjectExpression"
}
},
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "boltHexFlatLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
@ -1413,8 +1307,9 @@ description: Result of parsing rotate_after_fillet.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [],

View File

@ -19,26 +19,26 @@ export fn bolt() {
boltHexDrive / 2,
boltHexFlatLength / 2
], %)
|> angledLine({
|> angledLine(
angle = 270,
length = boltHexFlatLength
}, %)
|> angledLine({
length = boltHexFlatLength,
)
|> angledLine(
angle = 210,
length = boltHexFlatLength
}, %)
|> angledLine({
length = boltHexFlatLength,
)
|> angledLine(
angle = 150,
length = boltHexFlatLength
}, %)
|> angledLine({
length = boltHexFlatLength,
)
|> angledLine(
angle = 90,
length = boltHexFlatLength
}, %)
|> angledLine({
length = boltHexFlatLength,
)
|> angledLine(
angle = 30,
length = boltHexFlatLength
}, %)
length = boltHexFlatLength,
)
|> close()
|> extrude(length = -boltHeadLength * 0.75)

View File

@ -28,7 +28,7 @@ description: Operations executed rotate_after_fillet.kcl
"name": "bolt",
"functionSourceRange": [
264,
1573,
1553,
0
],
"unlabeledArg": null,

View File

@ -23,26 +23,11 @@ export fn bolt() {
boltHexDrive / 2,
boltHexFlatLength / 2
], %)
|> angledLine({
angle = 270,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = 210,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = 150,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = 90,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = 30,
length = boltHexFlatLength
}, %)
|> angledLine(angle = 270, length = boltHexFlatLength)
|> angledLine(angle = 210, length = boltHexFlatLength)
|> angledLine(angle = 150, length = boltHexFlatLength)
|> angledLine(angle = 90, length = boltHexFlatLength)
|> angledLine(angle = 30, length = boltHexFlatLength)
|> close()
|> extrude(length = -boltHeadLength * 0.75)