case: replace the button rockers with pillars

these should print better
This commit is contained in:
2023-12-30 12:49:22 +00:00
parent 60335aedec
commit 7ebe77d879

View File

@@ -23,12 +23,12 @@ button_seat_margin_x = 0.2
# N.B.: keep this >= button_inset_gap to keep the part easily printable
button_seat_margin_yz = 1.5
# make the walls near the buttons this much thinner
# make the walls near the buttons this much thinner (by cutting away the *exterior*
button_inset_x = 0.4
button_inset_margin_yz = 5.5
# length of the segment we cut away entirely from the body bordering each button
button_inset_gap = 1.4
button_rocker_width = 0.8
button_rocker_width = 1.4
button_rocker_length = 3.0
# TODO: this should be relative to the bottom of the case, not the center
@@ -157,26 +157,46 @@ def button_gap_cutaway(phone, buttons):
cutout = cutout_top.union(cutout_bot)
return cutout
def button_rockers(phone, buttons):
buttons2d = buttons.faces("<X")
buttons = cq.Workplane("YZ").add(buttons2d) \
.edges().toPending().consolidateWires() \
.extrude(button_rocker_width) \
.translate((thickness-button_inset_x, 0, 0))
# def button_rockers(phone, buttons):
# buttons2d = buttons.faces("<X")
# buttons = cq.Workplane("YZ").add(buttons2d) \
# .edges().toPending().consolidateWires() \
# .extrude(button_rocker_width) \
# .translate((thickness-button_inset_x, 0, 0))
#
# rocker_top = buttons.faces("<Y").workplane(offset=-button_rocker_length).split(keepTop=True)
# rocker_top = rocker_top.edges("not <X").fillet(button_rocker_width * 2/3)
# rocker_bot = buttons.faces(">Y").workplane(offset=-button_rocker_length).split(keepTop=True)
# rocker_bot = rocker_bot.edges("not <X").fillet(button_rocker_width * 2/3)
#
# rockers = rocker_top.union(rocker_bot)
# return rockers
#
# def button_bump(phone, button):
# button2d = button.faces("<X")
# bump = button2d.sphere(radius=button_rocker_width, angle3=180, direct=(0, 1, 0), combine=False)
# bump = bump.translate((thickness-button_inset_x, 0, 0))
# return bump
rocker_top = buttons.faces("<Y").workplane(offset=-button_rocker_length).split(keepTop=True)
rocker_top = rocker_top.edges("not <X").fillet(button_rocker_width * 2/3)
rocker_bot = buttons.faces(">Y").workplane(offset=-button_rocker_length).split(keepTop=True)
rocker_bot = rocker_bot.edges("not <X").fillet(button_rocker_width * 2/3)
rockers = rocker_top.union(rocker_bot)
return rockers
def button_bump(phone, button):
def button_column(phone, button, align="center"):
"""
make a column on the exterior of the phone, so that pressing it in anywhere should activation the adjacent button.
"""
button2d = button.faces("<X")
rocker = button2d.sphere(radius=button_rocker_width, angle3=180, direct=(0, 1, 0), combine=False)
rocker = rocker.translate((thickness-button_inset_x, 0, 0))
return rocker
column = button2d.box(button_rocker_width, button_rocker_length, 20, centered=(False, True, True), combine=False)
column = column.translate((thickness-button_inset_x, 0, 0))
mask = phone.faces(">>X", tag="body").each(lambda f: f.thicken(100), combine=False)
column = column.intersect(mask)
column = column.edges(">X").chamfer(button_rocker_width * 3/4)
button_bbox = button.vals()[0].BoundingBox()
if align == "up":
column = column.translate((0, -0.5 * button_bbox.ylen + 2*button_inset_gap, 0))
elif align == "down":
column = column.translate((0, 0.5 * button_bbox.ylen - 2*button_inset_gap, 0))
return column
def battery_cutaway(phone, battery):
body_back_bb = phone.faces(tag="body_back") \
@@ -291,6 +311,7 @@ def case(phone, battery=None):
aux = phone.solids(tag="aux")
camera = phone.solids(tag="camera")
usb = phone.solids(tag="usb")
case = _makeShell(body, thickness)
case = case.cut(front_cutaway(case))
case = case.cut(aux_cutaway(phone, aux))
@@ -303,8 +324,11 @@ def case(phone, battery=None):
case = case.cut(button_gap_cutaway(phone, power))
case = case.cut(button_inset_cutaway(phone, volume))
case = case.cut(button_inset_cutaway(phone, power))
case = case.add(button_rockers(phone, volume))
case = case.add(button_bump(phone, power))
case = case.add(button_column(phone, volume, "up"))
case = case.add(button_column(phone, volume, "down"))
# case = case.add(button_rockers(phone, volume))
# case = case.add(button_bump(phone, power))
case = case.add(button_column(phone, power))
if battery:
case = case.cut(battery_cutaway(phone, battery))