Previously, `xLine`, `xLineTo`, `yLine` and `yLineTo` used positional arguments. Now: - `xLineTo` and `yLineTo` have been removed - `xLine` and `yLine` both use keyword arguments: - `length`, optional (i.e. a relative distance along the X or Y axis) - `endAbsolute` optional (i.e. an absolute point along the X or Y axis) - `tag` optional - Exactly one of `length` or `endAbsolute` must be given. Not both, not neither. For example: ``` // Old way |> xLine(6.04, %) |> yLineTo(20, %, $base) // New way |> xLine(length = 6.04) |> yLine(endAbsolute = 20, tag = $base) ``` This also improves some of the general-purpose keyword arguments code in modeling app's TS codebase.
43 lines
1.3 KiB
Plaintext
43 lines
1.3 KiB
Plaintext
// Lug Nut
|
|
// lug Nuts are essential components used to create secure connections, whether for electrical purposes, like terminating wires or grounding, or for mechanical purposes, such as providing mounting points or reinforcing structural joints.
|
|
|
|
|
|
// Set units
|
|
@settings(defaultLengthUnit = in)
|
|
|
|
|
|
// Import Constants
|
|
import lugDiameter, lugHeadLength, lugThreadDiameter, lugLength, lugThreadDepth, lugSpacing from "globals.kcl"
|
|
|
|
customPlane = {
|
|
plane = {
|
|
origin = {
|
|
x = lugSpacing / 2,
|
|
y = -30 * mm(),
|
|
z = 0
|
|
},
|
|
xAxis = { x = 1, y = 0, z = 0 },
|
|
yAxis = { x = 0, y = -1, z = 0 },
|
|
zAxis = { x = 0, y = 0, z = 1 }
|
|
}
|
|
}
|
|
|
|
fn lug(plane, length, diameter) {
|
|
lugSketch = startSketchOn(customPlane)
|
|
|> startProfileAt([0 + diameter / 2, 0], %)
|
|
|> angledLineOfYLength({ angle = 70, length = lugHeadLength }, %)
|
|
|> xLine(endAbsolute = lugDiameter / 2)
|
|
|> yLine(endAbsolute = lugLength)
|
|
|> tangentialArc({ offset = 90, radius = 3 * mm() }, %)
|
|
|> xLine(endAbsolute = 0 + .001, tag = $c1)
|
|
|> yLine(endAbsolute = lugThreadDepth)
|
|
|> xLine(endAbsolute = lugThreadDiameter)
|
|
|> yLine(endAbsolute = 0)
|
|
|> close()
|
|
|> revolve({ axis = "Y" }, %)
|
|
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)
|
|
return lugSketch
|
|
}
|
|
|
|
lug(customPlane, lugLength, lugDiameter)
|