Build automatically using make
This commit is contained in:
parent
bd4b8d4cc5
commit
cc1ff47e53
11
notebook_nueva/.vscode/settings.json
vendored
Normal file
11
notebook_nueva/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"python.formatting.provider": "black",
|
||||
"emeraldwalk.runonsave": {
|
||||
"commands": [
|
||||
{
|
||||
"match": ".py",
|
||||
"isAsync": true,
|
||||
"cmd": "make"
|
||||
}
|
||||
}
|
||||
}
|
6
notebook_nueva/Makefile
Normal file
6
notebook_nueva/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
STL_FILES = base.stl hinged_lid.stl simple_lid.stl tandy_lid.stl
|
||||
|
||||
all: $(STL_FILES)
|
||||
|
||||
%.stl: %.py dimensions.py
|
||||
python $<
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,108 +0,0 @@
|
||||
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, "lid.stl")
|
||||
|
||||
cover = decorative_cover()
|
||||
exporters.export(cover, "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),
|
||||
"right_side_lid.stl",
|
||||
)
|
||||
exporters.export(
|
||||
model.faces(">X").workplane(offset=-dim.width / 2).split(keepBottom=True),
|
||||
"left_side_lid.stl",
|
||||
)
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 786 KiB |
@ -1,208 +0,0 @@
|
||||
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="<Z",
|
||||
back_face=">Y",
|
||||
offset_x=dim.usb_offset_x,
|
||||
offset_y=0,
|
||||
shell_t=dim.shell_t,
|
||||
)
|
||||
|
||||
# Hole for audio in right side
|
||||
model = audio_plug.add(
|
||||
model=model,
|
||||
width=dim.width,
|
||||
height=dim.height,
|
||||
thickness=dim.base_thickness,
|
||||
offset_x=dim.width - audio_plug.item_w,
|
||||
offset_y=19,
|
||||
bottom_face="<Z",
|
||||
back_face=">X",
|
||||
shell_t=dim.shell_t,
|
||||
)
|
||||
|
||||
# Hole for HDMI out in the back
|
||||
model = hdmi_out.add(
|
||||
model=model,
|
||||
width=dim.width,
|
||||
height=dim.height,
|
||||
thickness=dim.base_thickness,
|
||||
offset_x=dim.hdmi_out_offset_x,
|
||||
offset_y=0,
|
||||
bottom_face=None,
|
||||
back_face=">Y",
|
||||
shell_t=dim.shell_t,
|
||||
)
|
||||
|
||||
model = cpu_holder.add(
|
||||
model=model,
|
||||
width=dim.width,
|
||||
height=dim.height,
|
||||
thickness=dim.base_thickness,
|
||||
offset_x=dim.cpu_offset_x,
|
||||
offset_y=dim.cpu_offset_y,
|
||||
bottom_face="<Z",
|
||||
back_face=None, # Not exposing the holes
|
||||
shell_t=dim.shell_t,
|
||||
)
|
||||
|
||||
# This adds all the holes and extrusions for the battery system
|
||||
model = battery_holder.add(
|
||||
model=model,
|
||||
width=dim.width,
|
||||
height=dim.height,
|
||||
thickness=dim.base_thickness,
|
||||
offset_x=dim.battery_offset_x,
|
||||
offset_y=dim.battery_offset_y,
|
||||
bottom_face="<Z",
|
||||
back_face=">Y",
|
||||
shell_t=dim.shell_t,
|
||||
)
|
||||
|
||||
model = screen_pillars.add(
|
||||
model=model,
|
||||
width=dim.width,
|
||||
height=dim.height,
|
||||
thickness=dim.base_thickness,
|
||||
offset_x=0,
|
||||
offset_y=0,
|
||||
bottom_face="<Z",
|
||||
back_face=None,
|
||||
shell_t=dim.shell_t,
|
||||
)
|
||||
|
||||
model = keyboard.add(
|
||||
model=model,
|
||||
width=dim.width,
|
||||
height=dim.height,
|
||||
thickness=dim.base_thickness,
|
||||
bottom_face="<Z",
|
||||
back_face=None,
|
||||
offset_x=dim.shell_t,
|
||||
offset_y=dim.kbd_height + dim.shell_t,
|
||||
shell_t=dim.shell_t,
|
||||
)
|
||||
|
||||
return model
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
model = model()
|
||||
|
||||
left_cutout = cq.Sketch().polygon(
|
||||
[
|
||||
(0, 0),
|
||||
(dim.width / 2, 0),
|
||||
(dim.width / 2, -dim.height),
|
||||
(0, -dim.height),
|
||||
(0, 0),
|
||||
],
|
||||
mode="a",
|
||||
)
|
||||
|
||||
right_side = (
|
||||
model.faces("<Z")
|
||||
.workplaneFromTagged("mid_height")
|
||||
.transformed(offset=cq.Vector(0, 0, -dim.base_thickness / 2))
|
||||
.center(-dim.width / 2, dim.height / 2)
|
||||
.placeSketch(left_cutout)
|
||||
.cutBlind(100)
|
||||
)
|
||||
|
||||
exporters.export(right_side, "right_side.stl")
|
||||
|
||||
right_cutout = cq.Sketch().polygon(
|
||||
[
|
||||
(dim.width / 2, 0),
|
||||
(dim.width, 0),
|
||||
(dim.width, -dim.height),
|
||||
(dim.width / 2, -dim.height),
|
||||
(dim.width / 2, 0),
|
||||
],
|
||||
mode="a",
|
||||
)
|
||||
|
||||
left_side = (
|
||||
model.faces("<Z")
|
||||
.workplaneFromTagged("mid_height")
|
||||
.transformed(offset=cq.Vector(0, 0, -dim.base_thickness / 2))
|
||||
.center(-dim.width / 2, dim.height / 2)
|
||||
.placeSketch(right_cutout)
|
||||
.cutBlind(100)
|
||||
)
|
||||
exporters.export(left_side, "left_side.stl")
|
||||
|
||||
# draft = Draft(decimal_precision=1)
|
||||
# dimensions = []
|
||||
# dimensions.append(
|
||||
# draft.extension_line(
|
||||
# object_edge=[
|
||||
# cq.Vertex.makeVertex(-width / 2, -height / 2, 0),
|
||||
# cq.Vertex.makeVertex(width / 2, -height / 2, 0),
|
||||
# ],
|
||||
# offset=10.0,
|
||||
# )
|
||||
# )
|
||||
# dimensions.append(
|
||||
# draft.extension_line(
|
||||
# object_edge=[
|
||||
# cq.Vertex.makeVertex(width / 2, -height / 2, 0),
|
||||
# cq.Vertex.makeVertex(width / 2, height / 2, 0),
|
||||
# ],
|
||||
# offset=10.0,
|
||||
# )
|
||||
# )
|
||||
|
||||
exporters.export(model, "model.stl")
|
||||
|
||||
# for d in dimensions[1:]:
|
||||
# dimensions[0].add(d.toCompound())
|
||||
# dimensions[0].add(model)
|
||||
|
||||
exporters.export(
|
||||
# model[0].toCompound(),
|
||||
model,
|
||||
"model.svg",
|
||||
opt={
|
||||
"projectionDir": (0, 0, 1),
|
||||
"strokeWidth": 0.3,
|
||||
},
|
||||
)
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,132 +0,0 @@
|
||||
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("<Z")
|
||||
# Can't be exactly shell_t because cq fails
|
||||
.shell(-dim.shell_t + 0.01)
|
||||
# Cut hole for the screen board and cables
|
||||
.workplaneFromTagged("slanted")
|
||||
.workplane(offset=-dim.scr_thickness, centerOption="CenterOfBoundBox")
|
||||
.placeSketch(board_cutout)
|
||||
.cutBlind(-6)
|
||||
.workplaneFromTagged("mid_height")
|
||||
.workplane(offset=-dim.tl_full_thickness / 2, centerOption="CenterOfBoundBox")
|
||||
.center(-dim.width / 2, dim.tl_height_bottom - dim.tl_height / 2 - dim.shell_t)
|
||||
.placeSketch(mounting_pillars)
|
||||
.extrude(10)
|
||||
# Fillet the front edge of the screen case so it looks softer
|
||||
.edges(">(0, -10, 5)")
|
||||
.fillet(2)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
model = model()
|
||||
exporters.export(model, "screen_mount.stl")
|
||||
|
||||
offset_width = -dim.width / 2
|
||||
|
||||
right_side = (
|
||||
model.faces(">X")
|
||||
.workplane(centerOption="CenterOfBoundBox", offset=offset_width)
|
||||
.split(keepTop=True)
|
||||
)
|
||||
|
||||
exporters.export(right_side, "right_screen_mount.stl")
|
||||
|
||||
left_side = (
|
||||
model.faces(">X")
|
||||
.workplane(centerOption="CenterOfBoundBox", offset=offset_width)
|
||||
.split(keepBottom=True)
|
||||
)
|
||||
|
||||
exporters.export(left_side, "left_screen_mount.stl")
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user