Clean KCL Samples and Update Walkie Talkie (#5904)

* Clean KCL Samples and Update Walkie Talkie

* revolve keyword args

* Update kcl-samples simulation test output

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Josh Gomez
2025-03-20 09:22:17 -07:00
committed by GitHub
parent 83ca08b26c
commit c8ec35cd4a
39 changed files with 8508 additions and 41757 deletions

View File

@ -5,8 +5,8 @@
@settings(defaultLengthUnit = in)
// Define constants
lbumps = 10 // number of bumps long
wbumps = 5 // number of bumps wide
lbumps = 4 // number of bumps long
wbumps = 2 // number of bumps wide
pitch = 8.0
clearance = 0.1
bumpDiam = 4.8

View File

@ -1,6 +1,7 @@
// Pipe with bend
// A tubular section or hollow cylinder, usually but not necessarily of circular cross-section, used mainly to convey substances that can flow.
// Set units
@settings(defaultLengthUnit = in)
@ -14,22 +15,14 @@ bendAngle = 90
sketch000 = startSketchOn("XZ")
// create a profile for the outer diameter
outerProfile = circle(
sketch000,
center = [bendRadius, 0],
radius = outerDiameter / 2
)
outerProfile = circle(sketch000, center = [bendRadius, 0], radius = outerDiameter / 2)
// create a profile for the inner diameter
innerProfile = circle(
sketch000,
center = [bendRadius, 0],
radius = innerDiameter / 2
)
innerProfile = circle(sketch000, center = [bendRadius, 0], radius = innerDiameter / 2)
// create the profile of the pipe
pipeProfile = outerProfile
|> hole(innerProfile, %)
// revolve the pipe profile at the desired angle
pipe = revolve(pipeProfile, axis = "Y", angle = bendAngle)
pipe = revolve(pipeProfile, axis = 'Y', angle = bendAngle)

View File

@ -1,9 +1,11 @@
// Poopy Shoe
// poop shute for bambu labs printer - optimized for printing.
// Set units
@settings(defaultLengthUnit = in)
wallThickness = 0.125
wallsWidth = 3
height = 5.125
@ -30,8 +32,7 @@ sketch001 = startSketchOn("-YZ")
|> yLine(endAbsolute = segEndY(seg01))
|> angledLineToY({ angle = 180 - 60, to = 0 }, %)
|> close()
part001 = revolve(
sketch001,
part001 = revolve(sketch001,
angle = 90,
axis = {
custom = {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -1,68 +1,64 @@
// Socket Head Cap Screw
// This is for a #10-24 screw that is 1.00 inches long. A socket head cap screw is a type of fastener that is widely used in a variety of applications requiring a high strength fastening solution. It is characterized by its cylindrical head and internal hexagonal drive, which allows for tightening with an Allen wrench or hex key.
// Set units
@settings(defaultLengthUnit = in)
// set units
@settings(defaultLengthUnit = in, defaultAngleUnit = deg)
// Define constants
screwLength = 1.0
screwDiameter = .190
headDiameter = .313
headLength = screwDiameter
hexWallToWall = 5 / 32
capRatio = screwDiameter / headDiameter
hexRatio = hexWallToWall / headDiameter
hexWallLength = hexWallToWall / 2 * 1 / cos(toRadians(30))
hexStartingAngle = 210 // first angle of hex pattern
hexInteriorAngle = 120
hexChangeAngle = 180 - hexInteriorAngle
export boltDiameter = 0.190
export boltLength = 1.00
export boltHeadLength = boltDiameter
export boltHeadDiameter = 0.313
export boltHexDrive = 5/32
export boltHexFlatLength = boltHexDrive / (2 * cos(toRadians(30)))
// Write a function that defines the Socket Head Cap Screw
fn capScrew(start, length, dia, capHeadLength) {
export fn bolt () {
// Create the head of the cap screw
screwHeadSketch = startSketchOn('XZ')
boltHead = startSketchOn('XZ')
|> circle(
center = [start[0], start[1]],
radius = dia / capRatio / 2
center = [0, 0],
radius = boltHeadDiameter / 2,
tag = $topEdge
)
// Extrude the screw head sketch
screwHead = extrude(screwHeadSketch, length = capHeadLength)
|> extrude(length = -boltHeadLength)
|> fillet(radius = 0.020, tags = [topEdge, getOppositeEdge(topEdge)])
// Define the sketch of the hex pattern on the screw head
hexPatternSketch = startSketchOn(screwHead, 'end')
|> startProfileAt([hexWallToWall / 2, 0], %)
|> yLine(length = -hexWallLength / 2)
hexPatternSketch = startSketchOn(boltHead, 'start')
|> startProfileAt([
boltHexDrive / 2,
boltHexFlatLength / 2
], %)
|> angledLine({
angle = hexStartingAngle,
length = hexWallLength
angle = 270,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = hexStartingAngle - hexChangeAngle,
length = hexWallLength
angle = 210,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = hexStartingAngle - (2 * hexChangeAngle),
length = hexWallLength
angle = 150,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = hexStartingAngle - (3 * hexChangeAngle),
length = hexWallLength
angle = 90,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = hexStartingAngle - (4 * hexChangeAngle),
length = hexWallLength
angle = 30,
length = boltHexFlatLength
}, %)
|> close()
hexPattern = extrude(hexPatternSketch, length = -headLength * 0.75)
|> extrude(length = -boltHeadLength * 0.75)
boltBody = startSketchOn(boltHead, 'end')
|> circle(center = [0, 0], radius = boltDiameter / 2, tag = $filletEdge)
|> extrude(length = boltLength)
|> fillet(radius = .020, tags = [getOppositeEdge(filletEdge)])
|> appearance(color = "#4dd043", metalness = 90, roughness = 90)
screwBodySketch = startSketchOn(screwHead, "start")
|> circle(
center = [start[0], start[1]],
radius = dia / 2
)
screwBody = extrude(screwBodySketch, length = length)
return screwBody
return boltBody
}
capScrew([0, 0], screwLength, screwDiameter, screwDiameter)
bolt()

View File

@ -1,50 +1,37 @@
// Antenna
// import constants
import antennaLength, antennaBaseWidth, antennaBaseHeight, antennaTopWidth, antennaTopHeight from "globals.kcl"
// Set units
@settings(defaultLengthUnit = in)
// import constants
import height, width, antennaBaseWidth, antennaBaseHeight, antennaTopWidth, antennaTopHeight from "globals.kcl"
// Calculate the origin
origin = [-width / 2 + .45, -0.10]
// Create the antenna
antennaX = origin[0]
antennaY = origin[1]
antennaPlane = {
plane = {
origin = { x = 0, y = 0, z = height / 2 },
xAxis = { x = 1, y = 0, z = 0 },
yAxis = { x = 0, y = 1, z = 0 },
zAxis = { x = 0, y = 0, z = 1 }
}
export fn antenna () {
// Create the antenna base sketch
sketch001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line(end = [antennaBaseWidth, 0])
|> line(end = [0, -antennaBaseHeight])
|> line(end = [-antennaBaseWidth, 0])
|> close()
// Create the antenna top sketch
loftPlane = offsetPlane('XY', offset = antennaLength)
sketch002 = startSketchOn(loftPlane)
|> startProfileAt([
(antennaBaseWidth - antennaTopWidth) / 2,
(antennaBaseHeight - antennaTopHeight) / 2
], %)
|> xLine(length = antennaTopWidth)
|> yLine(length = -antennaTopHeight)
|> xLine(length = -antennaTopWidth)
|> close()
// Create the antenna using a loft
antenna = loft([sketch001, sketch002])
|> appearance(color = "#000000")
return antenna
}
// Create the antenna base sketch
sketch001 = startSketchOn(antennaPlane)
|> startProfileAt([origin[0], origin[1]], %)
|> line(end = [antennaBaseWidth, 0])
|> line(end = [0, -antennaBaseHeight])
|> line(end = [-antennaBaseWidth, 0])
|> close()
// Create the antenna top sketch
loftPlane = offsetPlane('XY', offset = height / 2 + 2)
sketch002 = startSketchOn(loftPlane)
|> startProfileAt([
origin[0] + (antennaBaseWidth - antennaTopWidth) / 2,
origin[1] - ((antennaBaseHeight - antennaTopHeight) / 2)
], %)
|> xLine(length = antennaTopWidth)
|> yLine(length = -antennaTopHeight)
|> xLine(length = -antennaTopWidth)
|> close()
// Create the antenna using a loft
loft([sketch001, sketch002])
|> appearance(color = "#000000")

View File

@ -1,80 +1,86 @@
// Walkie talkie body
// Set units
@settings(defaultLengthUnit = in)
// Import constants
// 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)
]
)
// set units
@settings(defaultLengthUnit = in)
// 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 a function to define the body
export fn body () {
// 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)
// sketch and extrude the body of the walkie talkie
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)
]
)
// 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",
)
// cut out the indentation for the case
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()
body = extrude(sketch004, length = -.5)
|> appearance(
color = "#277bb0",
)
return body
}
body()

View File

@ -1,26 +1,27 @@
// Walkie Talkie button
// Set units
// set units
@settings(defaultLengthUnit = in)
// Import constants
import screenHeight, buttonWidth, tolerance, buttonHeight, buttonThickness from 'globals.kcl'
// import constants
import buttonWidth, buttonHeight, buttonThickness from 'globals.kcl'
// create a function to define the button
export fn button() {
// Create a function for the button
export fn button(origin, rotation, plane) {
buttonSketch = startSketchOn(plane)
|> startProfileAt([origin[0], origin[1]], %)
// sketch the button profile and extrude
buttonSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> angledLine({
angle = 180 + rotation,
angle = 180,
length = buttonWidth
}, %, $tag1)
|> angledLine({
angle = 270 + rotation,
angle = 270,
length = buttonHeight
}, %, $tag2)
|> angledLine({
angle = 0 + rotation,
angle = 0,
length = buttonWidth
}, %)
|> close()
@ -35,4 +36,4 @@ export fn button(origin, rotation, plane) {
|> appearance(color = "#ff0000")
return buttonExtrude
}
}

View File

@ -1,85 +1,90 @@
// Walkie talkie case
// Set units
@settings(defaultLengthUnit = in)
// Import constants and Zoo logo
// import constants and Zoo logo
import width, height, chamferLength, offset, screenWidth, screenHeight, screenYPosition, screenDepth, speakerBoxWidth, speakerBoxHeight, squareHoleSideLength, caseTolerance from "globals.kcl"
import zLogo, oLogo, oLogo2 from "zoo-logo.kcl"
plane = offsetPlane("XZ", offset = 1)
// set units
@settings(defaultLengthUnit = in)
fn screenHole(sketchStart) {
sketch006 = startSketchOn(sketchStart)
// create a function to define the case
export fn case () {
// sketch the profile of the screen
sketch006 = startSketchOn(startSketchOn('XZ'))
|> startProfileAt([-screenWidth / 2, screenYPosition], %)
|> xLine(length = screenWidth)
|> yLine(length = -screenHeight)
|> xLine(length = -screenWidth)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
return sketch006
}
fn squareHolePattern(plane, x, y) {
// create transform functions for the speaker grid pattern
fn transformX(i) {
return { translate = [.125 * i, 0] }
}
fn transformY(i) {
return { translate = [0, -.125 * i] }
}
squareHolePatternSketch = startSketchOn(plane)
|> startProfileAt([-x, -y], %)
// sketch the square hole grid pattern
squareHolePatternSketch = startSketchOn(startSketchOn('XZ'))
|> startProfileAt([-screenWidth / 2 + .100, 0], %)
|> line(end = [squareHoleSideLength / 2, 0])
|> line(end = [0, -squareHoleSideLength / 2])
|> line(end = [-squareHoleSideLength / 2, 0])
|> close()
|> patternTransform2d(instances = 13, transform = transformX)
|> patternTransform2d(instances = 11, transform = transformY)
return squareHolePatternSketch
}
sketch005 = startSketchOn(offsetPlane("XZ", offset = 1))
|> startProfileAt([
-width / 2 + offset + caseTolerance,
height / 2 - (chamferLength + (offset + caseTolerance) / 2 * cos(toRadians(45)))
], %)
|> angledLineToY({
angle = 45,
to = height / 2 - (offset + caseTolerance)
}, %)
|> line(endAbsolute = [
width / 2 - (chamferLength + (offset + caseTolerance) / 2 * cos(toRadians(45))),
height / 2 - (offset + caseTolerance)
])
|> angledLineToX({
angle = -45,
to = width / 2 - (offset + caseTolerance)
}, %)
|> line(endAbsolute = [
width / 2 - (offset + caseTolerance),
-(height / 2 - (chamferLength + (offset + caseTolerance) / 2 * cos(toRadians(45))))
])
|> angledLineToY({
angle = -135,
to = -height / 2 + offset + caseTolerance
}, %)
|> line(endAbsolute = [
-(width / 2 - (chamferLength + (offset + caseTolerance) / 2 * cos(toRadians(45)))),
-height / 2 + offset + caseTolerance
])
|> angledLineToX({
angle = -225,
to = -width / 2 + offset + caseTolerance
}, %)
|> close()
|> hole(screenHole(plane), %)
|> hole(squareHolePattern(plane, .75, .125), %)
|> hole(zLogo(plane, [-.30, -1.825], .20), %)
|> hole(oLogo(plane, [-.075, -1.825], .20), %)
|> hole(oLogo2(plane, [-.075, -1.825], .20), %)
|> hole(oLogo(plane, [.175, -1.825], .20), %)
|> hole(oLogo2(plane, [.175, -1.825], .20), %)
extrude(sketch005, length = -0.0625)
|> appearance(color = '#D0FF01', metalness = 0, roughness = 50)
// sketch the outer profile of the case and extrude with holes using the previously made profiles
sketch005 = startSketchOn(startSketchOn('XZ'))
|> startProfileAt([
-width / 2 + offset + caseTolerance,
height / 2 - (chamferLength + (offset + caseTolerance) / 2 * cos(toRadians(45)))
], %)
|> angledLineToY({
angle = 45,
to = height / 2 - (offset + caseTolerance)
}, %)
|> line(endAbsolute = [
width / 2 - (chamferLength + (offset + caseTolerance) / 2 * cos(toRadians(45))),
height / 2 - (offset + caseTolerance)
])
|> angledLineToX({
angle = -45,
to = width / 2 - (offset + caseTolerance)
}, %)
|> line(endAbsolute = [
width / 2 - (offset + caseTolerance),
-(height / 2 - (chamferLength + (offset + caseTolerance) / 2 * cos(toRadians(45))))
])
|> angledLineToY({
angle = -135,
to = -height / 2 + offset + caseTolerance
}, %)
|> line(endAbsolute = [
-(width / 2 - (chamferLength + (offset + caseTolerance) / 2 * cos(toRadians(45)))),
-height / 2 + offset + caseTolerance
])
|> angledLineToX({
angle = -225,
to = -width / 2 + offset + caseTolerance
}, %)
|> close()
|> hole(sketch006, %)
|> hole(squareHolePatternSketch, %)
// create the Zoo logo
|> hole(zLogo(startSketchOn('XZ'), [-.30, -1.825], .20), %)
|> hole(oLogo(startSketchOn('XZ'), [-.075, -1.825], .20), %)
|> hole(oLogo2(startSketchOn('XZ'), [-.075, -1.825], .20), %)
|> hole(oLogo(startSketchOn('XZ'), [.175, -1.825], .20), %)
|> hole(oLogo2(startSketchOn('XZ'), [.175, -1.825], .20), %)
case = extrude(sketch005, length = -0.0625)
|> appearance(color = '#D0FF01', metalness = 0, roughness = 50)
return case
}

View File

@ -21,6 +21,7 @@ export antennaBaseWidth = .5
export antennaBaseHeight = .25
export antennaTopWidth = .30
export antennaTopHeight = .05
export antennaLength = 3
// button
export buttonWidth = .15

View File

@ -1,29 +1,16 @@
// Walkie talkie knob
// Walkie Talkie Frequency Knob
// Set units
@settings(defaultLengthUnit = in)
// Import constants
// import constants
import width, thickness, height, knobDiameter, knobHeight, knobRadius from "globals.kcl"
// Define the plane for the knob
knobPlane = {
plane = {
origin = {
x = width / 2 - 0.70,
y = -thickness / 2,
z = height / 2
},
xAxis = { x = 1, y = 0, z = 0 },
yAxis = { x = 0, y = 0, z = 1 },
zAxis = { x = 0, y = 1, z = 0 }
}
}
// set units
@settings(defaultLengthUnit = in)
// create a function to define the knob
export fn knob () {
// Create the knob sketch and revolve
startSketchOn(knobPlane)
knob = startSketchOn('XZ')
|> startProfileAt([0.0001, 0], %)
|> xLine(length = knobDiameter / 2)
|> yLine(length = knobHeight - 0.05)
@ -34,5 +21,11 @@ startSketchOn(knobPlane)
}, %)
|> xLine(endAbsolute = 0.0001)
|> close()
|> revolve(axis = "Y")
|> revolve(
axis = "Y",
)
|> appearance(color = '#D0FF01', metalness = 90, roughness = 50)
return knob
}

