Remove offsetHeight
This commit is contained in:
		@ -35,9 +35,9 @@ fn helicalGear(nTeeth, module, pressureAngle, helixAngle, gearHeight) {
 | 
			
		||||
    |> extrude(length = gearHeight)
 | 
			
		||||
 | 
			
		||||
  // 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
 | 
			
		||||
    helicalGearSketch = startSketchOn(offsetPlane(XY, offset = offsetHeight))
 | 
			
		||||
    helicalGearSketch = startSketchOn(XY)
 | 
			
		||||
      |> startProfile(at = polar(angle = 0, length = baseDiameter / 2))
 | 
			
		||||
      |> involuteCircular(
 | 
			
		||||
           startRadius = baseDiameter / 2,
 | 
			
		||||
@ -63,7 +63,7 @@ fn helicalGear(nTeeth, module, pressureAngle, helixAngle, gearHeight) {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Draw a gear sketch on the base plane
 | 
			
		||||
  return helicalGearSketch(offsetHeight = 0)
 | 
			
		||||
  return helicalGearSketch()
 | 
			
		||||
    |> extrude(length = gearHeight, twistAngle = helixAngle)
 | 
			
		||||
    |> subtract([%], tools = [holeWithKeyway])
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -261,32 +261,9 @@ description: Artifact commands helical-gear.kcl
 | 
			
		||||
          "y": 1.0,
 | 
			
		||||
          "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "size": 100.0,
 | 
			
		||||
        "size": 60.0,
 | 
			
		||||
        "clobber": false,
 | 
			
		||||
        "hide": false
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "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
 | 
			
		||||
        "hide": true
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -18,17 +18,17 @@ flowchart LR
 | 
			
		||||
    9[Solid2d]
 | 
			
		||||
  end
 | 
			
		||||
  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 }]
 | 
			
		||||
    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 }]
 | 
			
		||||
    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 }]
 | 
			
		||||
    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 }]
 | 
			
		||||
    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 }]
 | 
			
		||||
    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 }]
 | 
			
		||||
    31[Solid2d]
 | 
			
		||||
  end
 | 
			
		||||
@ -55,9 +55,9 @@ flowchart LR
 | 
			
		||||
  21["SweepEdge Opposite"]
 | 
			
		||||
  22["SweepEdge Opposite"]
 | 
			
		||||
  23["SweepEdge Adjacent"]
 | 
			
		||||
  24["Plane<br>[1574, 1612, 0]"]
 | 
			
		||||
    %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 11 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }, CallKwUnlabeledArg]
 | 
			
		||||
  32["Sweep ExtrusionTwist<br>[2625, 2678, 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 }]
 | 
			
		||||
  32["Sweep ExtrusionTwist<br>[2561, 2614, 0]"]
 | 
			
		||||
    %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 12 }, ReturnStatementArg, PipeBodyItem { index: 1 }]
 | 
			
		||||
  33[Wall]
 | 
			
		||||
    %% face_code_ref=Missing NodePath
 | 
			
		||||
@ -79,10 +79,8 @@ flowchart LR
 | 
			
		||||
  44["SweepEdge Adjacent"]
 | 
			
		||||
  45["SweepEdge Opposite"]
 | 
			
		||||
  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 }]
 | 
			
		||||
  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
 | 
			
		||||
  2 --- 3
 | 
			
		||||
  2 --- 4
 | 
			
		||||
@ -137,7 +135,6 @@ flowchart LR
 | 
			
		||||
  21 <--x 16
 | 
			
		||||
  22 <--x 16
 | 
			
		||||
  24 --- 25
 | 
			
		||||
  24 <--x 48
 | 
			
		||||
  25 --- 26
 | 
			
		||||
  25 --- 27
 | 
			
		||||
  25 --- 28
 | 
			
		||||
 | 
			
		||||
