case: fix button gap so that it actually surrounds the button instead of overlaps its edge
This commit is contained in:
24
src/case.py
24
src/case.py
@@ -26,7 +26,7 @@ button_seat_margin_yz = 1.0
|
||||
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.2
|
||||
button_inset_gap = 1.4
|
||||
|
||||
def _makeShell(solid, thickness: float=1, combine=False, **kwargs):
|
||||
"""
|
||||
@@ -122,15 +122,27 @@ def button_inset_cutaway(phone, buttons):
|
||||
return cutout
|
||||
|
||||
def button_gap_cutaway(phone, buttons):
|
||||
"""
|
||||
cut through the case just around the edge of the buttons, to give them a tab
|
||||
that more easily flexes.
|
||||
"""
|
||||
buttons2d = buttons.faces("<X")
|
||||
buttons = cq.Workplane("YZ").add(buttons2d) \
|
||||
.edges().toPending().consolidateWires() \
|
||||
.toPending().extrude(thickness)
|
||||
keep = (buttons
|
||||
.intersect(buttons.translate((0, button_inset_gap, 0)))
|
||||
.intersect(buttons.translate((0, -button_inset_gap, 0)))
|
||||
.extrude(thickness)
|
||||
buttons_with_buffer = cq.Workplane("YZ").add(buttons2d) \
|
||||
.edges().toPending().offset2D(button_inset_gap) \
|
||||
.extrude(thickness)
|
||||
cutout = buttons_with_buffer.cut(buttons)
|
||||
cutout_top = (cutout
|
||||
.cut(cutout.translate((0, button_inset_gap, 0)))
|
||||
.intersect(buttons_with_buffer.translate((0, -2*button_inset_gap, 0)))
|
||||
)
|
||||
cutout = buttons.cut(keep)
|
||||
cutout_bot = (cutout
|
||||
.cut(cutout.translate((0, -button_inset_gap, 0)))
|
||||
.intersect(buttons_with_buffer.translate((0, 2*button_inset_gap, 0)))
|
||||
)
|
||||
cutout = cutout_top.union(cutout_bot)
|
||||
return cutout
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user