104 lines
2.6 KiB
Python
104 lines
2.6 KiB
Python
import cadquery2 as cq
|
|
from cadquery2 import exporters
|
|
|
|
shell_t = 2.5
|
|
|
|
# width, length VISIBLE WITHIN THE BEZEL
|
|
screen_w = 223
|
|
screen_l = 57
|
|
# Distance from the left of the case to screen cutout
|
|
screen_left_margin = 7 + shell_t # (7 is bezel width on that side)
|
|
# width, length, height INCLUDING_BEZEL
|
|
display_w = 233
|
|
display_l = 65
|
|
display_h = 5
|
|
|
|
width = 250
|
|
height = display_h + 2 * shell_t + 1
|
|
length = display_l + 2 * shell_t + 1
|
|
fillet_s = 2
|
|
|
|
|
|
# Distance from the left of the case to display end
|
|
display_left_margin = screen_left_margin - 7
|
|
# Distance from the right of the case to display end
|
|
display_right_margin = width - display_left_margin - display_w
|
|
# Distance from the top of the case to display top
|
|
display_top_margin = (length - display_l) / 2
|
|
display_bottom_margin = display_top_margin # Symmetrical
|
|
|
|
|
|
# Threaded insert hole dimensions
|
|
ti_width = 3
|
|
ti_depth = 3.5
|
|
|
|
|
|
screen_cutout = (
|
|
cq.Sketch().trapezoid(screen_w, screen_l, 90, mode="a").reset().vertices().fillet(1)
|
|
)
|
|
|
|
segment_breaks_top = (
|
|
cq.Sketch()
|
|
.rarray(width / 3, length, 2, 1)
|
|
.trapezoid(5, 15, 110, mode="a")
|
|
.reset()
|
|
.vertices()
|
|
.fillet(2)
|
|
)
|
|
|
|
segment_breaks_bottom = (
|
|
cq.Sketch()
|
|
.rarray(width / 3, length, 2, 1)
|
|
.trapezoid(15, 15, 70, mode="a")
|
|
.reset()
|
|
.vertices()
|
|
.fillet(2)
|
|
)
|
|
|
|
back_reinforcement = (
|
|
cq.Sketch().trapezoid(width * 2 / 3, 15, 90, mode="a").reset().vertices().fillet(2)
|
|
)
|
|
|
|
threaded_inserts = cq.Sketch().rarray(width / 6, 0, 4, 1).circle(ti_width, mode="a")
|
|
|
|
# Holder for the screen (other half of the case)
|
|
screen_base = (
|
|
# Basic filleted box shape
|
|
cq.Workplane("bottom")
|
|
.lineTo(-width, 0)
|
|
.lineTo(-width, height)
|
|
.lineTo(0, height)
|
|
.close()
|
|
.extrude(length)
|
|
.faces("<X")
|
|
.shell(-shell_t)
|
|
.edges("|X")
|
|
.fillet(fillet_s)
|
|
# Cutout visible screen area from top face
|
|
.faces(">Z")
|
|
.workplane(centerOption="CenterOfBoundBox")
|
|
.center((width - screen_w) / 2 - screen_left_margin, 0)
|
|
.placeSketch(screen_cutout)
|
|
.cutBlind(-shell_t)
|
|
# Cutout for segment breaks
|
|
.faces(">Z")
|
|
.workplane(centerOption="CenterOfBoundBox")
|
|
.center(0, length / 2)
|
|
.placeSketch(segment_breaks_top)
|
|
.cutBlind(-1000)
|
|
.center(0, -length)
|
|
.placeSketch(segment_breaks_bottom)
|
|
.cutBlind(-1000)
|
|
# Back reinforcement with holes for threaded inserts
|
|
.faces("<Z")
|
|
.workplane(centerOption="CenterOfBoundBox")
|
|
.placeSketch(back_reinforcement)
|
|
.extrude(1 + ti_depth - shell_t)
|
|
.faces("<Z")
|
|
.workplane(centerOption="CenterOfBoundBox")
|
|
.placeSketch(threaded_inserts)
|
|
.cutBlind(-ti_depth)
|
|
)
|
|
|
|
exporters.export(screen_base, "screen_base.stl")
|