From 9dff5864b671133e350a14dd80246baed8f3fa59 Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Sun, 15 Aug 2021 20:21:13 -0400 Subject: Trackball updates. Still need to refresh geometry. Optical distance is too long. --- src/dactyl_manuform.py | 484 +++++++++++++++++------------------------- src/generate_configuration.py | 55 ++--- src/model_builder.py | 15 +- src/run_config.json | 61 ++++-- src/trackball_only_V09.FCStd | Bin 0 -> 1615013 bytes 5 files changed, 284 insertions(+), 331 deletions(-) create mode 100644 src/trackball_only_V09.FCStd (limited to 'src') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 130bdfd..1fba393 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -99,7 +99,7 @@ if 'HS_' in plate_style: plate_file = path.join("..", "src", r"hot_swap_plate") plate_offset = 0.0 -if (trackball_in_wall or thumb_style in ['TRACKBALL']) and not ball_side == 'both': +if (trackball_in_wall or ('TRACKBALL' in thumb_style)) and not ball_side == 'both': symmetry = "asymmetric" mount_width = keyswitch_width + 2 * plate_rim @@ -268,7 +268,7 @@ def single_plate(cylinder_segments=100, side="right"): return plate def trackball_cutout(segments=100, side="right"): - shape = cylinder(tbiw_hole_diameter / 2, tbiw_hole_height) + shape = cylinder(trackball_hole_diameter / 2, trackball_hole_height) return shape def trackball_socket(segments=100, side="right"): @@ -299,8 +299,6 @@ def trackball_socket(segments=100, side="right"): def trackball_ball(segments=100, side="right"): shape = sphere(ball_diameter / 2) - shape = translate(shape, (0, 0, ball_z_offset)) - return shape ################ @@ -762,9 +760,10 @@ def thumbcaps(side='right', style_override=None): return minidox_thumbcaps() elif _thumb_style == "CARBONFET": return carbonfet_thumbcaps() - elif _thumb_style == "TRACKBALL" : + elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): - return trackball_thumbcaps() + if _thumb_style == "TRACKBALL_ORBISSYL": + return tbjs_thumbcaps() else: return thumbcaps(side, style_override=other_thumb) else: @@ -783,9 +782,10 @@ def thumb(side="right", style_override=None): return minidox_thumb(side) elif _thumb_style == "CARBONFET": return carbonfet_thumb(side) - elif _thumb_style == "TRACKBALL": + elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): - return trackball_thumb(side) + if _thumb_style == "TRACKBALL_ORBISSYL": + return tbjs_thumb(side) else: return thumb(side, style_override=other_thumb) else: @@ -804,9 +804,10 @@ def thumb_connectors(side='right', style_override=None): return minidox_thumb_connectors() elif _thumb_style == "CARBONFET": return carbonfet_thumb_connectors() - elif _thumb_style == "TRACKBALL" : + elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): - return trackball_thumb_connectors() + if _thumb_style == "TRACKBALL_ORBISSYL": + return tbjs_thumb_connectors() else: return thumb_connectors(side, style_override=other_thumb) else: @@ -1743,57 +1744,64 @@ def carbonfet_thumb_connectors(): # Trackball (Ball + 4-key) THUMB CLUSTER ############################ -def trackball_thumb_position_rotation(): +def tbjs_thumb_position_rotation(): rot = [10, -15, 5] pos = thumborigin() # Changes size based on key diameter around ball, shifting off of the top left cluster key. shift = [-.9*tbjs_key_diameter/2+27-42, -.1*tbjs_key_diameter/2+3-20, -5] for i in range(len(pos)): - pos[i] = pos[i] + shift[i] + pos[i] = pos[i] + shift[i] + tbjs_translation_offset[i] + + for i in range(len(rot)): + rot[i] = rot[i] + tbjs_rotation_offset[i] + return pos, rot -def trackball_place(shape): - pos, rot = trackball_thumb_position_rotation() +def tbjs_place(shape): + pos, rot = tbjs_thumb_position_rotation() shape = rotate(shape, rot) shape = translate(shape, pos) return shape -def trackball_thumb_tl_place(shape): +def tbjs_thumb_tl_place(shape): debugprint('thumb_tr_place()') # Modifying to make a "ring" of keys shape = rotate(shape, [0, 0, 0]) - t_off = tbjs_translational_offsets[0] + t_off = tbjs_key_translation_offsets[0] + shape = rotate(shape, tbjs_key_rotation_offsets[0]) shape = translate(shape, (t_off[0], t_off[1]+tbjs_key_diameter/2, t_off[2])) shape = rotate(shape, [0,0,-80]) - shape = trackball_place(shape) + shape = tbjs_place(shape) # shape = rotate(shape, [5, 10, -65]) # shape = translate(shape, thumborigin()) # shape = translate(shape, [-14, -9, 0]) return shape -def trackball_thumb_mr_place(shape): +def tbjs_thumb_mr_place(shape): debugprint('thumb_mr_place()') shape = rotate(shape, [0, 0, 0]) - t_off = tbjs_translational_offsets[1] + shape = rotate(shape, tbjs_key_rotation_offsets[1]) + t_off = tbjs_key_translation_offsets[1] shape = translate(shape, (t_off[0], t_off[1]+tbjs_key_diameter/2, t_off[2])) shape = rotate(shape, [0,0,-130]) - shape = trackball_place(shape) + shape = tbjs_place(shape) # shape = rotate(shape, [7, 20, -105]) # shape = translate(shape, thumborigin()) # shape = translate(shape, [-12, -32, -5]) return shape -def trackball_thumb_br_place(shape): +def tbjs_thumb_br_place(shape): debugprint('thumb_br_place()') shape = rotate(shape, [0, 0, 180]) - t_off = tbjs_translational_offsets[2] + shape = rotate(shape, tbjs_key_rotation_offsets[2]) + t_off = tbjs_key_translation_offsets[2] shape = translate(shape, (t_off[0], t_off[1]+tbjs_key_diameter/2, t_off[2])) shape = rotate(shape, [0,0,-180]) - shape = trackball_place(shape) + shape = tbjs_place(shape) # shape = rotate(shape, [25, -11, 0]) # shape = translate(shape, thumborigin()) @@ -1801,13 +1809,14 @@ def trackball_thumb_br_place(shape): return shape -def trackball_thumb_bl_place(shape): +def tbjs_thumb_bl_place(shape): debugprint('thumb_bl_place()') shape = rotate(shape, [0, 0, 180]) - t_off = tbjs_translational_offsets[3] + shape = rotate(shape, tbjs_key_rotation_offsets[3]) + t_off = tbjs_key_translation_offsets[3] shape = translate(shape, (t_off[0], t_off[1]+tbjs_key_diameter/2, t_off[2])) shape = rotate(shape, [0,0,-230]) - shape = trackball_place(shape) + shape = tbjs_place(shape) # shape = rotate(shape, [25, 0, -45]) # shape = translate(shape, thumborigin()) @@ -1815,7 +1824,7 @@ def trackball_thumb_bl_place(shape): return shape -# def trackball_thumb_tlold_place(shape): +# def tbjs_thumb_tlold_place(shape): # debugprint('thumb_tl_place()') # shape = rotate(shape, [7.5, -10, 10]) # shape = translate(shape, thumborigin()) @@ -1823,7 +1832,7 @@ def trackball_thumb_bl_place(shape): # return shape # # -# def trackball_thumb_mlold_place(shape): +# def tbjs_thumb_mlold_place(shape): # debugprint('thumb_ml_place()') # shape = rotate(shape, [6, -34, 40]) # shape = translate(shape, thumborigin()) @@ -1831,118 +1840,120 @@ def trackball_thumb_bl_place(shape): # return shape -def trackball_thumb_1x_layout(shape): +def tbjs_thumb_1x_layout(shape): return union([ - trackball_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])), - # trackball_thumb_tlold_place(rotate(shape, [0, 0, thumb_plate_tl_rotation])), - # trackball_thumb_mlold_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])), - trackball_thumb_mr_place(rotate(shape, [0, 0, thumb_plate_mr_rotation])), - trackball_thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])), - trackball_thumb_br_place(rotate(shape, [0, 0, thumb_plate_br_rotation])), + tbjs_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])), + # tbjs_thumb_tlold_place(rotate(shape, [0, 0, thumb_plate_tl_rotation])), + # tbjs_thumb_mlold_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])), + tbjs_thumb_mr_place(rotate(shape, [0, 0, thumb_plate_mr_rotation])), + tbjs_thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])), + tbjs_thumb_br_place(rotate(shape, [0, 0, thumb_plate_br_rotation])), ]) -def trackball_thumb_fx_layout(shape): +def tbjs_thumb_fx_layout(shape): return union([ - # trackball_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])), - # trackball_thumb_tlold_place(rotate(shape, [0, 0, thumb_plate_tl_rotation])), - # trackball_thumb_mlold_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])), - # trackball_thumb_mr_place(rotate(shape, [0, 0, thumb_plate_mr_rotation])), - # trackball_thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])), - # trackball_thumb_br_place(rotate(shape, [0, 0, thumb_plate_br_rotation])), + # tbjs_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])), + # tbjs_thumb_tlold_place(rotate(shape, [0, 0, thumb_plate_tl_rotation])), + # tbjs_thumb_mlold_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])), + # tbjs_thumb_mr_place(rotate(shape, [0, 0, thumb_plate_mr_rotation])), + # tbjs_thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])), + # tbjs_thumb_br_place(rotate(shape, [0, 0, thumb_plate_br_rotation])), ]) def trackball_layout(shape): return union([ - trackball_place(rotate(shape, [0, 0, trackball_rotation])), + # Relocating positioning to individual parts due to complexity. + # tbjs_place(rotate(shape, [0, 0, trackball_rotation])), + tbjs_place(shape), ]) -def trackball_thumbcaps(): - t1 = trackball_thumb_1x_layout(sa_cap(1)) - # t1.add(trackball_thumb_15x_layout(rotate(sa_cap(1), [0, 0, rad2deg(pi / 2)]))) +def tbjs_thumbcaps(): + t1 = tbjs_thumb_1x_layout(sa_cap(1)) + # t1.add(tbjs_thumb_15x_layout(rotate(sa_cap(1), [0, 0, rad2deg(pi / 2)]))) return t1 -def trackball_thumb(side="right"): - shape = trackball_thumb_fx_layout(rotate(single_plate(side=side), [0.0, 0.0, -90])) - shape = union([shape, trackball_thumb_fx_layout(double_plate())]) - shape = union([shape, trackball_thumb_1x_layout(single_plate(side=side))]) +def tbjs_thumb(side="right"): + shape = tbjs_thumb_fx_layout(rotate(single_plate(side=side), [0.0, 0.0, -90])) + shape = union([shape, tbjs_thumb_fx_layout(double_plate())]) + shape = union([shape, tbjs_thumb_1x_layout(single_plate(side=side))]) # shape = union([shape, trackball_layout(trackball_socket())]) - # shape = trackball_thumb_1x_layout(single_plate(side=side)) + # shape = tbjs_thumb_1x_layout(single_plate(side=side)) return shape -def trackball_thumb_post_tr(): +def tbjs_thumb_post_tr(): debugprint('thumb_post_tr()') return translate(web_post(), [(mount_width / 2) - post_adj, ((mount_height/2) + adjustable_plate_size(trackball_Usize)) - post_adj, 0] ) -def trackball_thumb_post_tl(): +def tbjs_thumb_post_tl(): debugprint('thumb_post_tl()') return translate(web_post(), [-(mount_width / 2) + post_adj, ((mount_height/2) + adjustable_plate_size(trackball_Usize)) - post_adj, 0] ) -def trackball_thumb_post_bl(): +def tbjs_thumb_post_bl(): debugprint('thumb_post_bl()') return translate(web_post(), [-(mount_width / 2) + post_adj, -((mount_height/2) + adjustable_plate_size(trackball_Usize)) + post_adj, 0] ) -def trackball_thumb_post_br(): +def tbjs_thumb_post_br(): debugprint('thumb_post_br()') return translate(web_post(), [(mount_width / 2) - post_adj, -((mount_height/2) + adjustable_plate_size(trackball_Usize)) + post_adj, 0] ) -def trackball_post_r(): - debugprint('trackball_post_r()') +def tbjs_post_r(): + debugprint('tbjs_post_r()') radius = ball_diameter/2 + ball_wall_thickness + ball_gap return translate(web_post(), [1.0*(radius - post_adj), 0.0*(radius - post_adj), 0] ) -def trackball_post_tr(): - debugprint('trackball_post_tr()') +def tbjs_post_tr(): + debugprint('tbjs_post_tr()') radius = ball_diameter/2+ball_wall_thickness + ball_gap return translate(web_post(), [0.5*(radius - post_adj), 0.866*(radius - post_adj), 0] ) -def trackball_post_tl(): - debugprint('trackball_post_tl()') +def tbjs_post_tl(): + debugprint('tbjs_post_tl()') radius = ball_diameter/2+ball_wall_thickness + ball_gap return translate(web_post(), [-0.5*(radius - post_adj), 0.866*(radius - post_adj), 0] ) -def trackball_post_l(): - debugprint('trackball_post_l()') +def tbjs_post_l(): + debugprint('tbjs_post_l()') radius = ball_diameter/2+ball_wall_thickness + ball_gap return translate(web_post(), [-1.0*(radius - post_adj), 0.0*(radius - post_adj), 0] ) -def trackball_post_bl(): - debugprint('trackball_post_bl()') +def tbjs_post_bl(): + debugprint('tbjs_post_bl()') radius = ball_diameter/2+ball_wall_thickness + ball_gap return translate(web_post(), [-0.5*(radius - post_adj), -0.866*(radius - post_adj), 0] ) -def trackball_post_br(): - debugprint('trackball_post_br()') +def tbjs_post_br(): + debugprint('tbjs_post_br()') radius = ball_diameter/2+ball_wall_thickness + ball_gap return translate(web_post(), [0.5*(radius - post_adj), -0.866*(radius - post_adj), 0] @@ -1950,7 +1961,7 @@ def trackball_post_br(): -def trackball_thumb_connectors(): +def tbjs_thumb_connectors(): print('thumb_connectors()') hulls = [] @@ -1958,25 +1969,25 @@ def trackball_thumb_connectors(): hulls.append( triangle_hulls( [ - trackball_place(trackball_post_l()), - trackball_thumb_bl_place(web_post_tl()), - trackball_place(trackball_post_bl()), - trackball_thumb_bl_place(web_post_tr()), - trackball_thumb_br_place(web_post_tl()), - trackball_place(trackball_post_bl()), - trackball_thumb_br_place(web_post_tr()), - trackball_place(trackball_post_br()), - trackball_thumb_br_place(web_post_tr()), - trackball_place(trackball_post_br()), - trackball_thumb_mr_place(web_post_br()), - trackball_place(trackball_post_r()), - trackball_thumb_mr_place(web_post_bl()), - trackball_thumb_tl_place(web_post_br()), - trackball_place(trackball_post_r()), - trackball_thumb_tl_place(web_post_bl()), - trackball_place(trackball_post_tr()), + tbjs_place(tbjs_post_l()), + tbjs_thumb_bl_place(web_post_tl()), + tbjs_place(tbjs_post_bl()), + tbjs_thumb_bl_place(web_post_tr()), + tbjs_thumb_br_place(web_post_tl()), + tbjs_place(tbjs_post_bl()), + tbjs_thumb_br_place(web_post_tr()), + tbjs_place(tbjs_post_br()), + tbjs_thumb_br_place(web_post_tr()), + tbjs_place(tbjs_post_br()), + tbjs_thumb_mr_place(web_post_br()), + tbjs_place(tbjs_post_r()), + tbjs_thumb_mr_place(web_post_bl()), + tbjs_thumb_tl_place(web_post_br()), + tbjs_place(tbjs_post_r()), + tbjs_thumb_tl_place(web_post_bl()), + tbjs_place(tbjs_post_tr()), key_place(web_post_bl(), 0, cornerrow), - trackball_place(trackball_post_tl()), + tbjs_place(tbjs_post_tl()), ] ) ) @@ -1985,10 +1996,10 @@ def trackball_thumb_connectors(): hulls.append( triangle_hulls( [ - trackball_thumb_bl_place(web_post_tr()), - trackball_thumb_br_place(web_post_tl()), - trackball_thumb_bl_place(web_post_br()), - trackball_thumb_br_place(web_post_bl()), + tbjs_thumb_bl_place(web_post_tr()), + tbjs_thumb_br_place(web_post_tl()), + tbjs_thumb_bl_place(web_post_br()), + tbjs_thumb_br_place(web_post_bl()), ] ) ) @@ -1997,21 +2008,10 @@ def trackball_thumb_connectors(): hulls.append( triangle_hulls( [ - trackball_thumb_br_place(web_post_tr()), - trackball_thumb_mr_place(web_post_br()), - trackball_thumb_br_place(web_post_br()), - trackball_thumb_mr_place(web_post_tr()), - ] - ) - ) - # top right - hulls.append( - triangle_hulls( - [ - trackball_thumb_mr_place(web_post_bl()), - trackball_thumb_tl_place(web_post_br()), - trackball_thumb_mr_place(web_post_tl()), - trackball_thumb_tl_place(web_post_tr()), + tbjs_thumb_br_place(web_post_tr()), + tbjs_thumb_mr_place(web_post_br()), + tbjs_thumb_br_place(web_post_br()), + tbjs_thumb_mr_place(web_post_tr()), ] ) ) @@ -2019,91 +2019,13 @@ def trackball_thumb_connectors(): hulls.append( triangle_hulls( [ - key_place(web_post_bl(), 0, cornerrow), - left_key_place(web_post(), lastrow - 1, -1, side=ball_side, low_corner=True), # left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True), - trackball_place(trackball_post_tl()), - ] - ) - ) - - # temp_shape1 = wall_brace( - # (lambda sh: left_key_place(sh, y, 1, side=side)), -1, 0, web_post(), - # (lambda sh: left_key_place(sh, y, -1, low_corner=low, side=side)), -1, 0, web_post(), - # ) - # temp_shape2 = hull_from_shapes(( - # key_place(web_post_tl(), 0, y), - # key_place(web_post_bl(), 0, y), - # left_key_place(web_post(), y, 1, side=side), - # left_key_place(web_post(), y, -1, low_corner=low, side=side), - # )) - # shape = union([shape, temp_shape1]) - # shape = union([shape, temp_shape2]) - - # # top two to the middle two, starting on the left - # hulls.append( - # triangle_hulls( - # [ - # trackball_thumb_br_place(web_post_tl()), - # trackball_thumb_bl_place(web_post_bl()), - # trackball_thumb_br_place(web_post_tr()), - # trackball_thumb_bl_place(web_post_br()), - # trackball_thumb_mr_place(web_post_tl()), - # trackball_thumb_mlold_place(web_post_bl()), - # trackball_thumb_mr_place(web_post_tr()), - # trackball_thumb_mlold_place(web_post_br()), - # ] - # ) - # ) - # - # - # hulls.append( - # triangle_hulls( - # [ - # trackball_thumb_tlold_place(trackball_thumb_post_tl()), - # trackball_thumb_mlold_place(web_post_tr()), - # trackball_thumb_tlold_place(trackball_thumb_post_bl()), - # trackball_thumb_mlold_place(web_post_br()), - # trackball_thumb_tlold_place(trackball_thumb_post_br()), - # trackball_thumb_mr_place(web_post_tr()), - # trackball_thumb_tl_place(web_post_bl()), - # trackball_thumb_mr_place(web_post_br()), - # trackball_thumb_tl_place(web_post_br()), - # ] - # ) - # ) - hulls.append( - triangle_hulls( - [ - key_place(web_post_bl(), 0, cornerrow), - trackball_thumb_tl_place(web_post_bl()), - key_place(web_post_br(), 0, cornerrow), - trackball_thumb_tl_place(web_post_tl()), - key_place(web_post_bl(), 1, cornerrow), - trackball_thumb_tl_place(web_post_tl()), - key_place(web_post_br(), 1, cornerrow), - trackball_thumb_tl_place(web_post_tr()), - key_place(web_post_tl(), 2, lastrow), - key_place(web_post_bl(), 2, lastrow), - trackball_thumb_tl_place(web_post_tr()), - key_place(web_post_bl(), 2, lastrow), - trackball_thumb_mr_place(web_post_tl()), - key_place(web_post_br(), 2, lastrow), - key_place(web_post_bl(), 3, lastrow), - trackball_thumb_mr_place(web_post_tr()), - trackball_thumb_mr_place(web_post_tl()), - key_place(web_post_br(), 2, lastrow), - - key_place(web_post_bl(), 3, lastrow), - key_place(web_post_tr(), 2, lastrow), - key_place(web_post_tl(), 3, lastrow), - key_place(web_post_bl(), 3, cornerrow), - key_place(web_post_tr(), 3, lastrow), - key_place(web_post_br(), 3, cornerrow), - key_place(web_post_bl(), 4, cornerrow), + tbjs_thumb_mr_place(web_post_bl()), + tbjs_thumb_tl_place(web_post_br()), + tbjs_thumb_mr_place(web_post_tl()), + tbjs_thumb_tl_place(web_post_tr()), ] ) ) - # trackball_place(trackball_thumb_post_tl()), hulls.append( triangle_hulls( @@ -2374,9 +2296,10 @@ def thumb_walls(side='right', style_override=None): return minidox_thumb_walls() elif _thumb_style == "CARBONFET": return carbonfet_thumb_walls() - elif _thumb_style == "TRACKBALL" : + elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): - return trackball_thumb_walls() + if _thumb_style == "TRACKBALL_ORBISSYL" : + return tbjs_thumb_walls() else: return thumb_walls(side, style_override=other_thumb) else: @@ -2394,9 +2317,10 @@ def thumb_connection(side='right', style_override=None): return minidox_thumb_connection(side=side) elif _thumb_style == "CARBONFET": return carbonfet_thumb_connection(side=side) - elif _thumb_style == "TRACKBALL": + elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): - return trackball_thumb_connection(side=side) + if _thumb_style == "TRACKBALL_ORBISSYL": + return tbjs_thumb_connection(side=side) else: return thumb_connection(side, style_override=other_thumb) else: @@ -2485,124 +2409,97 @@ def default_thumb_connection(side='right'): return shape -def trackball_thumb_walls(): +def tbjs_thumb_walls(): print('thumb_walls()') # thumb, walls shape = wall_brace( - trackball_thumb_mr_place, .5, 1, web_post_tr(), + tbjs_thumb_mr_place, .5, 1, web_post_tr(), (lambda sh: key_place(sh, 3, lastrow)), 0, -1, web_post_bl(), ) shape = union([shape, wall_brace( - trackball_thumb_mr_place, .5, 1, web_post_tr(), - trackball_thumb_br_place, 0, -1, web_post_br(), + tbjs_thumb_mr_place, .5, 1, web_post_tr(), + tbjs_thumb_br_place, 0, -1, web_post_br(), )]) shape = union([shape, wall_brace( - trackball_thumb_br_place, 0, -1, web_post_br(), - trackball_thumb_br_place, 0, -1, web_post_bl(), + tbjs_thumb_br_place, 0, -1, web_post_br(), + tbjs_thumb_br_place, 0, -1, web_post_bl(), )]) shape = union([shape, wall_brace( - trackball_thumb_br_place, 0, -1, web_post_bl(), - trackball_thumb_bl_place, 0, -1, web_post_br(), + tbjs_thumb_br_place, 0, -1, web_post_bl(), + tbjs_thumb_bl_place, 0, -1, web_post_br(), )]) shape = union([shape, wall_brace( - trackball_thumb_bl_place, 0, -1, web_post_br(), - trackball_thumb_bl_place, -1, -1, web_post_bl(), + tbjs_thumb_bl_place, 0, -1, web_post_br(), + tbjs_thumb_bl_place, -1, -1, web_post_bl(), )]) shape = union([shape, wall_brace( - trackball_place, -1.5, 0, trackball_post_tl(), + tbjs_place, -1.5, 0, tbjs_post_tl(), (lambda sh: left_key_place(sh, lastrow - 1, -1, side=ball_side, low_corner=True)), -1, 0, web_post(), )]) shape = union([shape, wall_brace( - trackball_place, -1.5, 0, trackball_post_tl(), - trackball_place, -1, 0, trackball_post_l(), + tbjs_place, -1.5, 0, tbjs_post_tl(), + tbjs_place, -1, 0, tbjs_post_l(), )]) shape = union([shape, wall_brace( - trackball_place, -1, 0, trackball_post_l(), - trackball_thumb_bl_place, -1, 0, web_post_tl(), + tbjs_place, -1, 0, tbjs_post_l(), + tbjs_thumb_bl_place, -1, 0, web_post_tl(), )]) shape = union([shape, wall_brace( - trackball_thumb_bl_place, -1, 0, web_post_tl(), - trackball_thumb_bl_place, -1, -1, web_post_bl(), + tbjs_thumb_bl_place, -1, 0, web_post_tl(), + tbjs_thumb_bl_place, -1, -1, web_post_bl(), )]) - # shape = union([wall_brace(trackball_thumb_mr_place, 0, -1, web_post_br(), trackball_thumb_tl_place, 0, -1, web_post_br())]) - # shape = union([shape, wall_brace(trackball_thumb_mr_place, 0, -1, web_post_br(), trackball_thumb_mr_place, 0, -1, web_post_bl())]) - # shape = union([shape, wall_brace(trackball_thumb_br_place, 0, -1, web_post_br(), trackball_thumb_br_place, 0, -1, web_post_bl())]) - # shape = union([shape, wall_brace(trackball_thumb_mlold_place, -0.3, 1, web_post_tr(), trackball_thumb_mlold_place, 0, 1, web_post_tl())]) - # shape = union([shape, wall_brace(trackball_thumb_bl_place, 0, 1, web_post_tr(), trackball_thumb_bl_place, 0, 1, web_post_tl())]) - # shape = union([shape, wall_brace(trackball_thumb_br_place, -1, 0, web_post_tl(), trackball_thumb_br_place, -1, 0, web_post_bl())]) - # shape = union([shape, wall_brace(trackball_thumb_bl_place, -1, 0, web_post_tl(), trackball_thumb_bl_place, -1, 0, web_post_bl())]) - # # thumb, corners - # shape = union([shape, wall_brace(trackball_thumb_br_place, -1, 0, web_post_bl(), trackball_thumb_br_place, 0, -1, web_post_bl())]) - # shape = union([shape, wall_brace(trackball_thumb_bl_place, -1, 0, web_post_tl(), trackball_thumb_bl_place, 0, 1, web_post_tl())]) - # # thumb, tweeners - # shape = union([shape, wall_brace(trackball_thumb_mr_place, 0, -1, web_post_bl(), trackball_thumb_br_place, 0, -1, web_post_br())]) - # shape = union([shape, wall_brace(trackball_thumb_mlold_place, 0, 1, web_post_tl(), trackball_thumb_bl_place, 0, 1, web_post_tr())]) - # shape = union([shape, wall_brace(trackball_thumb_bl_place, -1, 0, web_post_bl(), trackball_thumb_br_place, -1, 0, web_post_tl())]) - # shape = union([shape, wall_brace(trackball_thumb_tl_place, 0, -1, web_post_br(), (lambda sh: key_place(sh, 3, lastrow)), 0, -1, web_post_bl())]) - - return shape -def trackball_thumb_connection(side='right'): +def tbjs_thumb_connection(side='right'): print('thumb_connection()') # clunky bit on the top left thumb connection (normal connectors don't work well) + hulls = [] + hulls.append( + triangle_hulls( + [ + key_place(web_post_bl(), 0, cornerrow), + left_key_place(web_post(), lastrow - 1, -1, side=ball_side, low_corner=True), # left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True), + tbjs_place(tbjs_post_tl()), + ] + ) + ) - shape = box(.1,.1,.1) - - # shape = union([bottom_hull( - # [ - # key_place(web_post_bl(), 0, cornerrow), - # left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True), - # left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True), - # trackball_place(web_post_tl()), - # left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True), - # trackball_place(web_post_tl()), - # ] - # )]) - - # shape = union([shape, - # hull_from_shapes( - # [ - # left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True), - # left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True), - # trackball_thumb_mlold_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), - # trackball_thumb_mlold_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), - # trackball_thumb_tlold_place(trackball_thumb_post_tl()), - # ] - # ) - # ]) # ) - # - # shape = union([shape, hull_from_shapes( - # [ - # left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True), - # left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True), - # left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True), - # trackball_thumb_tlold_place(trackball_thumb_post_tl()), - # ] - # )]) - # - # shape = union([shape, hull_from_shapes( - # [ - # left_key_place(web_post(), cornerrow, -1, low_corner=True), - # left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True), - # key_place(web_post_bl(), 0, cornerrow), - # trackball_thumb_tlold_place(trackball_thumb_post_tl()), - # ] - # )]) - # - # shape = union([shape, hull_from_shapes( - # [ - # trackball_thumb_mlold_place(web_post_tr()), - # trackball_thumb_mlold_place(translate(web_post_tr(), wall_locate1(-0.3, 1))), - # trackball_thumb_mlold_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), - # trackball_thumb_mlold_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), - # trackball_thumb_tlold_place(trackball_thumb_post_tl()), - # ] - # )]) + hulls.append( + triangle_hulls( + [ + key_place(web_post_bl(), 0, cornerrow), + tbjs_thumb_tl_place(web_post_bl()), + key_place(web_post_br(), 0, cornerrow), + tbjs_thumb_tl_place(web_post_tl()), + key_place(web_post_bl(), 1, cornerrow), + tbjs_thumb_tl_place(web_post_tl()), + key_place(web_post_br(), 1, cornerrow), + tbjs_thumb_tl_place(web_post_tr()), + key_place(web_post_tl(), 2, lastrow), + key_place(web_post_bl(), 2, lastrow), + tbjs_thumb_tl_place(web_post_tr()), + key_place(web_post_bl(), 2, lastrow), + tbjs_thumb_mr_place(web_post_tl()), + key_place(web_post_br(), 2, lastrow), + key_place(web_post_bl(), 3, lastrow), + tbjs_thumb_mr_place(web_post_tr()), + tbjs_thumb_mr_place(web_post_tl()), + key_place(web_post_br(), 2, lastrow), + key_place(web_post_bl(), 3, lastrow), + key_place(web_post_tr(), 2, lastrow), + key_place(web_post_tl(), 3, lastrow), + key_place(web_post_bl(), 3, cornerrow), + key_place(web_post_tr(), 3, lastrow), + key_place(web_post_br(), 3, cornerrow), + key_place(web_post_bl(), 4, cornerrow), + ] + ) + ) + shape = union(hulls) return shape def mini_thumb_walls(): @@ -2944,28 +2841,40 @@ def external_mount_hole(): return shape def generate_trackball(pos, rot): + precut = trackball_cutout() + precut = rotate(precut, tb_socket_rotation_offset) + precut = translate(precut, tb_socket_translation_offset) precut = rotate(precut, rot) precut = translate(precut, pos) shape, cutout, sensor = trackball_socket() - shape = translate(shape, (0, 0, ball_z_offset)) + shape = rotate(shape, tb_socket_rotation_offset) + shape = translate(shape, tb_socket_translation_offset) shape = rotate(shape, rot) shape = translate(shape, pos) - cutout = translate(cutout, (0, 0, ball_z_offset)) + cutout = rotate(cutout, tb_socket_rotation_offset) + cutout = translate(cutout, tb_socket_translation_offset) + # cutout = rotate(cutout, tb_sensor_translation_offset) + # cutout = translate(cutout, tb_sensor_rotation_offset) cutout = rotate(cutout, rot) cutout = translate(cutout, pos) # Small adjustment due to line to line surface / minute numerical error issues # Creates small overlap to assist engines in union function later - sensor = translate(sensor, (0, 0, ball_z_offset+.001)) + sensor = rotate(sensor, tb_socket_rotation_offset) + sensor = translate(sensor, tb_socket_translation_offset) + # sensor = rotate(sensor, tb_sensor_translation_offset) + # sensor = translate(sensor, tb_sensor_rotation_offset) + sensor = translate(sensor, (0, 0, .001)) sensor = rotate(sensor, rot) sensor = translate(sensor, pos) ball = trackball_ball() - ball = translate(ball, (0, 0, ball_z_offset)) + ball = rotate(ball, tb_socket_rotation_offset) + ball = translate(ball, tb_socket_translation_offset) ball = rotate(ball, rot) ball = translate(ball, pos) @@ -2973,8 +2882,8 @@ def generate_trackball(pos, rot): return precut, shape, cutout, sensor, ball def generate_trackball_in_cluster(): - - pos, rot = trackball_position_rotation() + if thumb_style == 'TRACKBALL_ORBISSYL': + pos, rot = tbjs_thumb_position_rotation() return generate_trackball(pos, rot) @@ -3593,8 +3502,11 @@ def model_side(side="right"): shape = difference(shape, [hole]) shape = union([shape, frame]) - if trackball_in_wall and (side == ball_side or ball_side == 'both'): - tbprecut, tb, tbcutout, sensor, ball = generate_trackball_in_wall() + if (trackball_in_wall or ('TRACKBALL' in thumb_style)) and (side == ball_side or ball_side == 'both'): + if trackball_in_wall: + tbprecut, tb, tbcutout, sensor, ball = generate_trackball_in_wall() + elif 'TRACKBALL' in thumb_style: + tbprecut, tb, tbcutout, sensor, ball = generate_trackball_in_cluster() shape = difference(shape, [tbprecut]) # export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_1")) diff --git a/src/generate_configuration.py b/src/generate_configuration.py index d6f0180..f64ca84 100644 --- a/src/generate_configuration.py +++ b/src/generate_configuration.py @@ -7,8 +7,8 @@ r2d = 180 / pi shape_config = { - 'ENGINE': 'solid', # 'solid' = solid python / OpenSCAD, 'cadquery' = cadquery / OpenCascade - # 'ENGINE': 'cadquery', # 'solid' = solid python / OpenSCAD, 'cadquery' = cadquery / OpenCascade + 'ENGINE': 'solid', # 'solid' = solid python / OpenSCAD, 'cadquery' = cadquery / OpenCascade + # 'ENGINE': 'cadquery', # 'solid' = solid python / OpenSCAD, 'cadquery' = cadquery / OpenCascade ###################### @@ -44,11 +44,11 @@ shape_config = { ############################## # THUMB PARAMETERS ############################## - 'thumb_style': 'TRACKBALL', # 'DEFAULT' 6-key, 'MINI' 5-key, 'CARBONFET' 6-key, 'MINIDOX' 3-key, 'TRACKBALL' - 'default_1U_cluster': False, # only used with default, makes top right thumb cluster key 1U - 'minidox_Usize': 1.6 - , # Thumb key size. May need slight oversizing, check w/ caps. Additional spacing will be automatically added for larger keys. - + # 'DEFAULT' 6-key, 'MINI' 5-key, 'CARBONFET' 6-key, 'MINIDOX' 3-key, 'TRACKBALL_ORBISSYL', 'TRACKBALL_CJ' + 'thumb_style': 'TRACKBALL_ORBISSYL', + 'default_1U_cluster': True, # only used with default, makes top right thumb cluster key 1U + # Thumb key size. May need slight oversizing, check w/ caps. Additional spacing will be automatically added for larger keys. + 'minidox_Usize': 1.6, # Thumb plate rotations, anything other than 90 degree increments WILL NOT WORK. 'thumb_plate_tr_rotation': 0.0, # Top right plate rotation tweaks as thumb cluster is crowded for hot swap, etc. 'thumb_plate_tl_rotation': 0.0, # Top left plate rotation tweaks as thumb cluster is crowded for hot swap, etc. @@ -61,8 +61,6 @@ shape_config = { ## Trackball in Wall ## ################################### 'trackball_in_wall': False, # Separate trackball option, placing it in the OLED area - 'tbiw_hole_diameter': 36, - 'tbiw_hole_height': 40, 'tbiw_ball_center_row': 0.2, # up from cornerrow instead of down from top 'tbiw_translational_offset': (0.0, 0.0, 3), 'tbiw_rotation_offset': (0.0, 0.0, 0.0), @@ -79,16 +77,18 @@ shape_config = { ## Trackball JS Thumb Cluster ## ################################### 'other_thumb': 'DEFAULT', # cluster used for second thumb except if ball_side == 'both' - 'tbjs_key_diameter': 64, + 'tbjs_key_diameter': 70, # Offsets are per key and are applied before rotating into place around the ball # X and Y act like Tangential and Radial around the ball - 'tbjs_translational_offsets': [ - (0.0, 0.0, -3.0), - (0.0, 0.0, -3.0), - (0.0, 0.0, -3.0), - (0.0, 0.0, -3.0), + 'tbjs_translation_offset': (0, 0, 10), # applied to the whole assy + 'tbjs_rotation_offset': (0, 0, 0), # applied to the whole assy + 'tbjs_key_translation_offsets': [ + (0.0, 0.0, -3.0-5), + (0.0, 0.0, -3.0-5), + (0.0, 0.0, -3.0-5), + (0.0, 0.0, -3.0-5), ], - 'tbjs_rotation_offsets': [ + 'tbjs_key_rotation_offsets': [ (0.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, 0.0, 0.0), @@ -97,15 +97,22 @@ shape_config = { ################################### ## Trackball General ## ################################### + # EXPERIMENTAL + 'trackball_modular': False, # May add removable trackball in subsequent releases, no current use. + # END EXPERIMENTAL + 'trackball_Usize': 1.5, # size for inner key near trackball - 'trackball_rotation': 0.0, # used to rotate the sensor direction around z. - # 'trackball_sensor_rotation': 0.0, # used to rotate the sensor direction around z. - 'ball_side': 'right', + 'ball_side': 'both', 'ball_diameter': 34.0, - 'ball_wall_thickness': 3.0+2.0, # should not be changed unless the import models are changed. - 'ball_gap':1.0, - 'ball_z_offset': -3.0, - + 'ball_wall_thickness': 3, # should not be changed unless the import models are changed. + 'ball_gap': 1.0, + 'trackball_hole_diameter': 35, + 'trackball_hole_height': 40, + # Removed trackball_rotation, ball_z_offset. and trackball_sensor_rotation and added more flexibility. + 'tb_socket_translation_offset': (0, 0, 2.0), # applied to the socket and sensor, large values will cause web/wall issues. + 'tb_socket_rotation_offset': (0, 0, -90), # applied to the socket and sensor, large values will cause web/wall issues. + 'tb_sensor_translation_offset': (0, 0, 0), #deviation from socket offsets, for fixing generated geometry issues + 'tb_sensor_rotation_offset': (0, 0, 0), #deviation from socket offsets, for changing the sensor roll orientation ############################## # EXPERIMENTAL PARAMETERS @@ -327,7 +334,7 @@ shape_config = { ################################### ## HOLES ON PLATE FOR PCB MOUNT ################################### - 'plate_holes': True, + 'plate_holes': False, 'plate_holes_xy_offset': (0.0, 0.0), 'plate_holes_width': 14.3, 'plate_holes_height': 14.3, diff --git a/src/model_builder.py b/src/model_builder.py index d8a9fac..7cca387 100644 --- a/src/model_builder.py +++ b/src/model_builder.py @@ -3,12 +3,15 @@ import copy import importlib from generate_configuration import * -ENGINE = 'solid' -# ENGINE = 'cadquery' base = shape_config config_options = [ + { + 'name': '{}', 'vars': ['ball_side'], # set ball side to both, other half can come from other renders + 'vals': ['both'], + 'val_names': [''] + }, { 'name': '{}x{}', 'vars': ['nrows', 'ncols'], 'vals':[(4, 5), (5, 6)], @@ -21,8 +24,8 @@ config_options = [ }, { 'name': '{}TMB', 'vars': ['thumb_style'], - 'vals': ['DEFAULT', 'MINIDOX'], - 'val_names': ['DEF', 'MDOX'] + 'vals': ['DEFAULT', 'MINIDOX', 'TRACKBALL_ORBISSYL'], + 'val_names': ['DEF', 'MDOX', 'ORBY'] # 'vals': ['DEFAULT', 'MINI', 'CARBONFET', 'MINIDOX'], # 'val_names': ['DEF', 'MINI', 'CF', 'MDOX'] }, @@ -65,7 +68,9 @@ def create_config(config_options): else: n_input = vals - new_config['config_name'] += "_" + temp_opt['name'].format(*n_input) + name_ext = temp_opt['name'].format(*n_input) + if not name_ext == '': + new_config['config_name'] += "_" + name_ext new_config['save_dir'] = new_config['config_name'] new_configurations.append(new_config) configurations = new_configurations diff --git a/src/run_config.json b/src/run_config.json index 56d78cf..0930207 100644 --- a/src/run_config.json +++ b/src/run_config.json @@ -20,8 +20,8 @@ 7 ], "keyboard_z_offset": 11, - "thumb_style": "TRACKBALL", - "default_1U_cluster": false, + "thumb_style": "TRACKBALL_ORBISSYL", + "default_1U_cluster": true, "minidox_Usize": 1.6, "thumb_plate_tr_rotation": 0.0, "thumb_plate_tl_rotation": 0.0, @@ -30,8 +30,6 @@ "thumb_plate_br_rotation": 0.0, "thumb_plate_bl_rotation": 0.0, "trackball_in_wall": false, - "tbiw_hole_diameter": 36, - "tbiw_hole_height": 40, "tbiw_ball_center_row": 0.2, "tbiw_translational_offset": [ 0.0, @@ -59,30 +57,40 @@ 0 ], "other_thumb": "DEFAULT", - "tbjs_key_diameter": 64, - "tbjs_translational_offsets": [ + "tbjs_key_diameter": 70, + "tbjs_translation_offset": [ + 0, + 0, + 10 + ], + "tbjs_rotation_offset": [ + 0, + 0, + 0 + ], + "tbjs_key_translation_offsets": [ [ 0.0, 0.0, - -3.0 + -8.0 ], [ 0.0, 0.0, - -3.0 + -8.0 ], [ 0.0, 0.0, - -3.0 + -8.0 ], [ 0.0, 0.0, - -3.0 + -8.0 ] ], - "tbjs_rotation_offsets": [ + "tbjs_key_rotation_offsets": [ [ 0.0, 0.0, @@ -104,13 +112,34 @@ 0.0 ] ], + "trackball_modular": false, "trackball_Usize": 1.5, - "trackball_rotation": 0.0, - "ball_side": "right", + "ball_side": "both", "ball_diameter": 34.0, - "ball_wall_thickness": 5.0, + "ball_wall_thickness": 3, "ball_gap": 1.0, - "ball_z_offset": -3.0, + "trackball_hole_diameter": 35, + "trackball_hole_height": 40, + "tb_socket_translation_offset": [ + 0, + 0, + 2.0 + ], + "tb_socket_rotation_offset": [ + 0, + 0, + -90 + ], + "tb_sensor_translation_offset": [ + 0, + 0, + 0 + ], + "tb_sensor_rotation_offset": [ + 0, + 0, + 0 + ], "pinky_1_5U": false, "first_1_5U_row": 0, "last_1_5U_row": 5, @@ -295,7 +324,7 @@ "base_rim_thickness": 5.0, "screw_cbore_diameter": 4.0, "screw_cbore_depth": 2.0, - "plate_holes": true, + "plate_holes": false, "plate_holes_xy_offset": [ 0.0, 0.0 diff --git a/src/trackball_only_V09.FCStd b/src/trackball_only_V09.FCStd new file mode 100644 index 0000000..0cb73d9 Binary files /dev/null and b/src/trackball_only_V09.FCStd differ -- cgit v1.2.3