Compare commits

..

2 Commits

Author SHA1 Message Date
9904a412a3 Refactor hex vents into helper function 2023-03-15 11:17:39 -03:00
d64654f7b1 Added hole support for CPU holder 2023-03-15 10:46:36 -03:00
4 changed files with 106 additions and 108 deletions

View File

@@ -1,6 +1,6 @@
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)]
stands = (
@@ -71,24 +71,7 @@ elements = [
]
hex_size = 6
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),
}
]
vents = hex_vents(size=6, width=width, height=height)
# Hole distances are relative to the rightmost pillar
@@ -124,6 +107,7 @@ def add(
shell_t
):
if bottom_face:
# Vents
for vent in vents:
model = punch_hole2(
@@ -150,6 +134,7 @@ def add(
height=-(element["height"] + shell_t),
)
if back_face:
# Holes
for hole in holes:
model = punch_hole2(

View File

@@ -200,7 +200,7 @@ def model():
offset_x=cpu_offset_x,
offset_y=cpu_offset_y,
bottom_face="<Z",
back_face=None,
back_face=None, # Not exposing the holes
shell_t=shell_t,
)

View File

@@ -34,3 +34,23 @@ def punch_hole2(*, model, face, w, h, x_offset, y_offset, hole, depth):
.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,6 +1,6 @@
import cadquery as cq
from utils import extrude_shape, punch_hole2
from utils import extrude_shape, punch_hole2, hex_vents
width = 65
height = 30
@@ -42,26 +42,17 @@ elements = [
},
]
hex_size = 6
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 = [
vents = hex_vents(size=6, width=width, height=height)
holes = [
# One hole for everything TODO: improve
{
"x": 0,
"y": 0,
"shape": cq.Sketch().push(vent_positions).regularPolygon((hex_size) / 2, 6),
"x": -width / 2,
"y": 1 + pillar_height,
"shape": cq.Sketch().trapezoid(50, 6, 90, mode="a").vertices().fillet(1),
}
]
holes = [] # TODO
def add(
*,
@@ -76,6 +67,7 @@ def add(
shell_t
):
if bottom_face:
# Vents
for vent in vents:
model = punch_hole2(
@@ -103,6 +95,7 @@ def add(
)
# Holes
if back_face:
for hole in holes:
model = punch_hole2(
model=model,