diff --git a/notebook_nueva/dimensions.py b/notebook_nueva/dimensions.py new file mode 100644 index 0000000..fb28161 --- /dev/null +++ b/notebook_nueva/dimensions.py @@ -0,0 +1,95 @@ +import audio_plug +import usb_hub + +## Standard things (TODO move to separate file) + +# M3 threaded insert sizes +ti_radius = 2.35 +ti_depth = 6.25 + +# M3 hex nut dimensions +m3_hn_diam = 5.5 +m3_hn_hole = 3 +m3_hn_thickness = 2.5 + +## Keyboard dimensions +kbd_height = 95.5 +kbd_width = 305 + + +## Screen dimensions +# Whole screen size +scr_w = 231 +scr_h = 65 +scr_thickness = 5.5 +# Visible screen size +vis_w = 219 +vis_h = 55 + + +## Dimensions for the base of the computer + +# Thickness of the outer material +shell_t = 3 + +# Size of the base +width = kbd_width + 2 * shell_t +height = 159 +base_thickness = 30 + shell_t # 30 inside + + +# These are placed where convenient, and are used to join the top and bottom +# parts of the case. +# Measured from back-left corner OUTSIDE +mounting_pillar_positions = [ + (6, 6), + (6, 43), + (120, 6), + (170, 6), + (width - 6, 6), + (width - 6, 43), + (120, 48), + (170, 48), +] + +# Offset for the USB port from back-left corner +# of the case to left side of the hub +usb_offset_x = width - audio_plug.item_w - usb_hub.item_w + +# CPU holder position from back-left corner of the case +cpu_offset_x = 177 +cpu_offset_y = 2 + +# Battery holder position from back-left corner of the case +battery_offset_x = 15 +battery_offset_y = 3 + + +## Dimensions for the Tandy lid + +# Size of the whole object +tl_height = 66 +tl_height_bottom = 59 +tl_full_thickness = 48 # Will be shorter after construction +# Screen angle +tl_scr_angle = 20 + + +## Dimensions for the hinged lid + +# This is a constant used to control how far back the hinges go +# when open. It's arbitrary and can be adjusted experimentally +# printing small samples +hl_hinge_slant = shell_t + 2 + +hl_bezel_width = m3_hn_diam + 2 +hl_bezel_height = 1 +hl_bezel_thickness = 2 + +hl_hinge_radius = 5.5 +hl_screw_radius = 1.5 # M3 +hl_ring_radius = 5 # M3 +hl_hinge_offset = max(p[1] for p in mounting_pillar_positions) + 6 +hl_hinge_width = 25 +# Base + this lid +hl_full_thickness = 43 diff --git a/notebook_nueva/hinged_lid.py b/notebook_nueva/hinged_lid.py index b5738d3..30e28cf 100644 --- a/notebook_nueva/hinged_lid.py +++ b/notebook_nueva/hinged_lid.py @@ -1,53 +1,19 @@ import cadquery as cq from cadquery import exporters -import screen_pillars - -from modelo import ( - height, - mounting_pillar_positions, - ti_depth, - ti_radius, - width, - thickness as model_thickness, - shell_t, -) - +import dimensions as dim +import keyboard import screen_mount -import keyboard - -hinge_radius = 5.5 -screw_radius = 1.5 # M3 -ring_radius = 5 # M3 -hinge_offset = max(p[1] for p in mounting_pillar_positions) + 6 -hinge_width = 25 -thickness = 43 - - -mounting_pillar_positions = [(x, -y) for x, y in mounting_pillar_positions] +mounting_pillar_positions = [(x, -y) for x, y in dim.mounting_pillar_positions] mounting_pillars = ( cq.Sketch() - .push(mounting_pillar_positions) + .push(dim.mounting_pillar_positions) .trapezoid(-12, 12, 90, mode="a") - .circle(ti_radius, mode="s") + .circle(dim.ti_radius, mode="s") .clean() ) -# This is a constant used to control how far back the hinges go -# when open. It's arbitrary and can be adjusted experimentally -# printing small samples -hinge_slant = shell_t + 2 - -# M3 hex nut dimensions -m3_hn_diam = 5.5 -m3_hn_hole = 3 -m3_hn_thickness = 2.5 - -bezel_width = m3_hn_diam + 2 -bezel_height = 1 -bezel_thickness = 2 - def model(): # Create a 2-part hinged lid @@ -55,8 +21,8 @@ def model(): model = ( cq.Workplane("XY") # Hollow box - .workplane(offset=-thickness / 2) - .box(width, height, thickness) + .workplane(offset=-dim.hl_full_thickness / 2) + .box(dim.width, dim.height, dim.hl_full_thickness) .tag("base") .edges("|X and >Z and X") .workplane() - .center(height / 2 - hinge_offset, thickness / 2 - hinge_radius) + .center( + dim.height / 2 - dim.hl_hinge_offset, + dim.hl_full_thickness / 2 - dim.hl_hinge_radius, + ) .tag("rightSide") # Outer surface of the hinge .workplaneFromTagged("rightSide") - .placeSketch(cq.Sketch().circle(hinge_radius)) - .extrude(-hinge_width) + .placeSketch(cq.Sketch().circle(dim.hl_hinge_radius)) + .extrude(-dim.hl_hinge_width) .workplaneFromTagged("rightSide") - .workplane(offset=-width + hinge_width) - .placeSketch(cq.Sketch().circle(hinge_radius)) - .extrude(-hinge_width) + .workplane(offset=-dim.width + dim.hl_hinge_width) + .placeSketch(cq.Sketch().circle(dim.hl_hinge_radius)) + .extrude(-dim.hl_hinge_width) # Cut middle section between the hinges .workplaneFromTagged("rightSide") - .workplane(offset=-hinge_width) + .workplane(offset=-dim.hl_hinge_width) .placeSketch( cq.Sketch().polygon( [ - (-hinge_radius, -hinge_radius), - (-hinge_radius, 0), - (-hinge_radius - hinge_slant, hinge_radius), - (-hinge_slant, hinge_radius), - (-hinge_slant, hinge_radius - hinge_slant), - (hinge_radius, hinge_radius - hinge_slant), - (hinge_radius, -hinge_radius), - (-hinge_radius, -hinge_radius), + (-dim.hl_hinge_radius, -dim.hl_hinge_radius), + (-dim.hl_hinge_radius, 0), + (-dim.hl_hinge_radius - dim.hl_hinge_slant, dim.hl_hinge_radius), + (-dim.hl_hinge_slant, dim.hl_hinge_radius), + (-dim.hl_hinge_slant, dim.hl_hinge_radius - dim.hl_hinge_slant), + (dim.hl_hinge_radius, dim.hl_hinge_radius - dim.hl_hinge_slant), + (dim.hl_hinge_radius, -dim.hl_hinge_radius), + (-dim.hl_hinge_radius, -dim.hl_hinge_radius), ] ) ) - .cutBlind(-width + 2 * hinge_width - 1) + .cutBlind(-dim.width + 2 * dim.hl_hinge_width - 1) # Pillars to attach to base .workplaneFromTagged("base") .workplane( - centerOption="CenterOfBoundBox", offset=model_thickness - thickness / 2 + centerOption="CenterOfBoundBox", + offset=dim.base_thickness - dim.hl_full_thickness / 2, ) .workplaneFromTagged("base") - .workplane(offset=thickness / 2 - shell_t) - .center(-width / 2, height / 2 - shell_t) + .workplane(offset=dim.hl_full_thickness / 2 - dim.shell_t) + .center(-dim.width / 2, dim.height / 2 - dim.shell_t) .placeSketch(mounting_pillars) .extrude(-10) # Hole for screws .workplaneFromTagged("rightSide") - .placeSketch(cq.Sketch().circle(screw_radius)) - .cutBlind(-hinge_width) + .placeSketch(cq.Sketch().circle(dim.hl_screw_radius)) + .cutBlind(-dim.hl_hinge_width) .workplaneFromTagged("rightSide") - .workplane(offset=-width + hinge_width) - .placeSketch(cq.Sketch().circle(screw_radius)) - .cutBlind(-hinge_width) + .workplane(offset=-dim.width + dim.hl_hinge_width) + .placeSketch(cq.Sketch().circle(dim.hl_screw_radius)) + .cutBlind(-dim.hl_hinge_width) # Holes for rings & screw heads .workplaneFromTagged("rightSide") - .placeSketch(cq.Sketch().circle(ring_radius)) + .placeSketch(cq.Sketch().circle(dim.hl_ring_radius)) .cutBlind(-5) .workplaneFromTagged("rightSide") - .workplane(offset=-width + 4) - .placeSketch(cq.Sketch().circle(ring_radius)) + .workplane(offset=-dim.width + 4) + .placeSketch(cq.Sketch().circle(dim.hl_ring_radius)) .cutBlind(-5) # Split hinge halves .faces(">X") .workplaneFromTagged("rightSide") - .workplane(offset=-hinge_width / 2) - .placeSketch(cq.Sketch().trapezoid(hinge_radius * 2 + 1, hinge_radius * 2, 90)) + .workplane(offset=-dim.hl_hinge_width / 2) + .placeSketch( + cq.Sketch().trapezoid( + dim.hl_hinge_radius * 2 + 1, dim.hl_hinge_radius * 2, 90 + ) + ) .cutBlind(-1) .workplaneFromTagged("rightSide") - .workplane(offset=-hinge_width) - .placeSketch(cq.Sketch().trapezoid(hinge_radius * 2 + 1, hinge_radius * 2, 90)) + .workplane(offset=-dim.hl_hinge_width) + .placeSketch( + cq.Sketch().trapezoid( + dim.hl_hinge_radius * 2 + 1, dim.hl_hinge_radius * 2, 90 + ) + ) .cutBlind(-1) .workplaneFromTagged("rightSide") - .workplane(offset=-width + hinge_width / 2) - .placeSketch(cq.Sketch().trapezoid(hinge_radius * 2 + 1, hinge_radius * 2, 90)) + .workplane(offset=-dim.width + dim.hl_hinge_width / 2) + .placeSketch( + cq.Sketch().trapezoid( + dim.hl_hinge_radius * 2 + 1, dim.hl_hinge_radius * 2, 90 + ) + ) .cutBlind(-1) .workplaneFromTagged("rightSide") - .workplane(offset=-width + hinge_width) - .placeSketch(cq.Sketch().trapezoid(hinge_radius * 2 + 1, hinge_radius * 2, 90)) + .workplane(offset=-dim.width + dim.hl_hinge_width) + .placeSketch( + cq.Sketch().trapezoid( + dim.hl_hinge_radius * 2 + 1, dim.hl_hinge_radius * 2, 90 + ) + ) .cutBlind(-1) # Threaded inserts .workplaneFromTagged("rightSide") - .workplane(offset=-hinge_width / 2) - .placeSketch(cq.Sketch().circle(ti_radius)) - .cutBlind(-ti_depth) + .workplane(offset=-dim.hl_hinge_width / 2) + .placeSketch(cq.Sketch().circle(dim.ti_radius)) + .cutBlind(-dim.ti_depth) .workplaneFromTagged("rightSide") - .workplane(offset=-width + hinge_width / 2) - .placeSketch(cq.Sketch().circle(ti_radius)) - .cutBlind(ti_depth) + .workplane(offset=-dim.width + dim.hl_hinge_width / 2) + .placeSketch(cq.Sketch().circle(dim.ti_radius)) + .cutBlind(dim.ti_depth) # Split two halves # First cut for the right hinge .workplaneFromTagged("rightSide") @@ -157,84 +143,90 @@ def model(): .polygon( [ (0, 0), - (-hinge_radius - 0.2, 0), - (-hinge_radius - hinge_slant, hinge_radius), - (0, hinge_radius), + (-dim.hl_hinge_radius - 0.2, 0), + (-dim.hl_hinge_radius - dim.hl_hinge_slant, dim.hl_hinge_radius), + (0, dim.hl_hinge_radius), (0, 0), ] ) .polygon( [ - (-hinge_radius - 0.2, 0), - (-hinge_radius - 0.2, -1000), - (-hinge_radius, -1000), - (-hinge_radius, 0), - (-hinge_radius - 0.2, 0), + (-dim.hl_hinge_radius - 0.2, 0), + (-dim.hl_hinge_radius - 0.2, -1000), + (-dim.hl_hinge_radius, -1000), + (-dim.hl_hinge_radius, 0), + (-dim.hl_hinge_radius - 0.2, 0), ] ) - .circle(hinge_radius, mode="s") + .circle(dim.hl_hinge_radius, mode="s") ) - .cutBlind(-hinge_width / 2 - 1) + .cutBlind(-dim.hl_hinge_width / 2 - 1) # Second cut for the right hinge .workplaneFromTagged("rightSide") - .workplane(offset=-hinge_width / 2) + .workplane(offset=-dim.hl_hinge_width / 2) .placeSketch( cq.Sketch() .polygon( [ (0, 0), - (hinge_radius + 0.2, 0), - (hinge_radius + 0.2 + hinge_slant, hinge_radius), - (0, hinge_radius), + (dim.hl_hinge_radius + 0.2, 0), + ( + dim.hl_hinge_radius + 0.2 + dim.hl_hinge_slant, + dim.hl_hinge_radius, + ), + (0, dim.hl_hinge_radius), (0, 0), ] ) - .circle(hinge_radius, mode="s") + .circle(dim.hl_hinge_radius, mode="s") ) - .cutBlind(-hinge_width / 2 - 1) + .cutBlind(-dim.hl_hinge_width / 2 - 1) # First cut for the left hinge .workplaneFromTagged("rightSide") - .workplane(offset=-width + hinge_width) + .workplane(offset=-dim.width + dim.hl_hinge_width) .placeSketch( cq.Sketch() .polygon( [ (0, 0), - (hinge_radius + 0.2, 0), - (hinge_radius + 0.2 + hinge_slant, hinge_radius), - (0, hinge_radius), + (dim.hl_hinge_radius + 0.2, 0), + ( + dim.hl_hinge_radius + 0.2 + dim.hl_hinge_slant, + dim.hl_hinge_radius, + ), + (0, dim.hl_hinge_radius), (0, 0), ] ) - .circle(hinge_radius, mode="s") + .circle(dim.hl_hinge_radius, mode="s") ) - .cutBlind(-hinge_width / 2 - 1) + .cutBlind(-dim.hl_hinge_width / 2 - 1) # Second cut for the left hinge .workplaneFromTagged("rightSide") - .workplane(offset=-width + hinge_width / 2) + .workplane(offset=-dim.width + dim.hl_hinge_width / 2) .placeSketch( cq.Sketch() .polygon( [ (0, 0), - (-hinge_radius - 0.2, 0), - (-hinge_radius - hinge_slant, hinge_radius), - (0, hinge_radius), + (-dim.hl_hinge_radius - 0.2, 0), + (-dim.hl_hinge_radius - dim.hl_hinge_slant, dim.hl_hinge_radius), + (0, dim.hl_hinge_radius), (0, 0), ] ) .polygon( [ - (-hinge_radius - 0.2, 0), - (-hinge_radius - 0.2, -1000), - (-hinge_radius, -1000), - (-hinge_radius, 0), - (-hinge_radius - 0.2, 0), + (-dim.hl_hinge_radius - 0.2, 0), + (-dim.hl_hinge_radius - 0.2, -1000), + (-dim.hl_hinge_radius, -1000), + (-dim.hl_hinge_radius, 0), + (-dim.hl_hinge_radius - 0.2, 0), ] ) - .circle(hinge_radius, mode="s") + .circle(dim.hl_hinge_radius, mode="s") ) - .cutBlind(-hinge_width / 2 - 1) + .cutBlind(-dim.hl_hinge_width / 2 - 1) ) # Screen mount @@ -242,69 +234,75 @@ def model(): # 1st layer model.workplaneFromTagged("base") .center(0, -32) - .workplane(offset=thickness / 2 - shell_t) + .workplane(offset=dim.hl_full_thickness / 2 - dim.shell_t) .tag("screen_plane") .placeSketch( cq.Sketch() .trapezoid( - screen_mount.scr_w + 2 * bezel_width, - screen_mount.scr_h + 2 * bezel_height, + screen_mount.dim.scr_w + 2 * dim.hl_bezel_width, + screen_mount.dim.scr_h + 2 * dim.hl_bezel_height, 90, ) .vertices() .fillet(2) ) - .extrude(-2 - screen_mount.scr_thickness) + .extrude(-2 - screen_mount.dim.scr_thickness) # Hole for screws .workplaneFromTagged("screen_plane") .workplane(offset=1) .rect( - screen_mount.scr_w + 2 * bezel_width - m3_hn_diam - 1, - screen_mount.scr_h + 2 * bezel_height - m3_hn_diam - 1, + screen_mount.dim.scr_w + 2 * dim.hl_bezel_width - dim.m3_hn_diam - 1, + screen_mount.dim.scr_h + 2 * dim.hl_bezel_height - dim.m3_hn_diam - 1, forConstruction=True, ) .vertices() - .hole(m3_hn_hole, depth=10) + .hole(dim.m3_hn_hole, depth=10) # Holes for captured nuts .workplaneFromTagged("screen_plane") .workplane(offset=1) .rect( - screen_mount.scr_w + 2 * bezel_width - m3_hn_diam - 1, - screen_mount.scr_h + 2 * bezel_height - m3_hn_diam - 1, + screen_mount.dim.scr_w + 2 * dim.hl_bezel_width - dim.m3_hn_diam - 1, + screen_mount.dim.scr_h + 2 * dim.hl_bezel_height - dim.m3_hn_diam - 1, forConstruction=True, ) .vertices() - .hole(m3_hn_diam, depth=m3_hn_thickness + 0.5) + .hole(dim.m3_hn_diam, depth=dim.m3_hn_thickness + 0.5) # Remove middle of the screen holder .workplaneFromTagged("screen_plane") .placeSketch( cq.Sketch().trapezoid( - screen_mount.scr_w - 40, screen_mount.scr_h + 2 * bezel_height, 90 + screen_mount.dim.scr_w - 40, + screen_mount.dim.scr_h + 2 * dim.hl_bezel_height, + 90, ) ) .cutBlind(-100) # Hole to place screen .workplaneFromTagged("screen_plane") - .workplane(offset=-screen_mount.scr_thickness - 2) - .placeSketch(cq.Sketch().trapezoid(screen_mount.scr_w, screen_mount.scr_h, 90)) - .cutBlind(screen_mount.scr_thickness) + .workplane(offset=-screen_mount.dim.scr_thickness - 2) + .placeSketch( + cq.Sketch().trapezoid(screen_mount.dim.scr_w, screen_mount.dim.scr_h, 90) + ) + .cutBlind(screen_mount.dim.scr_thickness) ) # Cut off shape of the base - model = ( model.workplaneFromTagged("rightSide") - .center(-height + hinge_offset, -thickness + hinge_radius) + .center( + -dim.height + dim.hl_hinge_offset, + -dim.hl_full_thickness + dim.hl_hinge_radius, + ) .placeSketch( cq.Sketch().polygon( [ (0, 0), (0, keyboard.front_thickness), - (shell_t, keyboard.front_thickness), - (keyboard.actual_height + shell_t, keyboard.back_thickness), - (keyboard.actual_height + shell_t, model_thickness), - (height, model_thickness), - (height, 0), + (dim.shell_t, keyboard.front_thickness), + (keyboard.actual_height + dim.shell_t, keyboard.back_thickness), + (keyboard.actual_height + dim.shell_t, dim.base_thickness), + (dim.height, dim.base_thickness), + (dim.height, 0), (0, 0), ] ) @@ -323,21 +321,25 @@ def front_bezel(): .placeSketch( cq.Sketch() .trapezoid( - screen_mount.scr_w + 2 * bezel_width + 2 * bezel_thickness, - screen_mount.scr_h + 2 * bezel_height + 2 * bezel_thickness, + screen_mount.dim.scr_w + + 2 * dim.hl_bezel_width + + 2 * dim.hl_bezel_thickness, + screen_mount.dim.scr_h + + 2 * dim.hl_bezel_height + + 2 * dim.hl_bezel_thickness, 90, ) .vertices() .fillet(2) ) - .extrude(-2 - screen_mount.scr_thickness - bezel_thickness) + .extrude(-2 - screen_mount.dim.scr_thickness - dim.hl_bezel_thickness) .workplaneFromTagged("base") - .workplane(offset=-bezel_thickness) + .workplane(offset=-dim.hl_bezel_thickness) .placeSketch( cq.Sketch() .trapezoid( - screen_mount.scr_w + 2 * bezel_width, - screen_mount.scr_h + 2 * bezel_height, + screen_mount.dim.scr_w + 2 * dim.hl_bezel_width, + screen_mount.dim.scr_h + 2 * dim.hl_bezel_height, 90, ) .vertices() @@ -347,19 +349,19 @@ def front_bezel(): # Holes for screws .workplaneFromTagged("base") .rect( - screen_mount.scr_w + 2 * bezel_width - m3_hn_diam - 1, - screen_mount.scr_h + 2 * bezel_height - m3_hn_diam - 1, + screen_mount.dim.scr_w + 2 * dim.hl_bezel_width - dim.m3_hn_diam - 1, + screen_mount.dim.scr_h + 2 * dim.hl_bezel_height - dim.m3_hn_diam - 1, forConstruction=True, ) .vertices() - .hole(m3_hn_hole, depth=10) + .hole(dim.m3_hn_hole, depth=10) # Viewport hole .workplaneFromTagged("base") .placeSketch( cq.Sketch() .trapezoid( - screen_mount.vis_w, - screen_mount.vis_h, + screen_mount.dim.vis_w, + screen_mount.dim.vis_h, 90, ) .vertices() @@ -368,13 +370,13 @@ def front_bezel(): .cutBlind("last") # Cable gap .workplaneFromTagged("base") - .workplane(offset=-screen_mount.scr_thickness - bezel_thickness) + .workplane(offset=-screen_mount.dim.scr_thickness - dim.hl_bezel_thickness) .center(0, 10) .placeSketch( cq.Sketch() .trapezoid( - screen_mount.vis_w, - screen_mount.vis_h, + screen_mount.dim.vis_w, + screen_mount.dim.vis_h, 90, ) .vertices() @@ -401,7 +403,7 @@ if __name__ == "__main__": }, ) - offset_width = -width / 2 + offset_width = -dim.width / 2 right_side = ( model.faces(">X") diff --git a/notebook_nueva/hinged_lid.stl b/notebook_nueva/hinged_lid.stl index 41a2f16..acf70bc 100644 Binary files a/notebook_nueva/hinged_lid.stl and b/notebook_nueva/hinged_lid.stl differ diff --git a/notebook_nueva/hinged_lid.svg b/notebook_nueva/hinged_lid.svg index d8966a9..8391e69 100644 --- a/notebook_nueva/hinged_lid.svg +++ b/notebook_nueva/hinged_lid.svg @@ -203,14 +203,6 @@ - - - - - - - - @@ -224,8 +216,6 @@ - - @@ -375,16 +365,6 @@ - - - - - - - - - - diff --git a/notebook_nueva/left_hinged_lid.stl b/notebook_nueva/left_hinged_lid.stl index a11c329..90994e0 100644 Binary files a/notebook_nueva/left_hinged_lid.stl and b/notebook_nueva/left_hinged_lid.stl differ diff --git a/notebook_nueva/left_screen_mount.stl b/notebook_nueva/left_screen_mount.stl index fa6721f..ac638fd 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_lid.stl b/notebook_nueva/left_side_lid.stl index a400e74..cb0aedb 100644 Binary files a/notebook_nueva/left_side_lid.stl and b/notebook_nueva/left_side_lid.stl differ diff --git a/notebook_nueva/lid.py b/notebook_nueva/lid.py index 9a31477..16cd769 100644 --- a/notebook_nueva/lid.py +++ b/notebook_nueva/lid.py @@ -1,8 +1,8 @@ import cadquery as cq from cadquery import exporters -from modelo import mounting_pillar_positions, shell_t, width -from utils import hex_vents, punch_hole, extrude_shape2 +import dimensions as dim +from utils import extrude_shape2, hex_vents, punch_hole # Dimensions for countersunk M4 screws m4_top = 9 @@ -11,8 +11,10 @@ m4_bottom = 4 lip_thickness = 1.5 # Position of pillar + shell_t + pillar "radius" + lip -height = max([y for _, y in mounting_pillar_positions]) + 6 + shell_t + lip_thickness -thickness = shell_t +dim.height = ( + max([y for _, y in dim.mounting_pillar_positions]) + 6 + dim.shell_t + lip_thickness +) +thickness = dim.shell_t front_lip = 8 @@ -21,35 +23,39 @@ def model(): model = ( cq.Workplane("XY") # Hollow box - .box(width, height, thickness) + .box(dim.width, dim.height, thickness) .edges("|Z and >Y") .fillet(2) ) # Make many holes - vent = hex_vents(size=6, width=width * 0.9, height=height * 0.9)[0] + vent = hex_vents(size=6, width=dim.width * 0.9, height=dim.height * 0.9)[0] model = punch_hole( model=model, face=">Z", - w=width, - h=height, - x_offset=0.05 * width, - y_offset=0.05 * height, + w=dim.width, + h=dim.height, + x_offset=0.05 * dim.width, + y_offset=0.05 * dim.height, hole=vent, depth=thickness, ) # Add screw holes - for position in mounting_pillar_positions: + for position in dim.mounting_pillar_positions: model = ( model.faces(">Z") .workplane(centerOption="CenterOfBoundBox") - .center(-width / 2 + position[0], height / 2 - position[1] - shell_t) + .center( + -dim.width / 2 + position[0], dim.height / 2 - position[1] - dim.shell_t + ) .placeSketch(cq.Sketch().circle(m4_top / 2 + 1.5)) .extrude(-thickness) .faces(">Z") .workplane(centerOption="CenterOfBoundBox") - .center(-width / 2 + position[0], height / 2 - position[1] - shell_t) + .center( + -dim.width / 2 + position[0], dim.height / 2 - position[1] - dim.shell_t + ) .cskHole(m4_bottom, m4_top, 82, depth=None) ) @@ -58,8 +64,10 @@ def model(): model = ( model.faces(">Z") .workplane(centerOption="CenterOfBoundBox") - .center(0, -height / 2 + lip_thickness / 2) - .placeSketch(cq.Sketch().trapezoid(width - 2 * shell_t, lip_thickness, 90)) + .center(0, -dim.height / 2 + lip_thickness / 2) + .placeSketch( + cq.Sketch().trapezoid(dim.width - 2 * dim.shell_t, lip_thickness, 90) + ) .extrude(-front_lip - thickness) ) @@ -68,16 +76,18 @@ def model(): def decorative_cover(): # A decorative thingie to cover the ugly seam in the middle - model = cq.Workplane("XY").box(10, height, 1).edges("|Z").fillet(1) - vent = hex_vents(size=6, width=width * 0.9, height=height * 0.9, density=0.775)[0] + model = cq.Workplane("XY").box(10, dim.height, 1).edges("|Z").fillet(1) + vent = hex_vents( + size=6, width=dim.width * 0.9, height=dim.height * 0.9, density=0.775 + )[0] model = extrude_shape2( model=model, face=">Z", - w=width, - h=height, - x_offset=0.05 * width, - y_offset=0.05 * height, + w=dim.width, + h=dim.height, + x_offset=0.05 * dim.width, + y_offset=0.05 * dim.height, hole=vent, depth=3, ) @@ -100,10 +110,10 @@ if __name__ == "__main__": ) exporters.export( - model.faces(">X").workplane(offset=-width / 2).split(keepTop=True), + model.faces(">X").workplane(offset=-dim.width / 2).split(keepTop=True), "right_side_lid.stl", ) exporters.export( - model.faces(">X").workplane(offset=-width / 2).split(keepBottom=True), + model.faces(">X").workplane(offset=-dim.width / 2).split(keepBottom=True), "left_side_lid.stl", ) diff --git a/notebook_nueva/lid.stl b/notebook_nueva/lid.stl index 2d7923d..a4ef5d1 100644 Binary files a/notebook_nueva/lid.stl and b/notebook_nueva/lid.stl differ diff --git a/notebook_nueva/lid.svg b/notebook_nueva/lid.svg index 5d5f2e4..19f9445 100644 --- a/notebook_nueva/lid.svg +++ b/notebook_nueva/lid.svg @@ -20,6 +20,7 @@ + @@ -100,7 +101,6 @@ - @@ -240,6 +240,7 @@ + @@ -324,7 +325,6 @@ - @@ -644,6 +644,7 @@ + @@ -657,7 +658,6 @@ - @@ -798,6 +798,7 @@ + @@ -948,7 +949,6 @@ - @@ -1254,10 +1254,10 @@ + - - + diff --git a/notebook_nueva/modelo.py b/notebook_nueva/modelo.py index 2a28987..2a1493a 100644 --- a/notebook_nueva/modelo.py +++ b/notebook_nueva/modelo.py @@ -9,68 +9,26 @@ import keyboard import screen_pillars import usb_hub import zero_holder as cpu_holder +import dimensions as dim # Base for the notebook. Basically a kbd base that extends back # as much as possible -# Thickness of the outer material -shell_t = 3 - -# Size of the kbd board -kbd_height = 95.5 -kbd_width = 305 - -# Size of the whole object -width = kbd_width + 2 * shell_t -height = 159 -print(f"Width:{width} Height:{height}") -thickness = 30 + shell_t # 30 inside - -# Insert Positions -ti_radius = 2.35 -ti_depth = 6.25 - -# These are placed where convenient, and are used to join the top and bottom -# parts of the case. -# Measured from top-left corner OUTSIDE -mounting_pillar_positions = [ - (6, 6), - (6, 43), - (120, 6), - (170, 6), - (width - 6, 6), - (width - 6, 43), - (120, 48), - (170, 48), -] -screen_pillars.init(mounting_pillar_positions, thickness - shell_t) - -# Offset for the USB port from back-left corner -# of the case to left side of the hub -usb_offset_x = width - audio_plug.item_w - usb_hub.item_w - - -# CPU holder position from back-left corner of the case -cpu_offset_x = 177 -cpu_offset_y = 2 - -# Battery holder position from back-left corner of the case -battery_offset_x = 15 -battery_offset_y = 3 +screen_pillars.init(dim.mounting_pillar_positions, dim.base_thickness - dim.shell_t) def model(): # Create the basic shape of the case bottom. model = ( cq.Workplane("XY") - .workplane(offset=thickness / 2) + .workplane(offset=dim.base_thickness / 2) .tag("mid_height") # Hollow box - .box(width, height, thickness) + .box(dim.width, dim.height, dim.base_thickness) .edges("|Z") .fillet(2) .faces(">Z") - .shell(-shell_t) + .shell(-dim.shell_t) ) # Now the basic box shape is in place, start adding things @@ -78,89 +36,89 @@ def model(): model = usb_hub.add( model=model, - width=width, - height=height, - thickness=thickness, + width=dim.width, + height=dim.height, + thickness=dim.base_thickness, bottom_face="Z") - .transformed(rotate=(scr_angle, 0, 0)) + .transformed(rotate=(dim.tl_scr_angle, 0, 0)) # Move the screen "lower" so it doesn't interfere # so much with the back .center(0, -2) @@ -79,18 +57,18 @@ def model(): # Make bottom smaller to fit with base .faces(">X") .workplane(centerOption="CenterOfBoundBox") - .center(-height / 2, -thickness / 2) + .center(-dim.tl_height / 2, -dim.tl_full_thickness / 2) .placeSketch( cq.Sketch() .polygon( [ - (height_bottom, 0), - (height_bottom, thickness / 3), - (height, thickness - 21), - (height, thickness), - (height + 5, thickness + 5), - (height + 5, 0), - (height_bottom, 0), + (dim.tl_height_bottom, 0), + (dim.tl_height_bottom, dim.tl_full_thickness / 3), + (dim.tl_height, dim.tl_full_thickness - 21), + (dim.tl_height, dim.tl_full_thickness), + (dim.tl_height + 5, dim.tl_full_thickness + 5), + (dim.tl_height + 5, 0), + (dim.tl_height_bottom, 0), ] ) .vertices() @@ -103,26 +81,26 @@ def model(): # Cut off viewport hole so we can see the screen .workplaneFromTagged("slanted") .placeSketch(viewport_cutout) - .cutBlind(-shell_t) + .cutBlind(-dim.shell_t) # Make hole for screen assembly so the whole screen fits .workplaneFromTagged("slanted") - .workplane(offset=-shell_t, centerOption="CenterOfBoundBox") + .workplane(offset=-dim.shell_t, centerOption="CenterOfBoundBox") # Left bezel is wider than right one, so this hole is displaced to the left .center(-3, 0) .placeSketch(screen_cutout) - .cutBlind(-scr_thickness) + .cutBlind(-dim.scr_thickness) # Make it hollow .faces("X") diff --git a/notebook_nueva/screen_mount.stl b/notebook_nueva/screen_mount.stl index dd69232..17aeb91 100644 Binary files a/notebook_nueva/screen_mount.stl and b/notebook_nueva/screen_mount.stl differ