Remove offsetHeight

This commit is contained in:
Adam Chalmers
2025-06-18 09:20:48 -05:00
parent 1a1c60fede
commit a76e18dd2c
5 changed files with 26 additions and 242 deletions

View File

@ -35,9 +35,9 @@ fn helicalGear(nTeeth, module, pressureAngle, helixAngle, gearHeight) {
|> extrude(length = gearHeight) |> extrude(length = gearHeight)
// Define a function to create a rotated gear sketch on an offset plane // Define a function to create a rotated gear sketch on an offset plane
fn helicalGearSketch(offsetHeight) { fn helicalGearSketch() {
// Using the gear parameters, sketch an involute tooth spanning from the base diameter to the tip diameter // Using the gear parameters, sketch an involute tooth spanning from the base diameter to the tip diameter
helicalGearSketch = startSketchOn(offsetPlane(XY, offset = offsetHeight)) helicalGearSketch = startSketchOn(XY)
|> startProfile(at = polar(angle = 0, length = baseDiameter / 2)) |> startProfile(at = polar(angle = 0, length = baseDiameter / 2))
|> involuteCircular( |> involuteCircular(
startRadius = baseDiameter / 2, startRadius = baseDiameter / 2,
@ -63,7 +63,7 @@ fn helicalGear(nTeeth, module, pressureAngle, helixAngle, gearHeight) {
} }
// Draw a gear sketch on the base plane // Draw a gear sketch on the base plane
return helicalGearSketch(offsetHeight = 0) return helicalGearSketch()
|> extrude(length = gearHeight, twistAngle = helixAngle) |> extrude(length = gearHeight, twistAngle = helixAngle)
|> subtract([%], tools = [holeWithKeyway]) |> subtract([%], tools = [holeWithKeyway])
} }

View File

@ -261,32 +261,9 @@ description: Artifact commands helical-gear.kcl
"y": 1.0, "y": 1.0,
"z": 0.0 "z": 0.0
}, },
"size": 100.0, "size": 60.0,
"clobber": false, "clobber": false,
"hide": false "hide": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.6,
"g": 0.6,
"b": 0.6,
"a": 0.3
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
} }
}, },
{ {

View File

@ -18,17 +18,17 @@ flowchart LR
9[Solid2d] 9[Solid2d]
end end
subgraph path25 [Path] subgraph path25 [Path]
25["Path<br>[1623, 1685, 0]"] 25["Path<br>[1575, 1637, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
26["Segment<br>[1695, 1853, 0]"] 26["Segment<br>[1647, 1805, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }] %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
27["Segment<br>[1863, 1936, 0]"] 27["Segment<br>[1815, 1888, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }] %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
28["Segment<br>[1946, 2149, 0]"] 28["Segment<br>[1898, 2101, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }] %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
29["Segment<br>[2236, 2310, 0]"] 29["Segment<br>[2188, 2262, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }] %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
30["Segment<br>[2489, 2496, 0]"] 30["Segment<br>[2441, 2448, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }] %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
31[Solid2d] 31[Solid2d]
end end
@ -55,9 +55,9 @@ flowchart LR
21["SweepEdge Opposite"] 21["SweepEdge Opposite"]
22["SweepEdge Opposite"] 22["SweepEdge Opposite"]
23["SweepEdge Adjacent"] 23["SweepEdge Adjacent"]
24["Plane<br>[1574, 1612, 0]"] 24["Plane<br>[1548, 1565, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }, CallKwUnlabeledArg] %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
32["Sweep ExtrusionTwist<br>[2625, 2678, 0]"] 32["Sweep ExtrusionTwist<br>[2561, 2614, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 12 }, ReturnStatementArg, PipeBodyItem { index: 1 }] %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 12 }, ReturnStatementArg, PipeBodyItem { index: 1 }]
33[Wall] 33[Wall]
%% face_code_ref=Missing NodePath %% face_code_ref=Missing NodePath
@ -79,10 +79,8 @@ flowchart LR
44["SweepEdge Adjacent"] 44["SweepEdge Adjacent"]
45["SweepEdge Opposite"] 45["SweepEdge Opposite"]
46["SweepEdge Adjacent"] 46["SweepEdge Adjacent"]
47["CompositeSolid Subtract<br>[2686, 2725, 0]"] 47["CompositeSolid Subtract<br>[2622, 2661, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 12 }, ReturnStatementArg, PipeBodyItem { index: 2 }] %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 12 }, ReturnStatementArg, PipeBodyItem { index: 2 }]
48["StartSketchOnPlane<br>[1560, 1613, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
1 --- 2 1 --- 2
2 --- 3 2 --- 3
2 --- 4 2 --- 4
@ -137,7 +135,6 @@ flowchart LR
21 <--x 16 21 <--x 16
22 <--x 16 22 <--x 16
24 --- 25 24 --- 25
24 <--x 48
25 --- 26 25 --- 26
25 --- 27 25 --- 27
25 --- 28 25 --- 28

View File

@ -1429,70 +1429,20 @@ description: Result of parsing helical-gear.kcl
"type": "CallExpressionKw", "type": "CallExpressionKw",
"type": "CallExpressionKw", "type": "CallExpressionKw",
"unlabeled": { "unlabeled": {
"arguments": [ "abs_path": false,
{
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "offset",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "offsetHeight",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "offsetPlane",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"start": 0, "name": {
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"name": { "name": "XY",
"commentStart": 0,
"end": 0,
"name": "XY",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0, "start": 0,
"type": "Name", "type": "Identifier"
"type": "Name" },
} "path": [],
"start": 0,
"type": "Name",
"type": "Name"
} }
}, },
{ {
@ -2567,18 +2517,7 @@ description: Result of parsing helical-gear.kcl
}, },
"commentStart": 0, "commentStart": 0,
"end": 0, "end": 0,
"params": [ "params": [],
{
"type": "Parameter",
"identifier": {
"commentStart": 0,
"end": 0,
"name": "offsetHeight",
"start": 0,
"type": "Identifier"
}
}
],
"start": 0, "start": 0,
"type": "FunctionExpression", "type": "FunctionExpression",
"type": "FunctionExpression" "type": "FunctionExpression"
@ -2596,30 +2535,6 @@ description: Result of parsing helical-gear.kcl
"argument": { "argument": {
"body": [ "body": [
{ {
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "offsetHeight",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
}
],
"callee": { "callee": {
"abs_path": false, "abs_path": false,
"commentStart": 0, "commentStart": 0,
@ -3128,17 +3043,6 @@ description: Result of parsing helical-gear.kcl
"type": "newLine" "type": "newLine"
} }
} }
],
"2": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
] ]
}, },
"startNodes": [ "startNodes": [

View File

@ -710,24 +710,7 @@ description: Operations executed helical-gear.kcl
"name": "helicalGearSketch", "name": "helicalGearSketch",
"functionSourceRange": [], "functionSourceRange": [],
"unlabeledArg": null, "unlabeledArg": null,
"labeledArgs": { "labeledArgs": {}
"offsetHeight": {
"value": {
"type": "Number",
"value": 0.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
}
}
}, },
"nodePath": { "nodePath": {
"steps": [ "steps": [
@ -759,83 +742,6 @@ description: Operations executed helical-gear.kcl
}, },
"sourceRange": [] "sourceRange": []
}, },
{
"type": "StdLibCall",
"name": "offsetPlane",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
},
"labeledArgs": {
"offset": {
"value": {
"type": "Number",
"value": 0.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
}
},
"nodePath": {
"steps": [
{
"type": "ProgramBodyItem",
"index": 0
},
{
"type": "VariableDeclarationDeclaration"
},
{
"type": "VariableDeclarationInit"
},
{
"type": "FunctionExpressionBody"
},
{
"type": "FunctionExpressionBodyItem",
"index": 11
},
{
"type": "VariableDeclarationDeclaration"
},
{
"type": "VariableDeclarationInit"
},
{
"type": "FunctionExpressionBody"
},
{
"type": "FunctionExpressionBodyItem",
"index": 0
},
{
"type": "VariableDeclarationDeclaration"
},
{
"type": "VariableDeclarationInit"
},
{
"type": "PipeBodyItem",
"index": 0
},
{
"type": "CallKwUnlabeledArg"
}
]
},
"sourceRange": []
},
{ {
"type": "StdLibCall", "type": "StdLibCall",
"name": "startSketchOn", "name": "startSketchOn",