Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz committed Jan 30, 2025
1 parent 2ac4c79 commit 0d70c91
Show file tree
Hide file tree
Showing 9 changed files with 256 additions and 282 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zoo-kcl"
version = "0.2.1"
version = "0.2.2"
edition = "2021"
repository = "https://github.com/kittycad/kcl.py"

Expand All @@ -11,7 +11,7 @@ crate-type = ["cdylib"]

[dependencies]
anyhow = "1.0.95"
kcl-lib = { version = "0.2.31", features = [
kcl-lib = { version = "0.2.32", features = [
"pyo3",
"engine",
"disable-println",
Expand Down
66 changes: 31 additions & 35 deletions files/walkie-talkie/antenna.kcl
Original file line number Diff line number Diff line change
@@ -1,45 +1,41 @@
// Antenna


// import constants
import height, width, antennaBaseWidth, antennaBaseHeight, antennaTopWidth, antennaTopHeight from 'globals.kcl'

// Create the function for the antenna
export fn antenna (origin) {
antennaX = origin[0]
antennaY = origin[1]
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 }
}
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 }
}

sketch001 = startSketchOn(antennaPlane)
|> startProfileAt([origin[0], origin[1]], %)
|> line([antennaBaseWidth, 0], %)
|> line([0, -antennaBaseHeight], %)
|> line([-antennaBaseWidth, 0], %)
|> close(%)

loftPlane = offsetPlane('XY', height/2 + 3)

sketch002 = startSketchOn(loftPlane)
|> startProfileAt([origin[0] + (antennaBaseWidth - antennaTopWidth)/2, origin[1] - (antennaBaseHeight - antennaTopHeight)/2], %)
|> xLine(antennaTopWidth, %)
|> yLine(-antennaTopHeight, %)
|> xLine(-antennaTopWidth, %)
|> close(%)
}

antennaLoft = loft([sketch001, sketch002])
sketch001 = startSketchOn(antennaPlane)
|> startProfileAt([origin[0], origin[1]], %)
|> line([antennaBaseWidth, 0], %)
|> line([0, -antennaBaseHeight], %)
|> line([-antennaBaseWidth, 0], %)
|> close(%)

return antennaLoft
loftPlane = offsetPlane('XY', height/2 + 3)

sketch002 = startSketchOn(loftPlane)
|> startProfileAt([origin[0] + (antennaBaseWidth - antennaTopWidth)/2, origin[1] - (antennaBaseHeight - antennaTopHeight)/2], %)
|> xLine(antennaTopWidth, %)
|> yLine(-antennaTopHeight, %)
|> xLine(-antennaTopWidth, %)
|> close(%)

}
export antenna = loft([sketch001, sketch002])
166 changes: 81 additions & 85 deletions files/walkie-talkie/body.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,93 +4,89 @@
import height, width, thickness, chamferLength, offset, screenWidth, screenHeight, screenYPosition, screenDepth, speakerBoxWidth, speakerBoxHeight from "globals.kcl"

