Fancy battery holder design

This commit is contained in:
Roberto Alsina 2023-03-08 17:24:43 -03:00
parent 4037ac4a1a
commit 7aeb2cc0c1
5 changed files with 70 additions and 7 deletions

View File

@ -1,11 +1,12 @@
import cadquery as cq import cadquery as cq
stand_positions = [(0, 0), (58, 0), (58, 49), (0, 49)] stand_positions = [(3.5, 3.5), (61.5, 3.5), (61.5, 52.5), (3.5, 52.5)]
stands = ( stands = (
cq.Sketch().push(stand_positions).circle(3, mode="a").circle(2.65 / 2, mode="s") cq.Sketch().push(stand_positions).circle(3, mode="a").circle(2.65 / 2, mode="s")
) )
pillar_height = 7 pillar_height = 7
width = 85
height = 56
# This is a holder for DuPont cables so they connect to this # This is a holder for DuPont cables so they connect to this
# things' pogo pins which are used to power the CPU # things' pogo pins which are used to power the CPU
@ -39,13 +40,53 @@ elements = [
"shape": stands, "shape": stands,
"height": pillar_height, "height": pillar_height,
}, },
# Pogo pin connector channels
{ {
"x": 0, "x": 0,
"y": 40, "y": 0,
"shape": cq.Sketch().push(stand_positions).circle(5),
"height": 0,
},
# Pogo pin connector channels
{
"x": 3.5,
"y": 43.5,
"shape": pin_holder, "shape": pin_holder,
"height": 3, "height": 3,
}, },
# Perimeter
{
"x": width / 2,
"y": height / 2,
"shape": (
cq.Sketch()
.trapezoid(width, height, 90, mode="a")
.trapezoid(width - 2, height - 2, 90, mode="s")
.vertices()
.fillet(3)
),
"height": 0.2,
},
]
hex_size = width // 13
vent_positions = []
for x in range(1, width // hex_size):
for y in range(0, int(height // hex_size / 0.8) - 1):
vent_positions.append(
(
(x + (y % 2) / 2) * hex_size - hex_size * 0.2,
y * hex_size * 0.8 + hex_size * 0.2,
)
)
vents = cq.Sketch().push(vent_positions).regularPolygon((hex_size) / 2, 6)
vents = [
{
"x": 0,
"y": 0,
"shape": vents,
}
] ]

Binary file not shown.

Binary file not shown.

View File

@ -5,7 +5,7 @@ import audio_plug
import battery_holder import battery_holder
import usb_hub import usb_hub
import zero_holder as cpu_holder import zero_holder as cpu_holder
from utils import extrude_shape, punch_hole from utils import extrude_shape, punch_hole, punch_hole2
# Base for the notebook. Basically a kbd base that extends back # Base for the notebook. Basically a kbd base that extends back
# as much as possible # as much as possible
@ -89,8 +89,8 @@ cpu_offset_x = 160
cpu_offset_y = 25 cpu_offset_y = 25
# Battery holder position from back-left corner of the case # Battery holder position from back-left corner of the case
battery_offset_x = 22 battery_offset_x = 19
battery_offset_y = 8 battery_offset_y = 5
# Offset for the USB port from back-right corner of the case # Offset for the USB port from back-right corner of the case
usb_offset = 48 usb_offset = 48
@ -205,6 +205,18 @@ def model():
depth=shell_t, depth=shell_t,
) )
for vent in battery_holder.vents:
model = punch_hole2(
model=model,
face="<Z",
w=width,
h=height,
x_offset=battery_offset_x + element["x"],
y_offset=shell_t + battery_offset_y + element["y"],
hole=vent,
depth=shell_t,
)
# Battery holder stands and pogo pin holder # Battery holder stands and pogo pin holder
for element in battery_holder.elements: for element in battery_holder.elements:
model = extrude_shape( model = extrude_shape(

View File

@ -24,3 +24,13 @@ def punch_hole(*, model, face, w, h, x_offset, y_offset, hole, depth):
) )
.cutBlind(-depth) .cutBlind(-depth)
) )
def punch_hole2(*, model, face, w, h, x_offset, y_offset, hole, depth):
return (
model.faces(face)
.workplane(centerOption="CenterOfBoundBox")
.center(-w / 2 + x_offset + hole["x"], -h / 2 + y_offset + hole["y"])
.placeSketch(hole["shape"])
.cutBlind(-depth)
)