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.
81 lines
2.4 KiB
Plaintext
81 lines
2.4 KiB
Plaintext
// Walkie talkie body
|
|
|
|
|
|
// Set units
|
|
@settings(defaultLengthUnit = in)
|
|
|
|
|
|
// Import constants
|
|
import height, width, thickness, chamferLength, offset, screenWidth, screenHeight, screenYPosition, screenDepth, speakerBoxWidth, speakerBoxHeight from "globals.kcl"
|
|
|
|
bodySketch = startSketchOn('XZ')
|
|
|> startProfileAt([-width / 2, height / 2], %)
|
|
|> xLine(length = width, tag = $chamfer1)
|
|
|> yLine(length = -height, tag = $chamfer2)
|
|
|> xLine(length = -width, tag = $chamfer3)
|
|
|> close(tag = $chamfer4)
|
|
bodyExtrude = extrude(bodySketch, length = thickness)
|
|
|> chamfer(
|
|
length = chamferLength,
|
|
tags = [
|
|
getNextAdjacentEdge(chamfer1),
|
|
getNextAdjacentEdge(chamfer2),
|
|
getNextAdjacentEdge(chamfer3),
|
|
getNextAdjacentEdge(chamfer4)
|
|
]
|
|
)
|
|
|
|
// Define the offset for the indentation
|
|
sketch002 = startSketchOn(bodyExtrude, 'END')
|
|
|> startProfileAt([
|
|
-width / 2 + offset,
|
|
height / 2 - (chamferLength + offset / 2 * cos(toRadians(45)))
|
|
], %)
|
|
|> angledLineToY({ angle = 45, to = height / 2 - offset }, %)
|
|
|> line(endAbsolute = [
|
|
width / 2 - (chamferLength + offset / 2 * cos(toRadians(45))),
|
|
height / 2 - offset
|
|
])
|
|
|> angledLineToX({ angle = -45, to = width / 2 - offset }, %)
|
|
|> line(endAbsolute = [
|
|
width / 2 - offset,
|
|
-(height / 2 - (chamferLength + offset / 2 * cos(toRadians(45))))
|
|
])
|
|
|> angledLineToY({
|
|
angle = -135,
|
|
to = -height / 2 + offset
|
|
}, %)
|
|
|> line(endAbsolute = [
|
|
-(width / 2 - (chamferLength + offset / 2 * cos(toRadians(45)))),
|
|
-height / 2 + offset
|
|
])
|
|
|> angledLineToX({
|
|
angle = -225,
|
|
to = -width / 2 + offset
|
|
}, %)
|
|
|> close()
|
|
extrude002 = extrude(sketch002, length = -0.0625)
|
|
|
|
// Create the pocket for the screen
|
|
sketch003 = startSketchOn(extrude002, 'start')
|
|
|> startProfileAt([-screenWidth / 2, screenYPosition], %)
|
|
|> xLine(length = screenWidth, tag = $seg01)
|
|
|> yLine(length = -screenHeight)
|
|
|> xLine(length = -segLen(seg01))
|
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
|> close()
|
|
extrude003 = extrude(sketch003, length = screenDepth)
|
|
|
|
// Create the speaker box
|
|
sketch004 = startSketchOn(extrude002, 'start')
|
|
|> startProfileAt([-1.25 / 2, -.125], %)
|
|
|> xLine(length = speakerBoxWidth)
|
|
|> yLine(length = -speakerBoxHeight)
|
|
|> xLine(length = -speakerBoxWidth)
|
|
|> close()
|
|
extrude(sketch004, length = -.5)
|
|
|> appearance(
|
|
color = "#277bb0",
|
|
)
|
|
|