diff --git a/notebook_nueva/base.py b/notebook_nueva/base.py new file mode 100644 index 0000000..9040ed4 --- /dev/null +++ b/notebook_nueva/base.py @@ -0,0 +1,208 @@ +import cadquery as cq +from cadquery import exporters +from cq_warehouse.drafting import Draft + +import audio_plug +import battery_holder +import hdmi_out +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 + +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=dim.base_thickness / 2) + .tag("mid_height") + # Hollow box + .box(dim.width, dim.height, dim.base_thickness) + .edges("|Z") + .fillet(2) + .faces(">Z") + .shell(-dim.shell_t) + ) + + # Now the basic box shape is in place, start adding things + # and cutting holes. + + model = usb_hub.add( + model=model, + width=dim.width, + height=dim.height, + thickness=dim.base_thickness, + bottom_face=" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/notebook_nueva/base_left.stl b/notebook_nueva/base_left.stl new file mode 100644 index 0000000..1479c68 Binary files /dev/null and b/notebook_nueva/base_left.stl differ diff --git a/notebook_nueva/base_right.stl b/notebook_nueva/base_right.stl new file mode 100644 index 0000000..def9790 Binary files /dev/null and b/notebook_nueva/base_right.stl differ diff --git a/notebook_nueva/hinged_lid.py b/notebook_nueva/hinged_lid.py index 927926a..f7d2ba4 100644 --- a/notebook_nueva/hinged_lid.py +++ b/notebook_nueva/hinged_lid.py @@ -385,7 +385,7 @@ if __name__ == "__main__": exporters.export(model, "hinged_lid.stl") - exporters.export(front_bezel(), "front_bezel.stl") + exporters.export(front_bezel(), "hinged_lid_bezel.stl") exporters.export( model, @@ -404,7 +404,7 @@ if __name__ == "__main__": .split(keepTop=True) ) - exporters.export(right_side, "right_hinged_lid.stl") + exporters.export(right_side, "hinged_lid_right.stl") left_side = ( model.faces(">X") @@ -412,4 +412,4 @@ if __name__ == "__main__": .split(keepBottom=True) ) - exporters.export(left_side, "left_hinged_lid.stl") + exporters.export(left_side, "hinged_lid_left.stl") diff --git a/notebook_nueva/hinged_lid.stl b/notebook_nueva/hinged_lid.stl index 6311f01..b6288b1 100644 Binary files a/notebook_nueva/hinged_lid.stl and b/notebook_nueva/hinged_lid.stl differ diff --git a/notebook_nueva/hinged_lid_bezel.stl b/notebook_nueva/hinged_lid_bezel.stl new file mode 100644 index 0000000..81fead3 Binary files /dev/null and b/notebook_nueva/hinged_lid_bezel.stl differ diff --git a/notebook_nueva/hinged_lid_left.stl b/notebook_nueva/hinged_lid_left.stl new file mode 100644 index 0000000..894dbb2 Binary files /dev/null and b/notebook_nueva/hinged_lid_left.stl differ diff --git a/notebook_nueva/hinged_lid_right.stl b/notebook_nueva/hinged_lid_right.stl new file mode 100644 index 0000000..22dc7e3 Binary files /dev/null and b/notebook_nueva/hinged_lid_right.stl differ diff --git a/notebook_nueva/simple_lid.py b/notebook_nueva/simple_lid.py new file mode 100644 index 0000000..55ab900 --- /dev/null +++ b/notebook_nueva/simple_lid.py @@ -0,0 +1,108 @@ +import cadquery as cq +from cadquery import exporters + +import dimensions as dim +from utils import extrude_shape2, hex_vents, punch_hole + + +def model(): + # Create the basic shape of the case lid + model = ( + cq.Workplane("XY") + # Hollow box + .box(dim.width, dim.sl_height, dim.sl_thickness) + .edges("|Z and >Y") + .fillet(2) + ) + + # Make many holes + vent = hex_vents(size=6, width=dim.width * 0.9, height=dim.sl_height * 0.9)[0] + model = punch_hole( + model=model, + face=">Z", + w=dim.width, + h=dim.sl_height, + x_offset=0.05 * dim.width, + y_offset=0.05 * dim.sl_height, + hole=vent, + depth=dim.sl_thickness, + ) + + # Add screw holes + for position in dim.mounting_pillar_positions: + model = ( + model.faces(">Z") + .workplane(centerOption="CenterOfBoundBox") + .center( + -dim.width / 2 + position[0], + dim.sl_height / 2 - position[1] - dim.shell_t, + ) + .placeSketch(cq.Sketch().circle(dim.m4_top / 2 + 1.5)) + .extrude(-dim.sl_thickness) + .faces(">Z") + .workplane(centerOption="CenterOfBoundBox") + .center( + -dim.width / 2 + position[0], + dim.sl_height / 2 - position[1] - dim.shell_t, + ) + .cskHole(dim.m4_bottom, dim.m4_top, 82, depth=None) + ) + + # Add front lip + + model = ( + model.faces(">Z") + .workplane(centerOption="CenterOfBoundBox") + .center(0, -dim.sl_height / 2 + dim.sl_lip_thickness / 2) + .placeSketch( + cq.Sketch().trapezoid(dim.width - 2 * dim.shell_t, dim.sl_lip_thickness, 90) + ) + .extrude(-dim.sl_front_lip - dim.sl_thickness) + ) + + return model + + +def decorative_cover(): + # A decorative thingie to cover the ugly seam in the middle + model = cq.Workplane("XY").box(10, dim.sl_height, 1).edges("|Z").fillet(1) + vent = hex_vents( + size=6, width=dim.width * 0.9, height=dim.sl_height * 0.9, density=0.775 + )[0] + + model = extrude_shape2( + model=model, + face=">Z", + w=dim.width, + h=dim.sl_height, + x_offset=0.05 * dim.width, + y_offset=0.05 * dim.sl_height, + hole=vent, + depth=3, + ) + return model + + +if __name__ == "__main__": + model = model() + exporters.export(model, "simple_lid.stl") + + cover = decorative_cover() + exporters.export(cover, "simple_lid_cover.stl") + + exporters.export( + model, + "lid.svg", + opt={ + "projectionDir": (0, 0, 1), + }, + ) + + exporters.export( + model.faces(">X").workplane(offset=-dim.width / 2).split(keepTop=True), + "simple_lid_right.stl", + ) + exporters.export( + model.faces(">X").workplane(offset=-dim.width / 2).split(keepBottom=True), + "simple_lid_left.stl", + ) diff --git a/notebook_nueva/simple_lid.stl b/notebook_nueva/simple_lid.stl new file mode 100644 index 0000000..a4ef5d1 Binary files /dev/null and b/notebook_nueva/simple_lid.stl differ diff --git a/notebook_nueva/simple_lid_cover.stl b/notebook_nueva/simple_lid_cover.stl new file mode 100644 index 0000000..939be39 Binary files /dev/null and b/notebook_nueva/simple_lid_cover.stl differ diff --git a/notebook_nueva/simple_lid_left.stl b/notebook_nueva/simple_lid_left.stl new file mode 100644 index 0000000..cb0aedb Binary files /dev/null and b/notebook_nueva/simple_lid_left.stl differ diff --git a/notebook_nueva/simple_lid_right.stl b/notebook_nueva/simple_lid_right.stl new file mode 100644 index 0000000..23a9aff Binary files /dev/null and b/notebook_nueva/simple_lid_right.stl differ diff --git a/notebook_nueva/tandy_lid.py b/notebook_nueva/tandy_lid.py new file mode 100644 index 0000000..02cc717 --- /dev/null +++ b/notebook_nueva/tandy_lid.py @@ -0,0 +1,132 @@ +import cadquery as cq +from cadquery import exporters + +import dimensions as dim + +viewport_cutout = ( + cq.Sketch().trapezoid(dim.vis_w, dim.vis_h, 90, mode="a").vertices().fillet(2) +) +screen_cutout = cq.Sketch().trapezoid(dim.scr_w, dim.scr_h, 90, mode="a") + +# Circuit board and cable hole. +# This is in the back of the screen, and is a bit shorter in height than the +# screen. It's wider so it removes enough material to make the shape simpler. +board_cutout = cq.Sketch().trapezoid( + dim.scr_w + 5, + dim.scr_h - 10, + 90, + mode="a", +) + +kbd_cable_hole = cq.Sketch().trapezoid(20, 9, 90, mode="a").vertices().fillet(1) + +# y needs to be inverted because this is the top side, adn there's 2 pillars we don't use +dim.mounting_pillar_positions = [(x, -y) for x, y in dim.mounting_pillar_positions[:-2]] + +mounting_pillars = ( + cq.Sketch() + .push(dim.mounting_pillar_positions) + .trapezoid(-12, 12, 90, mode="a") + .circle(dim.ti_radius, mode="s") + .clean() +) + + +def model(): + return ( + cq.Workplane("XY") + .workplane() + .tag("mid_height") + .box(dim.width, dim.tl_height, dim.tl_full_thickness) + # The screen goes rotated + .faces(">Z") + .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) + .tag("slanted") + # Arbitrary huge trapezoid to cut off the material *in front* + # of the inclined screen + .placeSketch(cq.Sketch().trapezoid(1000, 1000, 90, mode="a")) + .cutBlind(1000) + # Trim the top + .workplaneFromTagged("mid_height") + .workplane(offset=21) + .placeSketch(cq.Sketch().trapezoid(1000, 1000, 90, mode="a")) + .cutBlind(100) + # Make bottom smaller to fit with base + .faces(">X") + .workplane(centerOption="CenterOfBoundBox") + .center(-dim.tl_height / 2, -dim.tl_full_thickness / 2) + .placeSketch( + cq.Sketch() + .polygon( + [ + (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() + .fillet(3) + ) + .cutBlind(-1000) + # Fillet top of the object + .edges("|X and >Z") + .fillet(3) + # Cut off viewport hole so we can see the screen + .workplaneFromTagged("slanted") + .placeSketch(viewport_cutout) + .cutBlind(-dim.shell_t) + # Make hole for screen assembly so the whole screen fits + .workplaneFromTagged("slanted") + .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(-dim.scr_thickness) + # Make it hollow + .faces("(0, -10, 5)") + .fillet(2) + ) + + +if __name__ == "__main__": + model = model() + exporters.export(model, "tandy_lid.stl") + + offset_width = -dim.width / 2 + + right_side = ( + model.faces(">X") + .workplane(centerOption="CenterOfBoundBox", offset=offset_width) + .split(keepTop=True) + ) + + exporters.export(right_side, "tandy_lid_right.stl") + + left_side = ( + model.faces(">X") + .workplane(centerOption="CenterOfBoundBox", offset=offset_width) + .split(keepBottom=True) + ) + + exporters.export(left_side, "tandy_lid_left.stl") diff --git a/notebook_nueva/tandy_lid.stl b/notebook_nueva/tandy_lid.stl new file mode 100644 index 0000000..e2c4e1e Binary files /dev/null and b/notebook_nueva/tandy_lid.stl differ diff --git a/notebook_nueva/tandy_lid_left.stl b/notebook_nueva/tandy_lid_left.stl new file mode 100644 index 0000000..6fbf227 Binary files /dev/null and b/notebook_nueva/tandy_lid_left.stl differ diff --git a/notebook_nueva/tandy_lid_right.stl b/notebook_nueva/tandy_lid_right.stl new file mode 100644 index 0000000..02ffa2e Binary files /dev/null and b/notebook_nueva/tandy_lid_right.stl differ