// Create a function for the body
export fn body() {
bodySketch = startSketchOn('XZ')
|> startProfileAt([-width / 2, height / 2], %)
|> xLine(width, %, $chamfer1)
|> yLine(-height, %, $chamfer2)
|> xLine(-width, %, $chamfer3)
|> close(%, $chamfer4)
bodyExtrude = extrude(thickness, bodySketch)
|> chamfer({
length = chamferLength,
tags = [
getNextAdjacentEdge(chamfer1),
getNextAdjacentEdge(chamfer2),
getNextAdjacentEdge(chamfer3),
getNextAdjacentEdge(chamfer4)
]
}, %)
// |> appearance({
// color = '#707980',
// metalness = 90,
// roughness = 90
// }, %)


bodySketch = startSketchOn('XZ')
|> startProfileAt([-width / 2, height / 2], %)
|> xLine(width, %, $chamfer1)
|> yLine(-height, %, $chamfer2)
|> xLine(-width, %, $chamfer3)
|> close(%, $chamfer4)
bodyExtrude = extrude(thickness, bodySketch)
|> chamfer({
length = chamferLength,
tags = [
getNextAdjacentEdge(chamfer1),
getNextAdjacentEdge(chamfer2),
getNextAdjacentEdge(chamfer3),
getNextAdjacentEdge(chamfer4)
]
}, %)
// |> appearance({
// color = '#707980',
// metalness = 90,
// roughness = 90
// }, %)

// 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 }, %)
|> lineTo([
width / 2 - (chamferLength + offset / 2 * cos(toRadians(45))),
height / 2 - offset
], %)
|> angledLineToX({ angle = -45, to = width / 2 - offset }, %)
|> lineTo([
width / 2 - offset,
-(height / 2 - (chamferLength + offset / 2 * cos(toRadians(45))))
], %)
|> angledLineToY({
angle = -135,
to = -height / 2 + offset
}, %)
|> lineTo([
-(width / 2 - (chamferLength + offset / 2 * cos(toRadians(45)))),
-height / 2 + offset
], %)
|> angledLineToX({
angle = -225,
to = -width / 2 + offset
}, %)
|> close(%)
extrude002 = extrude(-0.0625, sketch002)
// |> appearance({
// color = '#707980',
// metalness = 90,
// roughness = 90
// }, %)


// Create the pocket for the screen
sketch003 = startSketchOn(extrude002, 'start')
|> startProfileAt([-screenWidth / 2, screenYPosition], %)
|> xLine(screenWidth, %, $seg01)
|> yLine(-screenHeight, %)
|> xLine(-segLen(seg01), %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
extrude003 = extrude(screenDepth, sketch003)
// |> appearance({
// color = '#707980',
// metalness = 90,
// roughness = 90
// }, %)

// 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 }, %)
|> lineTo([
width / 2 - (chamferLength + offset / 2 * cos(toRadians(45))),
height / 2 - offset
], %)
|> angledLineToX({ angle = -45, to = width / 2 - offset }, %)
|> lineTo([
width / 2 - offset,
-(height / 2 - (chamferLength + offset / 2 * cos(toRadians(45))))
], %)
|> angledLineToY({
angle = -135,
to = -height / 2 + offset
}, %)
|> lineTo([
-(width / 2 - (chamferLength + offset / 2 * cos(toRadians(45)))),
-height / 2 + offset
], %)
|> angledLineToX({
angle = -225,
to = -width / 2 + offset
}, %)
|> close(%)
extrude002 = extrude(-0.0625, sketch002)
// |> appearance({
// color = '#707980',
// metalness = 90,
// roughness = 90
// }, %)


// Create the pocket for the screen
sketch003 = startSketchOn(extrude002, 'start')
|> startProfileAt([-screenWidth / 2, screenYPosition], %)
|> xLine(screenWidth, %, $seg01)
|> yLine(-screenHeight, %)
|> xLine(-segLen(seg01), %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
extrude003 = extrude(screenDepth, sketch003)
// |> appearance({
// color = '#707980',
// metalness = 90,
// roughness = 90
// }, %)


// Create the speaker box
sketch004 = startSketchOn(extrude002, 'start')
|> startProfileAt([-1.25 / 2, -.125], %)
|> xLine(speakerBoxWidth, %)
|> yLine(-speakerBoxHeight, %)
|> xLine(-speakerBoxWidth, %)
|> close(%)

extrude004 = extrude(-.5, sketch004)
// Create the speaker box
sketch004 = startSketchOn(extrude002, 'start')
|> startProfileAt([-1.25 / 2, -.125], %)
|> xLine(speakerBoxWidth, %)
|> yLine(-speakerBoxHeight, %)
|> xLine(-speakerBoxWidth, %)
|> close(%)

return extrude004
}
export body = extrude(-.5, sketch004)
2 changes: 1 addition & 1 deletion files/walkie-talkie/button.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ export fn button(origin, rotation, plane) {
}, %)

return buttonExtrude
}
}
Loading

0 comments on commit 0d70c91

Please sign in to comment.