diff --git a/notebook_nueva/audio_plug.py b/notebook_nueva/audio_plug.py index d064475..1f09e5b 100644 --- a/notebook_nueva/audio_plug.py +++ b/notebook_nueva/audio_plug.py @@ -1,7 +1,10 @@ # Hole to expose a USB audio card (YMMV) -# The hole is for a USB-A plug, y is measured in the hub -# (from the bottom face to middle of the hole) +import cadquery as cq + +from utils import punch_hole2, extrude_shape2 + +# The hole is for a random USB sound card. # Consumers should set proper offsets for the hole holes = [ @@ -9,8 +12,39 @@ holes = [ { "x": 0, "y": 4, - "height": 6, - "width": 17, - "fillet": 2, + "shape": cq.Sketch().trapezoid(17, 2, 90, mode="a").fillet(2), }, ] + + +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 diff --git a/notebook_nueva/model.stl b/notebook_nueva/model.stl index 1e6c447..c63f42e 100644 Binary files a/notebook_nueva/model.stl and b/notebook_nueva/model.stl differ diff --git a/notebook_nueva/modelo.py b/notebook_nueva/modelo.py index 6e18034..a7ec7a6 100644 --- a/notebook_nueva/modelo.py +++ b/notebook_nueva/modelo.py @@ -180,17 +180,17 @@ def model(): ) # Hole for audio in right side - for hole in audio_plug.holes: - model = punch_hole( - model=model, - face=">X", - w=height, - h=thickness, - x_offset=height - shell_t - 34.5 - audio_plug.holes[0]["width"] / 2, - y_offset=shell_t, - hole=hole, - depth=shell_t, - ) + model = audio_plug.add( + model=model, + width=width, + height=height, + thickness=thickness, + offset_x=111, # Offset from the front-left corner + offset_y=0, # Offset from the bottom + bottom_face=None, + back_face=">X", + shell_t=shell_t, + ) model = cpu_holder.add( model=model, diff --git a/notebook_nueva/right_side.stl b/notebook_nueva/right_side.stl index 8372d2e..564a55c 100644 Binary files a/notebook_nueva/right_side.stl and b/notebook_nueva/right_side.stl differ diff --git a/notebook_nueva/utils.py b/notebook_nueva/utils.py index baed6c9..29659ac 100644 --- a/notebook_nueva/utils.py +++ b/notebook_nueva/utils.py @@ -26,6 +26,16 @@ def punch_hole(*, model, face, w, h, x_offset, y_offset, hole, depth): ) +def extrude_shape2(*, 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"]) + .extrude(-depth) + ) + + def punch_hole2(*, model, face, w, h, x_offset, y_offset, hole, depth): return ( model.faces(face) @@ -35,6 +45,7 @@ def punch_hole2(*, model, face, w, h, x_offset, y_offset, hole, depth): .cutBlind(-depth) ) + def hex_vents(*, size, width, height): vent_positions = [] for x in range(1, width // size): @@ -53,4 +64,4 @@ def hex_vents(*, size, width, height): } ] - return vents \ No newline at end of file + return vents