View File

@ -1,50 +1,47 @@
// Walkie Talkie
// A portable, handheld two-way radio device that allows users to communicate wirelessly over short to medium distances. It operates on specific radio frequencies and features a push-to-talk button for transmitting messages, making it ideal for quick and reliable communication in outdoor, work, or emergency settings.
// Set units
// set units
@settings(defaultLengthUnit = in)
// Import parts and constants
import 'body.kcl'
import 'antenna.kcl'
import 'case.kcl'
import 'talk-button.kcl' as talkButton
import 'knob.kcl'
// import constants
import * from 'globals.kcl'
// import parts and constants
import body from 'body.kcl'
import case from 'case.kcl'
import antenna from 'antenna.kcl'
import talkButton from 'talk-button.kcl'
import knob from 'knob.kcl'
import button from "button.kcl"
import width, height, thickness, screenWidth, screenHeight, screenYPosition, tolerance from "globals.kcl"
// Import the body
body
// import the body
body()
// Import the case
case
// import the antenna
antenna()
|> translate(translate = [-width / 2 + .45, -0.10, height/2])
// Import the antenna
antenna
// import the case
case()
|> translate(translate = [0, -1, 0])
// Import the buttons
button([
-(screenWidth / 2 + tolerance),
screenYPosition
], 0, offsetPlane("XZ", offset = thickness))
button([
-(screenWidth / 2 + tolerance),
screenYPosition - (screenHeight / 2)
], 0, offsetPlane("XZ", offset = thickness))
button([
screenWidth / 2 + tolerance,
screenYPosition - screenHeight
], 180, offsetPlane("XZ", offset = thickness))
button([
screenWidth / 2 + tolerance,
screenYPosition - (screenHeight / 2)
], 180, offsetPlane("XZ", offset = thickness))
// Import the talk button
talkButton
// Import the frequency knob
knob
// import the talk button
talkButton()
|> translate(translate = [width / 2, -thickness / 2, .5])
// import the frequency knob
knob()
|> translate(translate = [width / 2 - 0.70, -thickness / 2, height / 2])
// import the buttons
button()
|> translate(translate = [-(screenWidth / 2 + tolerance), -1, screenYPosition])
button()
|> translate(translate = [-(screenWidth / 2 + tolerance), -1, screenYPosition - buttonHeight - tolerance*2])
button()
|> rotate(%, roll = 0, pitch = 180, yaw = 0)
|> translate(translate = [screenWidth / 2 + tolerance, -1, screenYPosition - buttonHeight], global = true)
button()
|> rotate(%, roll = 0, pitch = 180, yaw = 0)
|> translate(translate = [screenWidth / 2 + tolerance, -1, screenYPosition - buttonHeight*2 - tolerance * 2], global = true)

