Compare commits

5 Commits

7 changed files with 241 additions and 52 deletions

View File

@@ -1,11 +1,14 @@
import cadquery as cq import cadquery as cq
stand_positions = [(0, 0), (58, 0), (58, 49), (0, 49)] from utils import extrude_shape, punch_hole2, hex_vents
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,16 +42,38 @@ 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,
},
] ]
vents = hex_vents(size=6, width=width, height=height)
# Hole distances are relative to the rightmost pillar # Hole distances are relative to the rightmost pillar
# seen from the back of the case, that's why they are negative # seen from the back of the case, that's why they are negative
# Heights are relative to base of pillars # Heights are relative to base of pillars
@@ -58,16 +83,69 @@ holes = [
{ {
"x": -15, "x": -15,
"y": -1 + pillar_height, "y": -1 + pillar_height,
"height": 6.5, "shape": cq.Sketch().trapezoid(12, 6.5, 90, mode="a").vertices().fillet(1),
"width": 12,
"fillet": 1,
}, },
# Power button # Power button
{ {
"x": -67, "x": -67,
"y": 5.5 + pillar_height, "y": 5.5 + pillar_height,
"height": 7, "shape": cq.Sketch().trapezoid(7, 7, 90, mode="a").vertices().fillet(1),
"width": 7,
"fillet": 1,
}, },
] ]
def add(
*,
model,
width,
height,
thickness,
offset_x,
offset_y,
bottom_face,
back_face,
shell_t
):
if bottom_face:
# Vents
for vent in vents:
model = punch_hole2(
model=model,
face=bottom_face,
w=width,
h=height,
x_offset=offset_x + vent["x"],
y_offset=shell_t + offset_y + vent["y"],
hole=vent,
depth=shell_t,
)
# Battery holder stands and pogo pin holder
for element in elements:
model = extrude_shape(
model=model,
face=bottom_face,
w=width,
h=height,
x_offset=offset_x + element["x"],
y_offset=shell_t + offset_y + element["y"],
shape=element["shape"],
height=-(element["height"] + shell_t),
)
if back_face:
# Holes
for hole in holes:
model = punch_hole2(
model=model,
face=back_face,
w=width,
h=thickness,
x_offset=width - offset_x,
y_offset=shell_t,
hole=hole,
depth=shell_t,
)
return model

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
@@ -153,19 +153,6 @@ def model():
# Now the basic box shape is in place, start adding things # Now the basic box shape is in place, start adding things
# and cutting holes. # and cutting holes.
# Holes in the back of the case for battery holder
for hole in battery_holder.holes:
model = punch_hole(
model=model,
face=">Y",
w=width,
h=thickness,
x_offset=width - battery_offset_x,
y_offset=shell_t,
hole=hole,
depth=shell_t,
)
# Hole for USB hub in the back # Hole for USB hub in the back
for hole in usb_hub.holes: for hole in usb_hub.holes:
model = punch_hole( model = punch_hole(
@@ -205,31 +192,30 @@ def model():
depth=shell_t, depth=shell_t,
) )
# Battery holder stands and pogo pin holder model = cpu_holder.add(
for element in battery_holder.elements: model=model,
model = extrude_shape( width=width,
model=model, height=height,
face="<Z", thickness=thickness,
w=width, offset_x=cpu_offset_x,
h=height, offset_y=cpu_offset_y,
x_offset=battery_offset_x + element["x"], bottom_face="<Z",
y_offset=shell_t + battery_offset_y + element["y"], back_face=None, # Not exposing the holes
shape=element["shape"], shell_t=shell_t,
height=-(element["height"] + shell_t), )
)
# CPU holder stands # This adds all the holes and extrusions for the battery system
for element in cpu_holder.elements: model = battery_holder.add(
model = extrude_shape( model=model,
model=model, width=width,
face="<Z", height=height,
w=width, thickness=thickness,
h=height, offset_x=battery_offset_x,
x_offset=cpu_offset_x + element["x"], offset_y=battery_offset_y,
y_offset=shell_t + cpu_offset_y + element["y"], bottom_face="<Z",
shape=element["shape"], back_face=">Y",
height=-(element["height"] + shell_t), shell_t=shell_t,
) )
return model return model

Binary file not shown.

View File

@@ -24,3 +24,33 @@ 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)
)
def hex_vents(*, size, width, height):
vent_positions = []
for x in range(1, width // size):
for y in range(1, int(height // size / 0.8)):
vent_positions.append(
(
(x + (y % 2) / 2) * size - size * 0.2,
y * size * 0.8 + size * 0.2,
)
)
vents = [
{
"x": 0,
"y": 0,
"shape": cq.Sketch().push(vent_positions).regularPolygon((size) / 2, 6),
}
]
return vents

View File

@@ -1,10 +1,18 @@
import cadquery as cq import cadquery as cq
positions = [(0, 0), (0, 23), (58, 23), (58, 0)] from utils import extrude_shape, punch_hole2, hex_vents
stands = cq.Sketch().push(positions).circle(3, mode="a").circle(2.65 / 2, mode="s") width = 65
height = 30
pillar_height = 7 pillar_height = 7
stand_positions = [(3.5, 3.5), (3.5, 26.5), (61.5, 26.5), (61.5, 3.5)]
stands = (
cq.Sketch().push(stand_positions).circle(3, mode="a").circle(2.65 / 2, mode="s")
)
elements = [ elements = [
# CPU holder stands # CPU holder stands
{ {
@@ -12,5 +20,92 @@ elements = [
"y": 0, "y": 0,
"shape": stands, "shape": stands,
"height": pillar_height, "height": pillar_height,
},
{
"x": 0,
"y": 0,
"shape": cq.Sketch().push(stand_positions).circle(5),
"height": 0,
},
# 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,
},
]
vents = hex_vents(size=6, width=width, height=height)
holes = [
# One hole for everything TODO: improve
{
"x": -width / 2,
"y": 1 + pillar_height,
"shape": cq.Sketch().trapezoid(50, 6, 90, mode="a").vertices().fillet(1),
} }
] ]
def add(
*,
model,
width,
height,
thickness,
offset_x,
offset_y,
bottom_face,
back_face,
shell_t
):
if bottom_face:
# Vents
for vent in vents:
model = punch_hole2(
model=model,
face=bottom_face,
w=width,
h=height,
x_offset=offset_x + vent["x"],
y_offset=shell_t + offset_y + vent["y"],
hole=vent,
depth=shell_t,
)
# CPU holder extrusions
for element in elements:
model = extrude_shape(
model=model,
face=bottom_face,
w=width,
h=height,
x_offset=offset_x + element["x"],
y_offset=shell_t + offset_y + element["y"],
shape=element["shape"],
height=-(element["height"] + shell_t),
)
# Holes
if back_face:
for hole in holes:
model = punch_hole2(
model=model,
face=back_face,
w=width,
h=thickness,
x_offset=width - offset_x,
y_offset=shell_t,
hole=hole,
depth=shell_t,
)
return model