case: shift the battery mesh even higher, to account for the battery's own USB input

This commit is contained in:
2023-12-30 10:35:09 +00:00
parent 2a3a2b6248
commit 6cccd6f212

View File

@@ -41,8 +41,8 @@ battery_shift_y = 6.0
battery_harness_height = 0.3 #< keep near 1-2 layer heights
battery_harness_shell_rad = 3.1
battery_harness_shell_thickness = 0.8
battery_harness_margin_bottom = 17.5
battery_harness_margin_top = 5.5
battery_harness_margin_bottom = 21.0
battery_harness_margin_top = 2.0
def _makeShell(solid, thickness: float=1, combine=False, **kwargs):
"""
@@ -248,8 +248,9 @@ def battery_harness(phone, battery):
pattern_points = harness_box.faces("<Z").workplane().rarray(
2*pattern_spacing,
2*pattern_spacing,
xCount=2 + int(0.5*harness_bbox.xlen / pattern_spacing),
yCount=2 + int(0.5*harness_bbox.ylen / pattern_spacing),
# the weird 2*int(0.5*foo) pattern guarantees the count to be odd, necessary for `center` to center an actual point and not just the pattern
xCount=5 + 2*int(0.5*0.5*harness_bbox.xlen / pattern_spacing),
yCount=5 + 2*int(0.5*0.5*harness_bbox.ylen / pattern_spacing),
center=True
)
@@ -269,12 +270,13 @@ def battery_harness(phone, battery):
# .union(pattern_shells.translate(( 0, pattern_spacing, 0)))
# .union(pattern_shells.translate(( pattern_spacing, pattern_spacing, 0)))
).translate((harness_bbox.center.x, harness_bbox.center.y, 0)) \
.translate((0, 0.5*(battery_harness_margin_top - battery_harness_margin_bottom), 0)) \
.translate((-pattern_spacing, -pattern_spacing, 0)) # optional, to swap center gap for center circle
harness = harness.intersect(harness_box)
# cut an opening at the bottom for e.g. USB plug
harness = harness.intersect(harness_box.translate((0, -battery_harness_margin_bottom, 0)))
# cut an opening at the top, required to allow for flexing in the z direction.
# cut an opening at the top, probably aids flexing in the z direction, but haven't tested without
harness = harness.intersect(harness_box.translate((0, battery_harness_margin_top, 0)))
harness = harness.translate((0, 0, thickness - battery_harness_height))
return harness