View File

@ -1,46 +1,37 @@
// Walkie talkie talk button
// Set units
// set units
@settings(defaultLengthUnit = in)
// Import constants
// import constants
import width, thickness, talkButtonSideLength, talkButtonHeight from "globals.kcl"
talkButtonPlane = {
plane = {
origin = {
x = width / 2,
y = -thickness / 2,
z = .5
},
xAxis = { x = 0, y = 1, z = 0 },
yAxis = { x = 0, y = 0, z = 1 },
zAxis = { x = 1, y = 0, z = 0 }
}
export fn talkButton() {
// create the talk button sketch
talkButtonSketch = startSketchOn('YZ')
|> startProfileAt([
-talkButtonSideLength / 2,
talkButtonSideLength / 2
], %)
|> xLine(length = talkButtonSideLength, tag = $tag1)
|> yLine(length = -talkButtonSideLength, tag = $tag2)
|> xLine(length = -talkButtonSideLength, tag = $tag3)
|> close(tag = $tag4)
// create the talk button and apply fillets
talkButton = extrude(talkButtonSketch, length = talkButtonHeight)
|> fillet(
radius = 0.050,
tags = [
getNextAdjacentEdge(tag1),
getNextAdjacentEdge(tag2),
getNextAdjacentEdge(tag3),
getNextAdjacentEdge(tag4)
]
)
|> appearance(color = '#D0FF01', metalness = 90, roughness = 90)
return talkButton
}
// Create the talk button sketch
talkButtonSketch = startSketchOn(talkButtonPlane)
|> startProfileAt([
-talkButtonSideLength / 2,
talkButtonSideLength / 2
], %)
|> xLine(length = talkButtonSideLength, tag = $tag1)
|> yLine(length = -talkButtonSideLength, tag = $tag2)
|> xLine(length = -talkButtonSideLength, tag = $tag3)
|> close(tag = $tag4)
// Create the talk button and apply fillets
extrude(talkButtonSketch, length = talkButtonHeight)
|> fillet(
radius = 0.050,
tags = [
getNextAdjacentEdge(tag1),
getNextAdjacentEdge(tag2),
getNextAdjacentEdge(tag3),
getNextAdjacentEdge(tag4)
]
)
|> appearance(color = '#D0FF01', metalness = 90, roughness = 90)

View File

@ -1,6 +1,6 @@
// Zoo logo
// Define a function to draw the ZOO "Z"
// define a function to draw the ZOO "Z"
export fn zLogo(surface, origin, scale) {
zSketch = surface
|> startProfileAt([
@ -39,7 +39,7 @@ export fn zLogo(surface, origin, scale) {
return zSketch
}
// Define a function to draw the ZOO "O"
// define a function to draw the ZOO "O"
export fn oLogo(surface, origin, scale) {
oSketch001 = surface
|> startProfileAt([