@ -1429,70 +1429,20 @@ description: Result of parsing helical-gear.kcl
 | 
			
		||||
                                    "type": "CallExpressionKw",
 | 
			
		||||
                                    "type": "CallExpressionKw",
 | 
			
		||||
                                    "unlabeled": {
 | 
			
		||||
                                      "arguments": [
 | 
			
		||||
                                        {
 | 
			
		||||
                                          "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"
 | 
			
		||||
                                      },
 | 
			
		||||
                                      "abs_path": false,
 | 
			
		||||
                                      "commentStart": 0,
 | 
			
		||||
                                      "end": 0,
 | 
			
		||||
                                      "start": 0,
 | 
			
		||||
                                      "type": "CallExpressionKw",
 | 
			
		||||
                                      "type": "CallExpressionKw",
 | 
			
		||||
                                      "unlabeled": {
 | 
			
		||||
                                        "abs_path": false,
 | 
			
		||||
                                      "name": {
 | 
			
		||||
                                        "commentStart": 0,
 | 
			
		||||
                                        "end": 0,
 | 
			
		||||
                                        "name": {
 | 
			
		||||
                                          "commentStart": 0,
 | 
			
		||||
                                          "end": 0,
 | 
			
		||||
                                          "name": "XY",
 | 
			
		||||
                                          "start": 0,
 | 
			
		||||
                                          "type": "Identifier"
 | 
			
		||||
                                        },
 | 
			
		||||
                                        "path": [],
 | 
			
		||||
                                        "name": "XY",
 | 
			
		||||
                                        "start": 0,
 | 
			
		||||
                                        "type": "Name",
 | 
			
		||||
                                        "type": "Name"
 | 
			
		||||
                                      }
 | 
			
		||||
                                        "type": "Identifier"
 | 
			
		||||
                                      },
 | 
			
		||||
                                      "path": [],
 | 
			
		||||
                                      "start": 0,
 | 
			
		||||
                                      "type": "Name",
 | 
			
		||||
                                      "type": "Name"
 | 
			
		||||
                                    }
 | 
			
		||||
                                  },
 | 
			
		||||
                                  {
 | 
			
		||||
@ -2567,18 +2517,7 @@ description: Result of parsing helical-gear.kcl
 | 
			
		||||
                      },
 | 
			
		||||
                      "commentStart": 0,
 | 
			
		||||
                      "end": 0,
 | 
			
		||||
                      "params": [
 | 
			
		||||
                        {
 | 
			
		||||
                          "type": "Parameter",
 | 
			
		||||
                          "identifier": {
 | 
			
		||||
                            "commentStart": 0,
 | 
			
		||||
                            "end": 0,
 | 
			
		||||
                            "name": "offsetHeight",
 | 
			
		||||
                            "start": 0,
 | 
			
		||||
                            "type": "Identifier"
 | 
			
		||||
                          }
 | 
			
		||||
                        }
 | 
			
		||||
                      ],
 | 
			
		||||
                      "params": [],
 | 
			
		||||
                      "start": 0,
 | 
			
		||||
                      "type": "FunctionExpression",
 | 
			
		||||
                      "type": "FunctionExpression"
 | 
			
		||||
@ -2596,30 +2535,6 @@ description: Result of parsing helical-gear.kcl
 | 
			
		||||
                  "argument": {
 | 
			
		||||
                    "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": {
 | 
			
		||||
                          "abs_path": false,
 | 
			
		||||
                          "commentStart": 0,
 | 
			
		||||
@ -3128,17 +3043,6 @@ description: Result of parsing helical-gear.kcl
 | 
			
		||||
              "type": "newLine"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        ],
 | 
			
		||||
        "2": [
 | 
			
		||||
          {
 | 
			
		||||
            "commentStart": 0,
 | 
			
		||||
            "end": 0,
 | 
			
		||||
            "start": 0,
 | 
			
		||||
            "type": "NonCodeNode",
 | 
			
		||||
            "value": {
 | 
			
		||||
              "type": "newLine"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "startNodes": [
 | 
			
		||||
 | 
			
		||||
@ -710,24 +710,7 @@ description: Operations executed helical-gear.kcl
 | 
			
		||||
        "name": "helicalGearSketch",
 | 
			
		||||
        "functionSourceRange": [],
 | 
			
		||||
        "unlabeledArg": null,
 | 
			
		||||
        "labeledArgs": {
 | 
			
		||||
          "offsetHeight": {
 | 
			
		||||
            "value": {
 | 
			
		||||
              "type": "Number",
 | 
			
		||||
              "value": 0.0,
 | 
			
		||||
              "ty": {
 | 
			
		||||
                "type": "Default",
 | 
			
		||||
                "len": {
 | 
			
		||||
                  "type": "Mm"
 | 
			
		||||
                },
 | 
			
		||||
                "angle": {
 | 
			
		||||
                  "type": "Degrees"
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            "sourceRange": []
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        "labeledArgs": {}
 | 
			
		||||
      },
 | 
			
		||||
      "nodePath": {
 | 
			
		||||
        "steps": [
 | 
			
		||||
@ -759,83 +742,6 @@ description: Operations executed helical-gear.kcl
 | 
			
		||||
      },
 | 
			
		||||
      "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",
 | 
			
		||||
      "name": "startSketchOn",
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user