diff --git a/notebook_nueva/audio_plug.py b/notebook_nueva/audio_plug.py new file mode 100644 index 0000000..d064475 --- /dev/null +++ b/notebook_nueva/audio_plug.py @@ -0,0 +1,16 @@ +# 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) +# Consumers should set proper offsets for the hole + +holes = [ + # 2-jack plug + { + "x": 0, + "y": 4, + "height": 6, + "width": 17, + "fillet": 2, + }, +] diff --git a/notebook_nueva/battery_holder.py b/notebook_nueva/battery_holder.py index 6f9094d..f157303 100644 --- a/notebook_nueva/battery_holder.py +++ b/notebook_nueva/battery_holder.py @@ -6,14 +6,6 @@ stands = ( ) pillar_height = 7 -# Holes for the battery power cable and button -power_in = cq.Sketch().trapezoid(12, 6.5, 90, mode="a").vertices().fillet(1) -power_in_offset_x = 15 -power_in_offset_y = -1 -button_offset_x = 67 -button_offset_y = 5.5 -power_button_cut = cq.Sketch().trapezoid(7, 7, 90, mode="a").vertices().fillet(1) - # This is a holder for DuPont cables so they connect to this # things' pogo pins which are used to power the CPU @@ -38,3 +30,44 @@ pin_holder = ( mode="s", ) ) + +elements = [ + # Battery holder stands + { + "x": 0, + "y": 0, + "shape": stands, + "height": pillar_height, + }, + # Pogo pin connector channels + { + "x": 0, + "y": 40, + "shape": pin_holder, + "height": 3, + }, +] + + +# Hole distances are relative to the rightmost pillar +# seen from the back of the case, that's why they are negative +# Heights are relative to base of pillars +# All distances are measured to the CENTER of the hole +holes = [ + # Power inlet + { + "x": -15, + "y": -1 + pillar_height, + "height": 6.5, + "width": 12, + "fillet": 1, + }, + # Power button + { + "x": -67, + "y": 5.5 + pillar_height, + "height": 7, + "width": 7, + "fillet": 1, + }, +] diff --git a/notebook_nueva/cpu_holder.py b/notebook_nueva/cpu_holder.py deleted file mode 100644 index 186cb2e..0000000 --- a/notebook_nueva/cpu_holder.py +++ /dev/null @@ -1,8 +0,0 @@ -import cadquery as cq - -cpu_stand_positions = [(0, 0), (0, 23), (58, 23), (58, 0)] - -stands = ( - cq.Sketch().push(cpu_stand_positions).circle(3, mode="a").circle(2.65 / 2, mode="s") -) -pillar_height = 7 diff --git a/notebook_nueva/left_screen_mount.stl b/notebook_nueva/left_screen_mount.stl index 36dc76b..2fd0d2a 100644 Binary files a/notebook_nueva/left_screen_mount.stl and b/notebook_nueva/left_screen_mount.stl differ diff --git a/notebook_nueva/left_side.stl b/notebook_nueva/left_side.stl index dbc432d..16afaa5 100644 Binary files a/notebook_nueva/left_side.stl and b/notebook_nueva/left_side.stl differ diff --git a/notebook_nueva/model.stl b/notebook_nueva/model.stl index ff572ae..b816deb 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 632497f..f28a926 100644 --- a/notebook_nueva/modelo.py +++ b/notebook_nueva/modelo.py @@ -1,8 +1,11 @@ import cadquery as cq from cadquery import exporters +import audio_plug import battery_holder -import cpu_holder +import usb_hub +import zero_holder as cpu_holder +from utils import extrude_shape, punch_hole # Base for the notebook. Basically a kbd base that extends back # as much as possible @@ -76,30 +79,29 @@ mounting_pillars = ( screw_holes = cq.Sketch().push(mounting_pillar_positions).circle(3, mode="a") -# Hole for the USB hub's exposed port -usb_in = cq.Sketch().trapezoid(13, 5.5, 90, mode="a").vertices().fillet(2) # Thing to "grab" the hub so it stays in place -usb_holder = ( - cq.Sketch().trapezoid(22, 10, 90, mode="a").trapezoid(17, 10, 90, mode="s").clean() -) # Distance from edge to center of USB plug usb_offset = 48 -# Hole for the USB hub's exposed port -audio_in = cq.Sketch().trapezoid(17, 6, 90, mode="a").vertices().fillet(1) +# CPU holder position from back-left corner of the case +cpu_offset_x = 160 +cpu_offset_y = 25 -# CPU holder position from back-right corner of the case -cpu_offset_x = 150 -cpu_offset_y = 55 +# Battery holder position from back-left corner of the case +battery_offset_x = 22 +battery_offset_y = 8 -# Battery holder position from front-left corner of the case -battery_offset_x = 21 -battery_offset_y = 56 +# Offset for the USB port from back-right corner of the case +usb_offset = 48 def model(): - return ( + # Create the basic shape of the case bottom. + + # Currently also adds keyboard stuff, but that should be refactored + # out (FIXME) + model = ( cq.Workplane("XY") .workplane(offset=thickness / 2) .tag("mid_height") @@ -109,52 +111,6 @@ def model(): .fillet(2) .faces(">Z") .shell(-shell_t) - # Power inlet - # The position is arbitrary, based on the components available - .faces(">Y") - .workplane(centerOption="CenterOfBoundBox") - # The 15 is distance from stand hole center to center of USB plug - # The -1 is distance from top of the pillar to center of USB plug - .center( - width / 2 - battery_offset_x - battery_holder.power_in_offset_x, - -thickness / 2 - + battery_holder.pillar_height - + shell_t - + battery_holder.power_in_offset_y, - ) - .placeSketch(battery_holder.power_in) - .cutBlind(-shell_t) - # Power button - # The position is arbitrary, based on the components available, - .faces(">Y") - .workplane(centerOption="CenterOfBoundBox") - # The 67 is distance from stand hole center to center of power button - # The 5 is distance from top of the pillar to center of power button - .center( - width / 2 - battery_offset_x - battery_holder.button_offset_x, - -thickness / 2 - + battery_holder.pillar_height - + shell_t - + battery_holder.button_offset_y, - ) - .placeSketch(battery_holder.power_button_cut) - .cutBlind(-shell_t) - # USB inlet - # The position is arbitrary, based on the components - # available, keyboard height, cable length, etc. - .faces(">Y") - .workplane(centerOption="CenterOfBoundBox") - .center(-width / 2 + shell_t + usb_offset + 13 / 2, -8) - .placeSketch(usb_in) - .cutBlind(-shell_t) - # Audio plugs - # The position is arbitrary, based on the components - # available, keyboard height, cable length, etc. - .faces(">X") - .workplane(centerOption="CenterOfBoundBox") - .center(height / 2 - shell_t - 34.5 - 17 / 2, -8) - .placeSketch(audio_in) - .cutBlind(-shell_t) # Slanted mounting pillars on the kbd top .faces(">Z") .workplane(centerOption="CenterOfBoundBox") @@ -191,35 +147,91 @@ def model(): .placeSketch(screw_holes) # 13 is 20-7 (screw thread length - threaded insert depth) .cutBlind(thickness - 13) - # CPU Stands - .workplaneFromTagged("mid_height") - .workplane(offset=-thickness / 2, centerOption="CenterOfBoundBox") - .center(width / 2 - cpu_offset_x, height / 2 - cpu_offset_y) - .placeSketch(cpu_holder.stands) - .extrude(cpu_holder.pillar_height) - # Battery Stands - .workplaneFromTagged("mid_height") - .workplane(offset=-thickness / 2, centerOption="CenterOfBoundBox") - .center(-width / 2 + battery_offset_x, height / 2 - battery_offset_y) - .placeSketch(battery_holder.stands) - .extrude(shell_t + battery_holder.pillar_height) - # Pogo pin connector holders - .workplaneFromTagged("mid_height") - .workplane(offset=-thickness / 2, centerOption="CenterOfBoundBox") - .center( - -width / 2 + battery_offset_x, - height / 2 - battery_offset_y - battery_holder.pin_holder_height / 2, - ) - .placeSketch(battery_holder.pin_holder) - .extrude(shell_t + 3) - # Channel for the usb hub - .faces(">Y") - .workplane(centerOption="CenterOfBoundBox") - .center(-width / 2 + shell_t + usb_offset + 13 / 2, -8) - .placeSketch(usb_holder) - .extrude(-shell_t - 8) ) + # Now the basic box shape is in place, start adding things + # 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 + for hole in usb_hub.holes: + model = punch_hole( + model=model, + face=">Y", + w=width, + h=thickness, + x_offset=usb_offset + shell_t + usb_hub.holes[0]["width"] / 2, + y_offset=shell_t, + hole=hole, + depth=shell_t, + ) + + # USB hub holder + for element in usb_hub.elements: + model = extrude_shape( + model=model, + face="