case: add volume rockers

This commit is contained in:
Colin 2023-12-27 11:40:58 +00:00
parent e4bfcb1d2e
commit e2df5e52a1

View File

@ -27,6 +27,8 @@ 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 = 1.0
button_rocker_length = 3.0
def _makeShell(solid, thickness: float=1, combine=False, **kwargs):
"""
@ -145,6 +147,21 @@ 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))
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 case(phone):
case = _makeShell(phone.solids(tag="body"), thickness)
@ -157,6 +174,7 @@ def case(phone):
case = case.cut(button_gap_cutaway(phone, phone.solids(tag="power")))
case = case.cut(button_inset_cutaway(phone, phone.solids(tag="volume")))
case = case.cut(button_inset_cutaway(phone, phone.solids(tag="power")))
case = case.add(button_rockers(phone, phone.solids(tag="volume")))
# TODO: compress the case along the Z axis, to give a snugger fit (0.8mm is a good compression)
# TODO: add in volume/power button bumps
# TODO: add power button bump
return case