2023-03-01 18:47:06 +00:00
|
|
|
# Hole to expose a USB audio card (YMMV)
|
|
|
|
|
2023-03-20 16:19:14 +00:00
|
|
|
import cadquery as cq
|
|
|
|
|
|
|
|
from utils import punch_hole2, extrude_shape2
|
|
|
|
|
|
|
|
# The hole is for a random USB sound card.
|
2023-03-01 18:47:06 +00:00
|
|
|
# Consumers should set proper offsets for the hole
|
|
|
|
|
|
|
|
holes = [
|
|
|
|
# 2-jack plug
|
|
|
|
{
|
|
|
|
"x": 0,
|
|
|
|
"y": 4,
|
2023-03-20 16:19:14 +00:00
|
|
|
"shape": cq.Sketch().trapezoid(17, 2, 90, mode="a").fillet(2),
|
2023-03-01 18:47:06 +00:00
|
|
|
},
|
|
|
|
]
|
2023-03-20 16:19:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
def add(
|
|
|
|
*,
|
|
|
|
model,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
thickness,
|
|
|
|
offset_x,
|
|
|
|
offset_y,
|
|
|
|
bottom_face,
|
|
|
|
back_face,
|
|
|
|
shell_t
|
|
|
|
):
|
|
|
|
|
|
|
|
# Holes
|
|
|
|
if back_face:
|
|
|
|
for hole in holes:
|
|
|
|
model = punch_hole2(
|
|
|
|
model=model,
|
|
|
|
face=back_face,
|
|
|
|
# FIXME: This is weird because it's the RIGHT side,
|
|
|
|
# So it's height instead of w
|
|
|
|
# need to work on making these coherent
|
|
|
|
w=height,
|
|
|
|
h=thickness,
|
|
|
|
x_offset=offset_x - 17 / 2,
|
|
|
|
y_offset=shell_t,
|
|
|
|
hole=hole,
|
|
|
|
depth=shell_t,
|
|
|
|
)
|
|
|
|
|
|
|
|
return model
|