Compare commits
2 Commits
4f1b09ab95
...
9904a412a3
Author | SHA1 | Date | |
---|---|---|---|
9904a412a3 | |||
d64654f7b1 |
@@ -1,6 +1,6 @@
|
|||||||
import cadquery as cq
|
import cadquery as cq
|
||||||
|
|
||||||
from utils import extrude_shape, punch_hole, punch_hole2
|
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)]
|
stand_positions = [(3.5, 3.5), (61.5, 3.5), (61.5, 52.5), (3.5, 52.5)]
|
||||||
stands = (
|
stands = (
|
||||||
@@ -71,24 +71,7 @@ elements = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
hex_size = 6
|
vents = hex_vents(size=6, width=width, height=height)
|
||||||
vent_positions = []
|
|
||||||
for x in range(1, width // hex_size):
|
|
||||||
for y in range(1, int(height // hex_size / 0.8)):
|
|
||||||
vent_positions.append(
|
|
||||||
(
|
|
||||||
(x + (y % 2) / 2) * hex_size - hex_size * 0.2,
|
|
||||||
y * hex_size * 0.8 + hex_size * 0.2,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
vents = [
|
|
||||||
{
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"shape": cq.Sketch().push(vent_positions).regularPolygon((hex_size) / 2, 6),
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# Hole distances are relative to the rightmost pillar
|
# Hole distances are relative to the rightmost pillar
|
||||||
@@ -124,43 +107,45 @@ def add(
|
|||||||
shell_t
|
shell_t
|
||||||
):
|
):
|
||||||
|
|
||||||
# Vents
|
if bottom_face:
|
||||||
for vent in vents:
|
# Vents
|
||||||
model = punch_hole2(
|
for vent in vents:
|
||||||
model=model,
|
model = punch_hole2(
|
||||||
face=bottom_face,
|
model=model,
|
||||||
w=width,
|
face=bottom_face,
|
||||||
h=height,
|
w=width,
|
||||||
x_offset=offset_x + vent["x"],
|
h=height,
|
||||||
y_offset=shell_t + offset_y + vent["y"],
|
x_offset=offset_x + vent["x"],
|
||||||
hole=vent,
|
y_offset=shell_t + offset_y + vent["y"],
|
||||||
depth=shell_t,
|
hole=vent,
|
||||||
)
|
depth=shell_t,
|
||||||
|
)
|
||||||
|
|
||||||
# Battery holder stands and pogo pin holder
|
# Battery holder stands and pogo pin holder
|
||||||
for element in elements:
|
for element in elements:
|
||||||
model = extrude_shape(
|
model = extrude_shape(
|
||||||
model=model,
|
model=model,
|
||||||
face=bottom_face,
|
face=bottom_face,
|
||||||
w=width,
|
w=width,
|
||||||
h=height,
|
h=height,
|
||||||
x_offset=offset_x + element["x"],
|
x_offset=offset_x + element["x"],
|
||||||
y_offset=shell_t + offset_y + element["y"],
|
y_offset=shell_t + offset_y + element["y"],
|
||||||
shape=element["shape"],
|
shape=element["shape"],
|
||||||
height=-(element["height"] + shell_t),
|
height=-(element["height"] + shell_t),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Holes
|
if back_face:
|
||||||
for hole in holes:
|
# Holes
|
||||||
model = punch_hole2(
|
for hole in holes:
|
||||||
model=model,
|
model = punch_hole2(
|
||||||
face=back_face,
|
model=model,
|
||||||
w=width,
|
face=back_face,
|
||||||
h=thickness,
|
w=width,
|
||||||
x_offset=width - offset_x,
|
h=thickness,
|
||||||
y_offset=shell_t,
|
x_offset=width - offset_x,
|
||||||
hole=hole,
|
y_offset=shell_t,
|
||||||
depth=shell_t,
|
hole=hole,
|
||||||
)
|
depth=shell_t,
|
||||||
|
)
|
||||||
|
|
||||||
return model
|
return model
|
||||||
|
@@ -200,7 +200,7 @@ def model():
|
|||||||
offset_x=cpu_offset_x,
|
offset_x=cpu_offset_x,
|
||||||
offset_y=cpu_offset_y,
|
offset_y=cpu_offset_y,
|
||||||
bottom_face="<Z",
|
bottom_face="<Z",
|
||||||
back_face=None,
|
back_face=None, # Not exposing the holes
|
||||||
shell_t=shell_t,
|
shell_t=shell_t,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -34,3 +34,23 @@ def punch_hole2(*, model, face, w, h, x_offset, y_offset, hole, depth):
|
|||||||
.placeSketch(hole["shape"])
|
.placeSketch(hole["shape"])
|
||||||
.cutBlind(-depth)
|
.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
|
@@ -1,6 +1,6 @@
|
|||||||
import cadquery as cq
|
import cadquery as cq
|
||||||
|
|
||||||
from utils import extrude_shape, punch_hole2
|
from utils import extrude_shape, punch_hole2, hex_vents
|
||||||
|
|
||||||
width = 65
|
width = 65
|
||||||
height = 30
|
height = 30
|
||||||
@@ -42,26 +42,17 @@ elements = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
hex_size = 6
|
vents = hex_vents(size=6, width=width, height=height)
|
||||||
vent_positions = []
|
|
||||||
for x in range(1, width // hex_size):
|
holes = [
|
||||||
for y in range(1, int(height // hex_size / 0.8)):
|
# One hole for everything TODO: improve
|
||||||
vent_positions.append(
|
|
||||||
(
|
|
||||||
(x + (y % 2) / 2) * hex_size - hex_size * 0.2,
|
|
||||||
y * hex_size * 0.8 + hex_size * 0.2,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
vents = [
|
|
||||||
{
|
{
|
||||||
"x": 0,
|
"x": -width / 2,
|
||||||
"y": 0,
|
"y": 1 + pillar_height,
|
||||||
"shape": cq.Sketch().push(vent_positions).regularPolygon((hex_size) / 2, 6),
|
"shape": cq.Sketch().trapezoid(50, 6, 90, mode="a").vertices().fillet(1),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
holes = [] # TODO
|
|
||||||
|
|
||||||
|
|
||||||
def add(
|
def add(
|
||||||
*,
|
*,
|
||||||
@@ -76,43 +67,45 @@ def add(
|
|||||||
shell_t
|
shell_t
|
||||||
):
|
):
|
||||||
|
|
||||||
# Vents
|
if bottom_face:
|
||||||
for vent in vents:
|
# Vents
|
||||||
model = punch_hole2(
|
for vent in vents:
|
||||||
model=model,
|
model = punch_hole2(
|
||||||
face=bottom_face,
|
model=model,
|
||||||
w=width,
|
face=bottom_face,
|
||||||
h=height,
|
w=width,
|
||||||
x_offset=offset_x + vent["x"],
|
h=height,
|
||||||
y_offset=shell_t + offset_y + vent["y"],
|
x_offset=offset_x + vent["x"],
|
||||||
hole=vent,
|
y_offset=shell_t + offset_y + vent["y"],
|
||||||
depth=shell_t,
|
hole=vent,
|
||||||
)
|
depth=shell_t,
|
||||||
|
)
|
||||||
|
|
||||||
# CPU holder extrusions
|
# CPU holder extrusions
|
||||||
for element in elements:
|
for element in elements:
|
||||||
model = extrude_shape(
|
model = extrude_shape(
|
||||||
model=model,
|
model=model,
|
||||||
face=bottom_face,
|
face=bottom_face,
|
||||||
w=width,
|
w=width,
|
||||||
h=height,
|
h=height,
|
||||||
x_offset=offset_x + element["x"],
|
x_offset=offset_x + element["x"],
|
||||||
y_offset=shell_t + offset_y + element["y"],
|
y_offset=shell_t + offset_y + element["y"],
|
||||||
shape=element["shape"],
|
shape=element["shape"],
|
||||||
height=-(element["height"] + shell_t),
|
height=-(element["height"] + shell_t),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Holes
|
# Holes
|
||||||
for hole in holes:
|
if back_face:
|
||||||
model = punch_hole2(
|
for hole in holes:
|
||||||
model=model,
|
model = punch_hole2(
|
||||||
face=back_face,
|
model=model,
|
||||||
w=width,
|
face=back_face,
|
||||||
h=thickness,
|
w=width,
|
||||||
x_offset=width - offset_x,
|
h=thickness,
|
||||||
y_offset=shell_t,
|
x_offset=width - offset_x,
|
||||||
hole=hole,
|
y_offset=shell_t,
|
||||||
depth=shell_t,
|
hole=hole,
|
||||||
)
|
depth=shell_t,
|
||||||
|
)
|
||||||
|
|
||||||
return model
|
return model
|
||||||
|
Reference in New Issue
Block a user