60 lines
1.4 KiB
Python
60 lines
1.4 KiB
Python
|
import cadquery2 as cq
|
||
|
from cadquery2 import exporters
|
||
|
|
||
|
# Dimensions copied from modelo.py,
|
||
|
# TODO refactor into a separate file
|
||
|
|
||
|
# Thickness of the outer material
|
||
|
shell_t = 3
|
||
|
|
||
|
# Size of the kbd board
|
||
|
kbd_height = 98
|
||
|
kbd_width = 286
|
||
|
kbd_angle = 5
|
||
|
|
||
|
# Size of the whole object
|
||
|
width = kbd_width + 2 * shell_t
|
||
|
height = 69
|
||
|
thickness = 10
|
||
|
|
||
|
# Visible screen size
|
||
|
vis_w = 223
|
||
|
vis_h = 58
|
||
|
viewport_cutout = cq.Sketch().trapezoid(vis_w, vis_h, 90, mode="a")
|
||
|
|
||
|
# Whole screen size
|
||
|
scr_w = 231
|
||
|
scr_h = 65
|
||
|
scr_thickness = 5.5
|
||
|
screen_cutout = cq.Sketch().trapezoid(scr_w, scr_h, 90, mode="a")
|
||
|
|
||
|
# Circuit board and cable space
|
||
|
board_cutout = cq.Sketch().polygon(
|
||
|
[(0, 0), (width / 2 - 10, 0), (width / 2 - 10, vis_h), (0, vis_h), (0, 0)], mode="a"
|
||
|
)
|
||
|
|
||
|
|
||
|
model = (
|
||
|
cq.Workplane("XY")
|
||
|
.workplane()
|
||
|
.box(width, height, thickness)
|
||
|
.faces(">Z")
|
||
|
# Cut off viewport
|
||
|
.placeSketch(viewport_cutout)
|
||
|
.cutBlind(-1000)
|
||
|
# Make hole for screen assembly
|
||
|
.faces(">Z")
|
||
|
.workplane(offset=-shell_t, centerOption="CenterOfBoundBox")
|
||
|
# Left bezel is 4mm wider than right one, so this hole is displaced to the left
|
||
|
.center(-2, 0)
|
||
|
.placeSketch(screen_cutout)
|
||
|
.cutBlind(-scr_thickness)
|
||
|
.faces(">Z")
|
||
|
.workplane(offset=-shell_t-scr_thickness, centerOption="CenterOfBoundBox")
|
||
|
.center(0, - vis_h / 2)
|
||
|
.placeSketch(board_cutout)
|
||
|
.cutBlind(-1000)
|
||
|
)
|
||
|
|
||
|
exporters.export(model, "screen_mount.stl")
|