From cdcde68ed97b3b0712f264b3ed690015cddb98cf Mon Sep 17 00:00:00 2001 From: cjen1 Date: Thu, 5 Aug 2021 00:49:45 +0100 Subject: Add trackball --- src/dactyl_manuform.py | 370 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 369 insertions(+), 1 deletion(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index bb164b5..6396baf 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -702,6 +702,8 @@ def thumbcaps(): return minidox_thumbcaps() elif thumb_style == "CARBONFET": return carbonfet_thumbcaps() + elif thumb_style == "TRACKBALL": + return tb_thumbcaps() else: return default_thumbcaps() @@ -713,6 +715,8 @@ def thumb(side="right"): return minidox_thumb(side) elif thumb_style == "CARBONFET": return carbonfet_thumb(side) + elif thumb_style == "TRACKBALL": + return tb_thumb(side) else: return default_thumb(side) @@ -724,6 +728,8 @@ def thumb_connectors(): return minidox_thumb_connectors() elif thumb_style == "CARBONFET": return carbonfet_thumb_connectors() + elif thumb_style == "TRACKBALL": + return tb_thumb_connectors() else: return default_thumb_connectors() @@ -1653,6 +1659,360 @@ def carbonfet_thumb_connectors(): return union(hulls) +############################ +# TRACKBALL THUMB CLUSTER +############################ + +# single_plate = the switch shape + +def tb_thumb_tr_place(shape): + shape = rotate(shape, [10, -15, 10]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-12, -16, 3]) + return shape + +def tb_thumb_tl_place(shape): + shape = rotate(shape, [7.5, -18, 10]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-32.5, -14.5, -2.5]) + return shape + +def tb_thumb_ml_place(shape): + shape = rotate(shape, [6, -34, 40]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-51, -25, -12]) + return shape + +def tb_thumb_bl_place(shape): + shape = rotate(shape, [-4, -35, 52]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-56.3, -43.3, -23.5]) + return shape + +def tb_thumb_layout(shape): + return union([ + tb_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])), + tb_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation])), + tb_thumb_ml_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])), + tb_thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])), + ]) + + +#def oct_corner(i, radius, shape): +# i = (i+1)%8 +# +# points_x = [1, 2, 2, 1, -1, -2, -2, -1] +# points_y = [2, 1, -1, -2, -2, -1, 1, 2] +# +# return translate(shape, (points_x[i] * radius / 2, points_y[i] * radius / 2, 0)) + +import math +def oct_corner(i, diameter, shape): + radius = diameter / 2 + i = (i+1)%8 + + r = radius + m = radius * math.tan(math.pi / 8) + + points_x = [m, r, r, m, -m, -r, -r, -m] + points_y = [r, m, -m, -r, -r, -m, m, r] + + return translate(shape, (points_x[i], points_y[i], 0)) + +tb_inner_diameter = 42 +tb_thickness = 2 +tb_outer_diameter = 53 + +def trackball_edge_post(i): + shape = box(post_size, post_size, tb_thickness) + shape = oct_corner(i, tb_outer_diameter, shape) + return shape + +def trackball_web_post(i): + shape = box(post_size, post_size, tb_thickness) + shape = oct_corner(i, tb_outer_diameter, shape) + return shape + +def trackball_holder(): + center = box(post_size, post_size, tb_thickness) + + shape = [] + for i in range(8): + shape_ = hull_from_shapes([ + center, + trackball_edge_post(i), + trackball_edge_post(i+1), + ]) + shape.append(shape_) + shape = union(shape) + + shape = difference( + shape, + [cylinder(tb_inner_diameter/2, tb_thickness + 0.1)] + ) + + return shape + +def trackball_place(shape): + loc = np.array([-15, -60, -12]) + thumborigin() + shape = translate(shape, loc) + shape = rotate(shape, (0,0,0)) + return shape + +def tb_thumb(side="right"): + t = tb_thumb_layout(single_plate(side=side)) + tb = trackball_place(trackball_holder()) + return union([t, tb]) + +def tb_thumbcaps(): + t = tb_thumb_layout(sa_cap(1)) + return t + +def thumb_post_tr(): + return translate(web_post(), + [(mount_width / 2) - post_adj, ((mount_height/2) + double_plate_height) - post_adj, 0] + ) + + +def thumb_post_tl(): + return translate(web_post(), + [-(mount_width / 2) + post_adj, ((mount_height/2) + double_plate_height) - post_adj, 0] + ) + + +def thumb_post_bl(): + return translate(web_post(), + [-(mount_width / 2) + post_adj, -((mount_height/2) + double_plate_height) + post_adj, 0] + ) + + +def thumb_post_br(): + return translate(web_post(), + [(mount_width / 2) - post_adj, -((mount_height/2) + double_plate_height) + post_adj, 0] + ) + +def tb_thumb_connectors(): + hulls = [] + + # Top two + hulls.append( + triangle_hulls( + [ + tb_thumb_tl_place(web_post_tr()), + tb_thumb_tl_place(web_post_br()), + tb_thumb_tr_place(web_post_tl()), + tb_thumb_tr_place(web_post_bl()), + ] + ) + ) + + # centers of the bottom four + hulls.append( + triangle_hulls( + [ + tb_thumb_bl_place(web_post_tr()), + tb_thumb_bl_place(web_post_br()), + tb_thumb_ml_place(web_post_tl()), + tb_thumb_ml_place(web_post_bl()), + ] + ) + ) + + # top two to the middle two, starting on the left + + hulls.append( + triangle_hulls( + [ + tb_thumb_tl_place(web_post_tl()), + tb_thumb_ml_place(web_post_tr()), + tb_thumb_tl_place(web_post_bl()), + tb_thumb_ml_place(web_post_br()), + tb_thumb_tl_place(web_post_br()), + tb_thumb_tr_place(web_post_bl()), + tb_thumb_tr_place(web_post_br()), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + tb_thumb_tl_place(web_post_tl()), + key_place(web_post_bl(), 0, cornerrow), + tb_thumb_tl_place(web_post_tr()), + key_place(web_post_br(), 0, cornerrow), + tb_thumb_tr_place(web_post_tl()), + key_place(web_post_bl(), 1, cornerrow), + tb_thumb_tr_place(web_post_tr()), + key_place(web_post_br(), 1, cornerrow), + key_place(web_post_tl(), 2, lastrow), + key_place(web_post_bl(), 2, lastrow), + tb_thumb_tr_place(web_post_tr()), + key_place(web_post_bl(), 2, lastrow), + tb_thumb_tr_place(web_post_br()), + 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), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + key_place(web_post_br(), 1, cornerrow), + key_place(web_post_tl(), 2, lastrow), + key_place(web_post_bl(), 2, cornerrow), + key_place(web_post_tr(), 2, lastrow), + key_place(web_post_br(), 2, cornerrow), + key_place(web_post_bl(), 3, cornerrow), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + key_place(web_post_tr(), 3, lastrow), + key_place(web_post_br(), 3, lastrow), + key_place(web_post_tr(), 3, lastrow), + key_place(web_post_bl(), 4, cornerrow), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + trackball_place(trackball_web_post(4)), + tb_thumb_bl_place(web_post_bl()), + trackball_place(trackball_web_post(5)), + tb_thumb_bl_place(web_post_br()), + trackball_place(trackball_web_post(6)), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + tb_thumb_bl_place(web_post_br()), + trackball_place(trackball_web_post(6)), + tb_thumb_ml_place(web_post_bl()), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + tb_thumb_ml_place(web_post_bl()), + trackball_place(trackball_web_post(6)), + tb_thumb_ml_place(web_post_br()), + tb_thumb_tr_place(web_post_bl()), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + trackball_place(trackball_web_post(6)), + tb_thumb_tr_place(web_post_bl()), + trackball_place(trackball_web_post(7)), + tb_thumb_tr_place(web_post_br()), + trackball_place(trackball_web_post(0)), + tb_thumb_tr_place(web_post_br()), + key_place(web_post_bl(), 3, lastrow), + ] + ) + ) + + return union(hulls) + +def tb_thumb_walls(): + shape = union([wall_brace(tb_thumb_ml_place, -0.3, 1, web_post_tr(), tb_thumb_ml_place, 0, 1, web_post_tl())]) + shape = union([shape, wall_brace(tb_thumb_bl_place, 0, 1, web_post_tr(), tb_thumb_bl_place, 0, 1, web_post_tl())]) + shape = union([shape, wall_brace(tb_thumb_bl_place, -1, 0, web_post_tl(), tb_thumb_bl_place, -1, 0, web_post_bl())]) + shape = union([shape, wall_brace(tb_thumb_bl_place, -1, 0, web_post_tl(), tb_thumb_bl_place, 0, 1, web_post_tl())]) + shape = union([shape, wall_brace(tb_thumb_ml_place, 0, 1, web_post_tl(), tb_thumb_bl_place, 0, 1, web_post_tr())]) + + corner = box(1,1,tb_thickness) + + points = [ + (tb_thumb_bl_place, -1, 0, web_post_bl()), + (trackball_place, 0, -1, trackball_web_post(4)), + (trackball_place, 0, -1, trackball_web_post(3)), + (trackball_place, 0, -1, trackball_web_post(2)), + (trackball_place, 1, -1, trackball_web_post(1)), + (trackball_place, 1, 0, trackball_web_post(0)), + ((lambda sh: key_place(sh, 3, lastrow)), 0, -1, web_post_bl()), + ] + for i,_ in enumerate(points[:-1]): + (pa, dxa, dya, sa) = points[i] + (pb, dxb, dyb, sb) = points[i + 1] + + shape = union([shape, wall_brace(pa, dxa, dya, sa, pb, dxb, dyb, sb)]) + + return shape + +def tb_thumb_connection(): + # clunky bit on the top left thumb connection (normal connectors don't work well) + shape = union([bottom_hull( + [ + 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), + thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), + thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), + ] + )]) + + 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), + thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), + thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), + thumb_tl_place(web_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), + thumb_tl_place(web_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), + thumb_tl_place(web_post_tl()), + ] + )]) + + shape = union([shape, hull_from_shapes( + [ + thumb_ml_place(web_post_tr()), + thumb_ml_place(translate(web_post_tr(), wall_locate1(-0.3, 1))), + thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), + thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), + thumb_tl_place(web_post_tl()), + ] + )]) + + return shape ########## ## Case ## @@ -1918,6 +2278,8 @@ def thumb_walls(): return minidox_thumb_walls() elif thumb_style == "CARBONFET": return carbonfet_thumb_walls() + elif thumb_style == "TRACKBALL": + return tb_thumb_walls() else: return default_thumb_walls() @@ -1928,6 +2290,8 @@ def thumb_connection(): return minidox_thumb_connection() elif thumb_style == "CARBONFET": return carbonfet_thumb_connection() + elif thumb_style == "TRACKBALL": + return tb_thumb_connection() else: return default_thumb_connection() @@ -2759,6 +3123,10 @@ def screw_insert_thumb(bottom_radius, top_radius, height): position = thumborigin() position = list(np.array(position) + np.array([-48, -37, 0])) position[2] = 0 + elif thumb_style == 'TRACKBALL': + position = thumborigin() + position = list(np.array(position) + np.array([-72, -40, -16])) + position[2] = 0 else: position = thumborigin() @@ -3040,4 +3408,4 @@ def run(): # base = baseplate() # export_file(shape=base, fname=path.join(save_path, config_name + r"_plate")) if __name__ == '__main__': - run() \ No newline at end of file + run() -- cgit v1.2.3 From 507a4b22b238689bda96380df7bf38e1f0e7ee3a Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Thu, 5 Aug 2021 07:50:27 -0400 Subject: Interim commit with partially functioning trackball. trackball in wall is mostly working (still WIP), trackball cluster has layout but no webs or walls. --- src/dactyl_manuform.py | 674 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 590 insertions(+), 84 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index bb164b5..34df21f 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -118,6 +118,8 @@ if oled_mount_type is not None and oled_mount_type != "NONE": left_wall_lower_y_offset = oled_left_wall_lower_y_offset left_wall_lower_z_offset = oled_left_wall_lower_z_offset + + cap_top_height = plate_thickness + sa_profile_key_height row_radius = ((mount_height + extra_height) / 2) / (np.sin(alpha / 2)) + cap_top_height column_radius = ( @@ -263,6 +265,26 @@ 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) + return shape + +def trackball_socket(segments=100, side="right"): + # shape = sphere(ball_diameter / 2) + # cyl = cylinder(ball_diameter / 2 + 4, 20) + # cyl = translate(cyl, (0, 0, -8)) + # shape = union([shape, cyl]) + tb_file = path.join("..", "src", r"ball_socket_v00") + shape = import_file(tb_file) + shape = translate(shape, (0, 0, ball_z_offset)) + + return shape + +def trackball_ball(segments=100, side="right"): + shape = sphere(ball_diameter / 2) + shape = translate(shape, (0, 0, ball_z_offset)) + + return shape ################ ## SA Keycaps ## @@ -548,7 +570,7 @@ def thumborigin(): origin[i] = origin[i] + thumb_offsets[i] if thumb_style == 'MINIDOX': - origin[1] = origin[1] - .4*(minidox_Usize-1)*sa_length + origin[1] = origin[1] - .4*(trackball_Usize-1)*sa_length return origin @@ -695,13 +717,15 @@ def double_plate(): return union((top_plate, mirror(top_plate, 'XZ'))) -def thumbcaps(): +def thumbcaps(side='right'): if thumb_style == "MINI": return mini_thumbcaps() elif thumb_style == "MINIDOX": return minidox_thumbcaps() elif thumb_style == "CARBONFET": return carbonfet_thumbcaps() + elif thumb_style == "TRACKBALL": + return trackball_thumbcaps() else: return default_thumbcaps() @@ -713,17 +737,24 @@ def thumb(side="right"): return minidox_thumb(side) elif thumb_style == "CARBONFET": return carbonfet_thumb(side) + elif thumb_style == "TRACKBALL": + if side == ball_side: + return trackball_thumb(side) + else: + return default_thumb(side) else: return default_thumb(side) -def thumb_connectors(): +def thumb_connectors(side='right'): if thumb_style == "MINI": return mini_thumb_connectors() elif thumb_style == "MINIDOX": return minidox_thumb_connectors() elif thumb_style == "CARBONFET": return carbonfet_thumb_connectors() + elif thumb_style == "TRACKBALL": + return trackball_thumb_connectors() else: return default_thumb_connectors() @@ -1654,6 +1685,320 @@ def carbonfet_thumb_connectors(): return union(hulls) +############################ +# Trackball (Ball + 4-key) THUMB CLUSTER +############################ + +def trackball_place(shape): + shape = rotate(shape, [10, -15, 5]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-42, -20, -5]) + return shape + + +def trackball_thumb_tl_place(shape): + debugprint('thumb_tr_place()') + shape = rotate(shape, [10, -5, 25]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-14, -10, 0]) + return shape + +def trackball_thumb_mr_place(shape): + debugprint('thumb_mr_place()') + shape = rotate(shape, [-7, -20, 75]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-13, -32, -5]) + return shape + +def trackball_thumb_br_place(shape): + debugprint('thumb_br_place()') + shape = rotate(shape, [-10, -25, 90]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-40, -48, -16]) + return shape + + +def trackball_thumb_bl_place(shape): + debugprint('thumb_bl_place()') + shape = rotate(shape, [0, -25, 45]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-60.5, -38.5, -18]) + return shape + + +def trackball_thumb_tlold_place(shape): + debugprint('thumb_tl_place()') + shape = rotate(shape, [7.5, -10, 10]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-32.5, -14.5, -4]) + return shape + + +def trackball_thumb_mlold_place(shape): + debugprint('thumb_ml_place()') + shape = rotate(shape, [6, -34, 40]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-51, -25, -12]) + return shape + + +def trackball_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])), + ]) + + +def trackball_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])), + ]) + +def trackball_layout(shape): + return union([ + trackball_place(rotate(shape, [0, 0, trackball_rotation])), + ]) + + +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)]))) + 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))]) + + shape = union([shape, trackball_layout(trackball_socket())]) + # shape = trackball_thumb_1x_layout(single_plate(side=side)) + return shape + + +def trackball_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(): + 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(): + 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(): + 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()') + radius = ball_diameter/2+ball_wall_thickness + return translate(web_post(), + [1.0*(radius - post_adj), 0.0*(radius - post_adj), 0] + ) + + +def trackball_post_tr(): + debugprint('trackball_post_tr()') + radius = ball_diameter/2+ball_wall_thickness + return translate(web_post(), + [0.5*(radius - post_adj), 0.866*(radius - post_adj), 0] + ) + + +def trackball_post_tl(): + debugprint('trackball_post_tl()') + radius = ball_diameter/2+ball_wall_thickness + return translate(web_post(), + [-0.5*(radius - post_adj), 0.866*(radius - post_adj), 0] + ) + + +def trackball_post_l(): + debugprint('trackball_post_l()') + radius = ball_diameter/2+ball_wall_thickness + return translate(web_post(), + [-1.0*(radius - post_adj), 0.0*(radius - post_adj), 0] + ) + +def trackball_post_bl(): + debugprint('trackball_post_bl()') + radius = ball_diameter/2+ball_wall_thickness + return translate(web_post(), + [-0.5*(radius - post_adj), -0.866*(radius - post_adj), 0] + ) + + +def trackball_post_br(): + debugprint('trackball_post_br()') + radius = ball_diameter/2+ball_wall_thickness + return translate(web_post(), + [0.5*(radius - post_adj), -0.866*(radius - post_adj), 0] + ) + + + +def trackball_thumb_connectors(): + print('thumb_connectors()') + hulls = [] + + # # Top two + # hulls.append( + # triangle_hulls( + # [ + # trackball_thumb_tlold_place(trackball_thumb_post_tr()), + # trackball_thumb_tlold_place(trackball_thumb_post_br()), + # trackball_thumb_tl_place(web_post_tl()), + # trackball_thumb_tl_place(web_post_bl()), + # ] + # ) + # ) + # + # # bottom two on the right + # hulls.append( + # triangle_hulls( + # [ + # trackball_thumb_br_place(web_post_tr()), + # trackball_thumb_br_place(web_post_br()), + # trackball_thumb_mr_place(web_post_tl()), + # trackball_thumb_mr_place(web_post_bl()), + # ] + # ) + # ) + # + # # bottom two on the left + # hulls.append( + # triangle_hulls( + # [ + # trackball_thumb_br_place(web_post_tr()), + # trackball_thumb_br_place(web_post_br()), + # trackball_thumb_mr_place(web_post_tl()), + # trackball_thumb_mr_place(web_post_bl()), + # ] + # ) + # ) + # # centers of the bottom four + # hulls.append( + # triangle_hulls( + # [ + # trackball_thumb_bl_place(web_post_tr()), + # trackball_thumb_bl_place(web_post_br()), + # trackball_thumb_mlold_place(web_post_tl()), + # trackball_thumb_mlold_place(web_post_bl()), + # ] + # ) + # ) + # + # # 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( + [ + # trackball_thumb_tlold_place(trackball_thumb_post_tl()), + key_place(web_post_bl(), 0, cornerrow), + trackball_thumb_tlold_place(trackball_thumb_post_tr()), + 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_tr()), + key_place(web_post_br(), 1, cornerrow), + 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_tl_place(web_post_br()), + 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), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + key_place(web_post_br(), 1, cornerrow), + key_place(web_post_tl(), 2, lastrow), + key_place(web_post_bl(), 2, cornerrow), + key_place(web_post_tr(), 2, lastrow), + key_place(web_post_br(), 2, cornerrow), + key_place(web_post_bl(), 3, cornerrow), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + key_place(web_post_tr(), 3, lastrow), + key_place(web_post_br(), 3, lastrow), + key_place(web_post_tr(), 3, lastrow), + key_place(web_post_bl(), 4, cornerrow), + ] + ) + ) + + return union(hulls) + + ########## ## Case ## ########## @@ -1702,11 +2047,17 @@ def bottom_hull(p, height=0.001): return shape -def left_key_position(row, direction, low_corner=False): +def left_key_position(row, direction, low_corner=False, side='right'): debugprint("left_key_position()") pos = np.array( key_position([-mount_width * 0.5, direction * mount_height * 0.5, 0], 0, row) ) + if trackball_in_wall and side==ball_side: + left_wall_x_offset = tbiw_left_wall_x_offset_override + left_wall_z_offset = tbiw_left_wall_z_offset_override + left_wall_lower_y_offset = tbiw_left_wall_lower_y_offset + left_wall_lower_z_offset = tbiw_left_wall_lower_z_offset + if low_corner: y_offset = left_wall_lower_y_offset z_offset = left_wall_lower_z_offset @@ -1717,9 +2068,9 @@ def left_key_position(row, direction, low_corner=False): return list(pos - np.array([left_wall_x_offset, -y_offset, left_wall_z_offset + z_offset])) -def left_key_place(shape, row, direction, low_corner=False): +def left_key_place(shape, row, direction, low_corner=False, side='right'): debugprint("left_key_place()") - pos = left_key_position(row, direction, low_corner=low_corner) + pos = left_key_position(row, direction, low_corner=low_corner, side=side) return translate(shape, pos) @@ -1838,30 +2189,30 @@ def right_wall(): return shape -def left_wall(): +def left_wall(side='right'): print('left_wall()') shape = union([wall_brace( (lambda sh: key_place(sh, 0, 0)), 0, 1, web_post_tl(), - (lambda sh: left_key_place(sh, 0, 1)), 0, 1, web_post(), + (lambda sh: left_key_place(sh, 0, 1, side=side)), 0, 1, web_post(), )]) shape = union([shape, wall_brace( - (lambda sh: left_key_place(sh, 0, 1)), 0, 1, web_post(), - (lambda sh: left_key_place(sh, 0, 1)), -1, 0, web_post(), + (lambda sh: left_key_place(sh, 0, 1, side=side)), 0, 1, web_post(), + (lambda sh: left_key_place(sh, 0, 1, side=side)), -1, 0, web_post(), )]) for i in range(lastrow): y = i low = (y == (lastrow-1)) temp_shape1 = wall_brace( - (lambda sh: left_key_place(sh, y, 1,)), -1, 0, web_post(), - (lambda sh: left_key_place(sh, y, -1, low_corner=low)), -1, 0, web_post(), + (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), - left_key_place(web_post(), y, -1, low_corner=low), + 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]) @@ -1870,14 +2221,14 @@ def left_wall(): y = i + 1 low = (y == (lastrow-1)) temp_shape1 = wall_brace( - (lambda sh: left_key_place(sh, y - 1, -1)), -1, 0, web_post(), - (lambda sh: left_key_place(sh, y, 1)), -1, 0, web_post(), + (lambda sh: left_key_place(sh, y - 1, -1, side=side)), -1, 0, web_post(), + (lambda sh: left_key_place(sh, y, 1, 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 - 1), - left_key_place(web_post(), y, 1), - left_key_place(web_post(), y - 1, -1), + left_key_place(web_post(), y, 1, side=side), + left_key_place(web_post(), y - 1, -1, side=side), )) shape = union([shape, temp_shape1]) shape = union([shape, temp_shape2]) @@ -1918,18 +2269,22 @@ def thumb_walls(): return minidox_thumb_walls() elif thumb_style == "CARBONFET": return carbonfet_thumb_walls() + elif thumb_style == "TRACKBALL": + return trackball_thumb_walls() else: return default_thumb_walls() -def thumb_connection(): +def thumb_connection(side='right'): if thumb_style == "MINI": - return mini_thumb_connection() + return mini_thumb_connection(side=side) if thumb_style == "MINIDOX": - return minidox_thumb_connection() + return minidox_thumb_connection(side=side) elif thumb_style == "CARBONFET": - return carbonfet_thumb_connection() + return carbonfet_thumb_connection(side=side) + elif thumb_style == "TRACKBALL": + return trackball_thumb_connection(side=side) else: - return default_thumb_connection() + return default_thumb_connection(side=side) def default_thumb_walls(): print('thumb_walls()') @@ -1959,13 +2314,13 @@ def default_thumb_walls(): return shape -def default_thumb_connection(): +def default_thumb_connection(side='right'): print('thumb_connection()') # clunky bit on the top left thumb connection (normal connectors don't work well) shape = union([bottom_hull( [ - 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), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), ] @@ -1974,8 +2329,8 @@ def default_thumb_connection(): 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), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), thumb_tl_place(thumb_post_tl()), @@ -1985,17 +2340,17 @@ def default_thumb_connection(): 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), + left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), thumb_tl_place(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), + left_key_place(web_post(), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), key_place(web_post_bl(), 0, cornerrow), thumb_tl_place(thumb_post_tl()), ] @@ -2013,6 +2368,88 @@ def default_thumb_connection(): return shape +def trackball_thumb_walls(): + print('thumb_walls()') + # thumb, walls + # 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())]) + + 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'): + print('thumb_connection()') + # clunky bit on the top left thumb connection (normal connectors don't work well) + + shape = box(.1,.1,.1) + + # shape = union([bottom_hull( + # [ + # 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))), + # ] + # )]) + + # 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()), + # ] + # )]) + + return shape + def mini_thumb_walls(): # thumb, walls shape = union([wall_brace(mini_thumb_mr_place, 0, -1, web_post_br(), mini_thumb_tr_place, 0, -1, mini_thumb_post_br())]) @@ -2031,12 +2468,12 @@ def mini_thumb_walls(): return shape -def mini_thumb_connection(): +def mini_thumb_connection(side='right'): # clunky bit on the top left thumb connection (normal connectors don't work well) shape = union([bottom_hull( [ - 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), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), mini_thumb_bl_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), mini_thumb_bl_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), ] @@ -2045,8 +2482,8 @@ def mini_thumb_connection(): 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), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), mini_thumb_bl_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), mini_thumb_bl_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), mini_thumb_tl_place(web_post_tl()), @@ -2056,10 +2493,10 @@ def mini_thumb_connection(): 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), - 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), + left_key_place(web_post(), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), mini_thumb_tl_place(web_post_tl()), ] )]) @@ -2067,8 +2504,8 @@ def mini_thumb_connection(): 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), + left_key_place(web_post(), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), key_place(web_post_bl(), 0, cornerrow), mini_thumb_tl_place(web_post_tl()), ] @@ -2106,12 +2543,12 @@ def minidox_thumb_walls(): return shape -def minidox_thumb_connection(): +def minidox_thumb_connection(side='right'): # clunky bit on the top left thumb connection (normal connectors don't work well) shape = union([bottom_hull( [ - 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), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), minidox_thumb_bl_place(translate(minidox_thumb_post_tr(), wall_locate2(-0.3, 1))), minidox_thumb_bl_place(translate(minidox_thumb_post_tr(), wall_locate3(-0.3, 1))), ] @@ -2120,8 +2557,8 @@ def minidox_thumb_connection(): 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), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), minidox_thumb_ml_place(translate(minidox_thumb_post_tr(), wall_locate2(-0.3, 1))), minidox_thumb_ml_place(translate(minidox_thumb_post_tr(), wall_locate3(-0.3, 1))), minidox_thumb_tl_place(minidox_thumb_post_tl()), @@ -2131,10 +2568,10 @@ def minidox_thumb_connection(): 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), - 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), + left_key_place(web_post(), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), minidox_thumb_tl_place(minidox_thumb_post_tl()), ] )]) @@ -2142,8 +2579,8 @@ def minidox_thumb_connection(): 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), + left_key_place(web_post(), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), key_place(web_post_bl(), 0, cornerrow), # key_place(translate(web_post_bl(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True), minidox_thumb_tl_place(minidox_thumb_post_tl()), @@ -2182,12 +2619,12 @@ def carbonfet_thumb_walls(): shape = union([shape, wall_brace(carbonfet_thumb_tr_place, 0, -1, web_post_br(), (lambda sh: key_place(sh, 3, lastrow)), 0, -1, web_post_bl())]) return shape -def carbonfet_thumb_connection(): +def carbonfet_thumb_connection(side='right'): # clunky bit on the top left thumb connection (normal connectors don't work well) shape = bottom_hull( [ - 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), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), carbonfet_thumb_bl_place(translate(thumb_post_tr(), wall_locate2(-0.3, 1))), carbonfet_thumb_bl_place(translate(thumb_post_tr(), wall_locate3(-0.3, 1))), ] @@ -2196,8 +2633,8 @@ def carbonfet_thumb_connection(): 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), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), carbonfet_thumb_bl_place(translate(thumb_post_tr(), wall_locate2(-0.3, 1))), carbonfet_thumb_bl_place(translate(thumb_post_tr(), wall_locate3(-0.3, 1))), carbonfet_thumb_ml_place(thumb_post_tl()), @@ -2207,10 +2644,10 @@ def carbonfet_thumb_connection(): 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), - 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), + left_key_place(web_post(), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), carbonfet_thumb_ml_place(thumb_post_tl()), ] )]) @@ -2218,8 +2655,8 @@ def carbonfet_thumb_connection(): 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), + left_key_place(web_post(), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), key_place(web_post_bl(), 0, cornerrow), carbonfet_thumb_ml_place(thumb_post_tl()), ] @@ -2238,16 +2675,16 @@ def carbonfet_thumb_connection(): return shape -def case_walls(): +def case_walls(side='right'): print('case_walls()') return ( union([ back_wall(), - left_wall(), + left_wall(side=side), right_wall(), front_wall(), thumb_walls(), - thumb_connection(), + thumb_connection(side=side), ]) ) @@ -2348,27 +2785,83 @@ def external_mount_hole(): ) return shape -if oled_center_row is not None: +def generate_trackball_in_wall(): + pos, rot = tbiw_position_rotation() + cutout = trackball_cutout() + cutout = rotate(cutout, rot) + cutout = translate(cutout, pos) + + shape = trackball_socket() + shape = rotate(shape, rot) + shape = translate(shape, pos) + + ball = trackball_ball() + ball = rotate(ball, rot) + ball = translate(ball, pos) + + return shape, cutout, ball + +def tbiw_position_rotation(): base_pt1 = key_position( - list(np.array([-mount_width/2, 0, 0]) + np.array([0, (mount_height / 2), 0])), 0, oled_center_row-1 + list(np.array([-mount_width/2, 0, 0]) + np.array([0, (mount_height / 2), 0])), + 0, cornerrow - tbiw_ball_center_row - 1 ) base_pt2 = key_position( - list(np.array([-mount_width/2, 0, 0]) + np.array([0, (mount_height / 2), 0])), 0, oled_center_row+1 + list(np.array([-mount_width/2, 0, 0]) + np.array([0, (mount_height / 2), 0])), + 0, cornerrow - tbiw_ball_center_row + 1 ) base_pt0 = key_position( - list(np.array([-mount_width / 2, 0, 0]) + np.array([0, (mount_height / 2), 0])), 0, oled_center_row + list(np.array([-mount_width / 2, 0, 0]) + np.array([0, (mount_height / 2), 0])), + 0, cornerrow - tbiw_ball_center_row ) - oled_mount_location_xyz = (np.array(base_pt1)+np.array(base_pt2))/2. + np.array(((-left_wall_x_offset/2), 0, 0)) + np.array(oled_translation_offset) - oled_mount_location_xyz[2] = (oled_mount_location_xyz[2] + base_pt0[2])/2 + left_wall_x_offset = tbiw_left_wall_x_offset_override + + tbiw_mount_location_xyz = (np.array(base_pt1)+np.array(base_pt2))/2. + np.array(((-left_wall_x_offset/2), 0, 0)) + np.array(tbiw_translational_offset) + # tbiw_mount_location_xyz[2] = (oled_translation_offset[2] + base_pt0[2])/2 angle_x = np.arctan2(base_pt1[2] - base_pt2[2], base_pt1[1] - base_pt2[1]) angle_z = np.arctan2(base_pt1[0] - base_pt2[0], base_pt1[1] - base_pt2[1]) + tbiw_mount_rotation_xyz = (0, rad2deg(angle_x), -90) + np.array(tbiw_rotation_offset) + + return tbiw_mount_location_xyz, tbiw_mount_rotation_xyz + - oled_mount_rotation_xyz = (rad2deg(angle_x), 0, -rad2deg(angle_z)) + np.array(oled_rotation_offset) +def oled_position_rotation(side='right'): + if trackball_in_wall and side == ball_side: + oled_center_row = tbiw_oled_center_row + oled_translation_offset = tbiw_oled_translation_offset + oled_rotation_offset = tbiw_oled_rotation_offset + if oled_center_row is not None: + base_pt1 = key_position( + list(np.array([-mount_width/2, 0, 0]) + np.array([0, (mount_height / 2), 0])), 0, oled_center_row-1 + ) + base_pt2 = key_position( + list(np.array([-mount_width/2, 0, 0]) + np.array([0, (mount_height / 2), 0])), 0, oled_center_row+1 + ) + base_pt0 = key_position( + list(np.array([-mount_width / 2, 0, 0]) + np.array([0, (mount_height / 2), 0])), 0, oled_center_row + ) + + if trackball_in_wall and side==ball_side: + left_wall_x_offset = tbiw_left_wall_x_offset_override + + oled_mount_location_xyz = (np.array(base_pt1)+np.array(base_pt2))/2. + np.array(((-left_wall_x_offset/2), 0, 0)) + np.array(oled_translation_offset) + oled_mount_location_xyz[2] = (oled_mount_location_xyz[2] + base_pt0[2])/2 + + angle_x = np.arctan2(base_pt1[2] - base_pt2[2], base_pt1[1] - base_pt2[1]) + angle_z = np.arctan2(base_pt1[0] - base_pt2[0], base_pt1[1] - base_pt2[1]) + if trackball_in_wall and side == ball_side: + # oled_mount_rotation_xyz = (0, rad2deg(angle_x), -rad2deg(angle_z)-90) + np.array(oled_rotation_offset) + # oled_mount_rotation_xyz = (rad2deg(angle_x)*.707, rad2deg(angle_x)*.707, -45) + np.array(oled_rotation_offset) + oled_mount_rotation_xyz = (0, rad2deg(angle_x), -90) + np.array(oled_rotation_offset) + else: + oled_mount_rotation_xyz = (rad2deg(angle_x), 0, -rad2deg(angle_z)) + np.array(oled_rotation_offset) + + return oled_mount_location_xyz, oled_mount_rotation_xyz -def oled_sliding_mount_frame(): +def oled_sliding_mount_frame(side='right'): mount_ext_width = oled_mount_width + 2 * oled_mount_rim mount_ext_height = ( oled_mount_height + 2 * oled_edge_overlap_end @@ -2444,6 +2937,8 @@ def oled_sliding_mount_frame(): shape = difference(shape, [conn_hole, top_hole, end_hole]) + oled_mount_location_xyz, oled_mount_rotation_xyz = oled_position_rotation(side=side) + shape = rotate(shape, oled_mount_rotation_xyz) shape = translate(shape, ( @@ -2464,7 +2959,7 @@ def oled_sliding_mount_frame(): return hole, shape -def oled_clip_mount_frame(): +def oled_clip_mount_frame(side='right'): mount_ext_width = oled_mount_width + 2 * oled_mount_rim mount_ext_height = ( oled_mount_height + 2 * oled_clip_thickness @@ -2500,6 +2995,8 @@ def oled_clip_mount_frame(): plate = translate(plate, (0., 0., -oled_thickness / 2.0)) shape = union([shape, plate]) + oled_mount_location_xyz, oled_mount_rotation_xyz = oled_position_rotation(side=side) + shape = rotate(shape, oled_mount_rotation_xyz) shape = translate(shape, ( @@ -2586,7 +3083,7 @@ def oled_clip(): return shape -def oled_undercut_mount_frame(): +def oled_undercut_mount_frame(side='right'): mount_ext_width = oled_mount_width + 2 * oled_mount_rim mount_ext_height = oled_mount_height + 2 * oled_mount_rim hole = box(mount_ext_width, mount_ext_height, oled_mount_cut_depth + .01) @@ -2600,6 +3097,8 @@ def oled_undercut_mount_frame(): undercut = translate(undercut, (0., 0., -oled_mount_undercut_thickness)) shape = difference(shape, [undercut]) + oled_mount_location_xyz, oled_mount_rotation_xyz = oled_position_rotation(side=side) + shape = rotate(shape, oled_mount_rotation_xyz) shape = translate(shape, ( oled_mount_location_xyz[0], @@ -2860,7 +3359,7 @@ def model_side(side="right"): shape = union([shape, thumb_connector_shape]) if debug_exports: export_file(shape=shape, fname=path.join(r"..", "things", r"debug_thumb_connector_shape")) - walls_shape = case_walls() + walls_shape = case_walls(side=side) if debug_exports: export_file(shape=walls_shape, fname=path.join(r"..", "things", r"debug_walls_shape")) s2 = union([walls_shape]) @@ -2889,26 +3388,33 @@ def model_side(side="right"): shape = union([shape, rj9_holder()]) if oled_mount_type == "UNDERCUT": - hole, frame = oled_undercut_mount_frame() + hole, frame = oled_undercut_mount_frame(side=side) shape = difference(shape, [hole]) shape = union([shape, frame]) elif oled_mount_type == "SLIDING": - hole, frame = oled_sliding_mount_frame() + hole, frame = oled_sliding_mount_frame(side=side) shape = difference(shape, [hole]) shape = union([shape, frame]) elif oled_mount_type == "CLIP": - hole, frame = oled_clip_mount_frame() + hole, frame = oled_clip_mount_frame(side=side) shape = difference(shape, [hole]) shape = union([shape, frame]) + if trackball_in_wall and side == ball_side: + tb, cutout, ball = generate_trackball_in_wall() + shape = difference(shape, [cutout]) + shape = union([shape, tb]) + if show_caps: + shape = add([shape, ball]) + block = box(350, 350, 40) block = translate(block, (0, 0, -20)) shape = difference(shape, [block]) if show_caps: - shape = add([shape, thumbcaps()]) + shape = add([shape, thumbcaps(side=side)]) shape = add([shape, caps()]) if side == "left": -- cgit v1.2.3 From b09b92f639477ca8264118fcc728c6e8094b1cd8 Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Thu, 5 Aug 2021 22:13:28 -0400 Subject: Adding CAD geometry. Debugging minor issues. --- src/dactyl_manuform.py | 58 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 12 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 34df21f..2930aa5 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -151,7 +151,6 @@ teensy_holder_height = 6 + teensy_width # screw_insert_bottom_radius = 5.31 / 2 # screw_insert_top_radius = 5.1 / 2 - # save_path = path.join("..", "things", save_dir) if not path.isdir(save_path): os.mkdir(save_path) @@ -266,7 +265,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(tbiw_hole_diameter / 2, tbiw_hole_height) return shape def trackball_socket(segments=100, side="right"): @@ -274,11 +273,26 @@ def trackball_socket(segments=100, side="right"): # cyl = cylinder(ball_diameter / 2 + 4, 20) # cyl = translate(cyl, (0, 0, -8)) # shape = union([shape, cyl]) - tb_file = path.join("..", "src", r"ball_socket_v00") + + tb_file = path.join("..", "src", r"trackball_socket_body_34mm") + # tb_file = path.join("..", "src", r"trackball_fused_34mm") + tbcut_file = path.join("..", "src", r"trackball_socket_cutter_34mm") + sens_file = path.join("..", "src", r"trackball_sensor_mount") + senscut_file = path.join("..", "src", r"trackball_sensor_cutter") + + + # shape = import_file(tb_file) + # # shape = difference(shape, [import_file(senscut_file)]) + # # shape = union([shape, import_file(sens_file)]) + # cutter = import_file(tbcut_file) + shape = import_file(tb_file) - shape = translate(shape, (0, 0, ball_z_offset)) + sensor = import_file(sens_file) + cutter = import_file(tbcut_file) + cutter = union([cutter, import_file(senscut_file)]) - return shape + # return shape, cutter + return shape, cutter, sensor def trackball_ball(segments=100, side="right"): shape = sphere(ball_diameter / 2) @@ -2787,19 +2801,31 @@ def external_mount_hole(): def generate_trackball_in_wall(): pos, rot = tbiw_position_rotation() - cutout = trackball_cutout() - cutout = rotate(cutout, rot) - cutout = translate(cutout, pos) + precut = trackball_cutout() + precut = rotate(precut, rot) + precut = translate(precut, pos) - shape = trackball_socket() + shape, cutout, sensor = trackball_socket() + + shape = translate(shape, (0, 0, ball_z_offset)) shape = rotate(shape, rot) shape = translate(shape, pos) + cutout = translate(cutout, (0, 0, ball_z_offset)) + cutout = rotate(cutout, rot) + cutout = translate(cutout, pos) + # + sensor = translate(sensor, (0, 0, ball_z_offset+.001)) + sensor = rotate(sensor, rot) + sensor = translate(sensor, pos) + ball = trackball_ball() + ball = translate(ball, (0, 0, ball_z_offset)) ball = rotate(ball, rot) ball = translate(ball, pos) - return shape, cutout, ball + # return precut, shape, cutout, ball + return precut, shape, cutout, sensor, ball def tbiw_position_rotation(): base_pt1 = key_position( @@ -3403,9 +3429,17 @@ def model_side(side="right"): shape = union([shape, frame]) if trackball_in_wall and side == ball_side: - tb, cutout, ball = generate_trackball_in_wall() - shape = difference(shape, [cutout]) + tbprecut, tb, tbcutout, sensor, ball = generate_trackball_in_wall() + + shape = difference(shape, [tbprecut]) + export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_1")) shape = union([shape, tb]) + export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_2")) + shape = difference(shape, [tbcutout]) + export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_3a")) + export_file(shape=add([shape, sensor]), fname=path.join(save_path, config_name + r"_test_3b")) + shape = union([shape, sensor]) + if show_caps: shape = add([shape, ball]) -- cgit v1.2.3 From 49f0253b9f22790ce5d50ed83f901328e0acea89 Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Fri, 6 Aug 2021 17:16:46 -0400 Subject: Minor mods, CAD trackball socket in models. --- src/dactyl_manuform.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 2930aa5..3379fb9 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -2814,7 +2814,9 @@ def generate_trackball_in_wall(): cutout = translate(cutout, (0, 0, ball_z_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, rot) sensor = translate(sensor, pos) @@ -3432,12 +3434,12 @@ def model_side(side="right"): tbprecut, tb, tbcutout, sensor, ball = generate_trackball_in_wall() shape = difference(shape, [tbprecut]) - export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_1")) + # export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_1")) shape = union([shape, tb]) - export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_2")) + # export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_2")) shape = difference(shape, [tbcutout]) - export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_3a")) - export_file(shape=add([shape, sensor]), fname=path.join(save_path, config_name + r"_test_3b")) + # export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_3a")) + # export_file(shape=add([shape, sensor]), fname=path.join(save_path, config_name + r"_test_3b")) shape = union([shape, sensor]) if show_caps: -- cgit v1.2.3 From ca9783df5dc645a027743902f7f3b2e0348fd716 Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Wed, 11 Aug 2021 20:55:08 -0400 Subject: Interim checkin. Initial version of trackball webs/walls in, still working on component cut/union order. Fixed base plates and walls to be identical in caquery and solid. Fixed if/elif/else structure that misplaced the MINI cluster screw mount. Added intial pass at add on PCB as option to add with caps for interference checks. Moved bottom_hull to helper libraries as they are specific to engine. Fixed bottom_hull functions to correct minor discrepency between the engines. Fixed solid intersect function. --- src/dactyl_manuform.py | 386 +++++++++++++++++++++++++++++-------------------- 1 file changed, 230 insertions(+), 156 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 3379fb9..d734684 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -348,8 +348,25 @@ def sa_cap(Usize=1): key_cap = translate(key_cap, (0, 0, 5 + plate_thickness)) + if show_pcbs: + key_cap = add([key_cap, key_pcb()]) + return key_cap +def key_pcb(): + shape = box(pcb_width, pcb_height, pcb_thickness) + shape = translate(shape, (0, 0, -pcb_thickness/2)) + hole = cylinder(pcb_hole_diameter/2, pcb_thickness+.2) + hole = translate(hole, (0, 0, -(pcb_thickness+.1)/2)) + holes = [ + translate(hole, (pcb_hole_pattern_width/2, pcb_hole_pattern_height/2, 0)), + translate(hole, (-pcb_hole_pattern_width / 2, pcb_hole_pattern_height / 2, 0)), + translate(hole, (-pcb_hole_pattern_width / 2, -pcb_hole_pattern_height / 2, 0)), + translate(hole, (pcb_hole_pattern_width / 2, -pcb_hole_pattern_height / 2, 0)), + ] + shape = difference(shape, holes) + + return shape ######################### ## Placement Functions ## @@ -589,14 +606,6 @@ def thumborigin(): return origin -def thumb_tr_place(shape): - debugprint('thumb_tr_place()') - shape = rotate(shape, [10, -15, 10]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-12, -16, 3]) - return shape - - def thumb_tl_place(shape): debugprint('thumb_tl_place()') shape = rotate(shape, [7.5, -18, 10]) @@ -605,6 +614,13 @@ def thumb_tl_place(shape): return shape +def thumb_tr_place(shape): + debugprint('thumb_tr_place()') + shape = rotate(shape, [10, -15, 10]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-12, -16, 3]) + return shape + def thumb_mr_place(shape): debugprint('thumb_mr_place()') shape = rotate(shape, [-6, -34, 48]) @@ -1712,48 +1728,48 @@ def trackball_place(shape): def trackball_thumb_tl_place(shape): debugprint('thumb_tr_place()') - shape = rotate(shape, [10, -5, 25]) + shape = rotate(shape, [5, 10, -65]) shape = translate(shape, thumborigin()) - shape = translate(shape, [-14, -10, 0]) + shape = translate(shape, [-14, -9, 0]) return shape def trackball_thumb_mr_place(shape): debugprint('thumb_mr_place()') - shape = rotate(shape, [-7, -20, 75]) + shape = rotate(shape, [7, 20, -105]) shape = translate(shape, thumborigin()) - shape = translate(shape, [-13, -32, -5]) + shape = translate(shape, [-12, -32, -5]) return shape def trackball_thumb_br_place(shape): debugprint('thumb_br_place()') - shape = rotate(shape, [-10, -25, 90]) + shape = rotate(shape, [25, -11, 0]) shape = translate(shape, thumborigin()) - shape = translate(shape, [-40, -48, -16]) + shape = translate(shape, [-40, -50, -16]) return shape def trackball_thumb_bl_place(shape): debugprint('thumb_bl_place()') - shape = rotate(shape, [0, -25, 45]) + shape = rotate(shape, [25, 0, -45]) shape = translate(shape, thumborigin()) - shape = translate(shape, [-60.5, -38.5, -18]) + shape = translate(shape, [-63, -41, -18]) return shape -def trackball_thumb_tlold_place(shape): - debugprint('thumb_tl_place()') - shape = rotate(shape, [7.5, -10, 10]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-32.5, -14.5, -4]) - return shape - - -def trackball_thumb_mlold_place(shape): - debugprint('thumb_ml_place()') - shape = rotate(shape, [6, -34, 40]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-51, -25, -12]) - return shape +# def trackball_thumb_tlold_place(shape): +# debugprint('thumb_tl_place()') +# shape = rotate(shape, [7.5, -10, 10]) +# shape = translate(shape, thumborigin()) +# shape = translate(shape, [-32.5, -14.5, -4]) +# return shape +# +# +# def trackball_thumb_mlold_place(shape): +# debugprint('thumb_ml_place()') +# shape = rotate(shape, [6, -34, 40]) +# shape = translate(shape, thumborigin()) +# shape = translate(shape, [-51, -25, -12]) +# return shape def trackball_thumb_1x_layout(shape): @@ -1794,7 +1810,7 @@ def trackball_thumb(side="right"): shape = union([shape, trackball_thumb_fx_layout(double_plate())]) shape = union([shape, trackball_thumb_1x_layout(single_plate(side=side))]) - shape = union([shape, trackball_layout(trackball_socket())]) + # shape = union([shape, trackball_layout(trackball_socket())]) # shape = trackball_thumb_1x_layout(single_plate(side=side)) return shape @@ -1829,7 +1845,7 @@ def trackball_thumb_post_br(): def trackball_post_r(): debugprint('trackball_post_r()') - radius = ball_diameter/2+ball_wall_thickness + radius = ball_diameter/2 + ball_wall_thickness + ball_gap return translate(web_post(), [1.0*(radius - post_adj), 0.0*(radius - post_adj), 0] ) @@ -1837,7 +1853,7 @@ def trackball_post_r(): def trackball_post_tr(): debugprint('trackball_post_tr()') - radius = ball_diameter/2+ball_wall_thickness + radius = ball_diameter/2+ball_wall_thickness + ball_gap return translate(web_post(), [0.5*(radius - post_adj), 0.866*(radius - post_adj), 0] ) @@ -1845,7 +1861,7 @@ def trackball_post_tr(): def trackball_post_tl(): debugprint('trackball_post_tl()') - radius = ball_diameter/2+ball_wall_thickness + radius = ball_diameter/2+ball_wall_thickness + ball_gap return translate(web_post(), [-0.5*(radius - post_adj), 0.866*(radius - post_adj), 0] ) @@ -1853,14 +1869,14 @@ def trackball_post_tl(): def trackball_post_l(): debugprint('trackball_post_l()') - radius = ball_diameter/2+ball_wall_thickness + 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()') - radius = ball_diameter/2+ball_wall_thickness + radius = ball_diameter/2+ball_wall_thickness + ball_gap return translate(web_post(), [-0.5*(radius - post_adj), -0.866*(radius - post_adj), 0] ) @@ -1868,7 +1884,7 @@ def trackball_post_bl(): def trackball_post_br(): debugprint('trackball_post_br()') - radius = ball_diameter/2+ball_wall_thickness + radius = ball_diameter/2+ball_wall_thickness + ball_gap return translate(web_post(), [0.5*(radius - post_adj), -0.866*(radius - post_adj), 0] ) @@ -1879,53 +1895,91 @@ def trackball_thumb_connectors(): print('thumb_connectors()') hulls = [] - # # Top two - # hulls.append( - # triangle_hulls( - # [ - # trackball_thumb_tlold_place(trackball_thumb_post_tr()), - # trackball_thumb_tlold_place(trackball_thumb_post_br()), - # trackball_thumb_tl_place(web_post_tl()), - # trackball_thumb_tl_place(web_post_bl()), - # ] - # ) - # ) - # - # # bottom two on the right - # hulls.append( - # triangle_hulls( - # [ - # trackball_thumb_br_place(web_post_tr()), - # trackball_thumb_br_place(web_post_br()), - # trackball_thumb_mr_place(web_post_tl()), - # trackball_thumb_mr_place(web_post_bl()), - # ] - # ) - # ) - # - # # bottom two on the left - # hulls.append( - # triangle_hulls( - # [ - # trackball_thumb_br_place(web_post_tr()), - # trackball_thumb_br_place(web_post_br()), - # trackball_thumb_mr_place(web_post_tl()), - # trackball_thumb_mr_place(web_post_bl()), - # ] - # ) - # ) - # # centers of the bottom four - # hulls.append( - # triangle_hulls( - # [ - # trackball_thumb_bl_place(web_post_tr()), - # trackball_thumb_bl_place(web_post_br()), - # trackball_thumb_mlold_place(web_post_tl()), - # trackball_thumb_mlold_place(web_post_bl()), - # ] - # ) + # bottom 2 to tb + 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()), + key_place(web_post_bl(), 0, cornerrow), + trackball_place(trackball_post_tl()), + ] + ) + ) + + # bottom left + 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()), + ] + ) + ) + + # bottom right + 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()), + ] + ) + ) + # top right + 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( @@ -1961,20 +2015,25 @@ def trackball_thumb_connectors(): hulls.append( triangle_hulls( [ - # trackball_thumb_tlold_place(trackball_thumb_post_tl()), key_place(web_post_bl(), 0, cornerrow), - trackball_thumb_tlold_place(trackball_thumb_post_tr()), + 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_tr()), + 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_tl_place(web_post_br()), + 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), @@ -1985,6 +2044,7 @@ def trackball_thumb_connectors(): ] ) ) + # trackball_place(trackball_thumb_post_tl()), hulls.append( triangle_hulls( @@ -2017,60 +2077,26 @@ def trackball_thumb_connectors(): ## Case ## ########## - -def bottom_hull(p, height=0.001): - debugprint("bottom_hull()") - if ENGINE == 'cadquery': - shape = None - for item in p: - vertices = [] - verts = item.faces(' Date: Wed, 11 Aug 2021 21:11:22 -0400 Subject: Added undercut for tray. Discovered why people had an issue with the tray. The cadquery had interference and solid did not. After fixing the unintentional difference, I found both had intereference. Added an undercut to locally thin the wall for tray engagement. --- src/dactyl_manuform.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index d734684..666e890 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -2854,10 +2854,13 @@ external_start = list( def external_mount_hole(): print('external_mount_hole()') shape = box(external_holder_width, 20.0, external_holder_height+.1) + undercut = box(external_holder_width+8, 10.0, external_holder_height+8+.1) + shape = union([shape, translate(undercut,(0, -5, 0))]) + shape = translate(shape, ( external_start[0] + external_holder_xoffset, - external_start[1], + external_start[1] + external_holder_yoffset, external_holder_height / 2-.05, ) ) -- cgit v1.2.3 From d24e5b2847300e24149156146c7212ca9aebee2d Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Fri, 13 Aug 2021 17:11:44 -0400 Subject: very interim commit to check tbiw issues. --- src/dactyl_manuform.py | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 666e890..13be96c 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -1719,18 +1719,34 @@ def carbonfet_thumb_connectors(): # Trackball (Ball + 4-key) THUMB CLUSTER ############################ +def trackball_thumb_position_rotation(): + rot = [10, -15, 5] + pos = thumborigin() + shift = [-42, -20, -5] + for i in range(len(pos)): + pos[i] = pos[i] + shift[i] + return pos, rot + + def trackball_place(shape): - shape = rotate(shape, [10, -15, 5]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-42, -20, -5]) + pos, rot = trackball_thumb_position_rotation() + shape = rotate(shape, rot) + shape = translate(shape, pos) return shape def trackball_thumb_tl_place(shape): debugprint('thumb_tr_place()') + # Modifying to make a "ring" of keys + + shape = translate(shape, (0, )) shape = rotate(shape, [5, 10, -65]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-14, -9, 0]) + + # shape = rotate(shape, [5, 10, -65]) + # shape = translate(shape, thumborigin()) + # shape = translate(shape, [-14, -9, 0]) + + return shape def trackball_thumb_mr_place(shape): @@ -2866,8 +2882,7 @@ def external_mount_hole(): ) return shape -def generate_trackball_in_wall(): - pos, rot = tbiw_position_rotation() +def generate_trackball(pos, rot): precut = trackball_cutout() precut = rotate(precut, rot) precut = translate(precut, pos) @@ -2896,6 +2911,13 @@ def generate_trackball_in_wall(): # return precut, shape, cutout, ball return precut, shape, cutout, sensor, ball +def generate_trackball_in_cluster(): + + pos, rot = trackball_position_rotation() + return generate_trackball(pos, rot) + + + def tbiw_position_rotation(): base_pt1 = key_position( list(np.array([-mount_width/2, 0, 0]) + np.array([0, (mount_height / 2), 0])), @@ -2921,6 +2943,10 @@ def tbiw_position_rotation(): return tbiw_mount_location_xyz, tbiw_mount_rotation_xyz +def generate_trackball_in_wall(): + pos, rot = tbiw_position_rotation() + return generate_trackball(pos, rot) + def oled_position_rotation(side='right'): -- cgit v1.2.3 From 206391e59865281b8d8e7db499c30dd36d27b7c7 Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Fri, 13 Aug 2021 21:12:36 -0400 Subject: Fixed non-ball side rendering for trackball thumb. Still WIP. --- src/dactyl_manuform.py | 169 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 115 insertions(+), 54 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 13be96c..130bdfd 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -99,6 +99,9 @@ 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': + symmetry = "asymmetric" + mount_width = keyswitch_width + 2 * plate_rim mount_height = keyswitch_height + 2 * plate_rim mount_thickness = plate_thickness @@ -747,44 +750,65 @@ def double_plate(): return union((top_plate, mirror(top_plate, 'XZ'))) -def thumbcaps(side='right'): - if thumb_style == "MINI": +def thumbcaps(side='right', style_override=None): + if style_override is None: + _thumb_style = thumb_style + else: + _thumb_style = style_override + + if _thumb_style == "MINI": return mini_thumbcaps() - elif thumb_style == "MINIDOX": + elif _thumb_style == "MINIDOX": return minidox_thumbcaps() - elif thumb_style == "CARBONFET": + elif _thumb_style == "CARBONFET": return carbonfet_thumbcaps() - elif thumb_style == "TRACKBALL": - return trackball_thumbcaps() + elif _thumb_style == "TRACKBALL" : + if (side == ball_side or ball_side == 'both'): + return trackball_thumbcaps() + else: + return thumbcaps(side, style_override=other_thumb) else: return default_thumbcaps() -def thumb(side="right"): - if thumb_style == "MINI": +def thumb(side="right", style_override=None): + if style_override is None: + _thumb_style = thumb_style + else: + _thumb_style = style_override + + if _thumb_style == "MINI": return mini_thumb(side) - elif thumb_style == "MINIDOX": + elif _thumb_style == "MINIDOX": return minidox_thumb(side) - elif thumb_style == "CARBONFET": + elif _thumb_style == "CARBONFET": return carbonfet_thumb(side) - elif thumb_style == "TRACKBALL": - if side == ball_side: + elif _thumb_style == "TRACKBALL": + if (side == ball_side or ball_side == 'both'): return trackball_thumb(side) else: - return default_thumb(side) + return thumb(side, style_override=other_thumb) else: return default_thumb(side) -def thumb_connectors(side='right'): - if thumb_style == "MINI": +def thumb_connectors(side='right', style_override=None): + if style_override is None: + _thumb_style = thumb_style + else: + _thumb_style = style_override + + if _thumb_style == "MINI": return mini_thumb_connectors() - elif thumb_style == "MINIDOX": + elif _thumb_style == "MINIDOX": return minidox_thumb_connectors() - elif thumb_style == "CARBONFET": + elif _thumb_style == "CARBONFET": return carbonfet_thumb_connectors() - elif thumb_style == "TRACKBALL": - return trackball_thumb_connectors() + elif _thumb_style == "TRACKBALL" : + if (side == ball_side or ball_side == 'both'): + return trackball_thumb_connectors() + else: + return thumb_connectors(side, style_override=other_thumb) else: return default_thumb_connectors() @@ -1722,7 +1746,8 @@ def carbonfet_thumb_connectors(): def trackball_thumb_position_rotation(): rot = [10, -15, 5] pos = thumborigin() - shift = [-42, -20, -5] + # 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] return pos, rot @@ -1738,37 +1763,55 @@ def trackball_place(shape): def trackball_thumb_tl_place(shape): debugprint('thumb_tr_place()') # Modifying to make a "ring" of keys - - shape = translate(shape, (0, )) - shape = rotate(shape, [5, 10, -65]) - + shape = rotate(shape, [0, 0, 0]) + t_off = tbjs_translational_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 = rotate(shape, [5, 10, -65]) # shape = translate(shape, thumborigin()) # shape = translate(shape, [-14, -9, 0]) - - return shape def trackball_thumb_mr_place(shape): debugprint('thumb_mr_place()') - shape = rotate(shape, [7, 20, -105]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-12, -32, -5]) + shape = rotate(shape, [0, 0, 0]) + t_off = tbjs_translational_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 = rotate(shape, [7, 20, -105]) + # shape = translate(shape, thumborigin()) + # shape = translate(shape, [-12, -32, -5]) return shape def trackball_thumb_br_place(shape): debugprint('thumb_br_place()') - shape = rotate(shape, [25, -11, 0]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-40, -50, -16]) + + shape = rotate(shape, [0, 0, 180]) + t_off = tbjs_translational_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 = rotate(shape, [25, -11, 0]) + # shape = translate(shape, thumborigin()) + # shape = translate(shape, [-40, -50, -16]) return shape def trackball_thumb_bl_place(shape): debugprint('thumb_bl_place()') - shape = rotate(shape, [25, 0, -45]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-63, -41, -18]) + shape = rotate(shape, [0, 0, 180]) + t_off = tbjs_translational_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 = rotate(shape, [25, 0, -45]) + # shape = translate(shape, thumborigin()) + # shape = translate(shape, [-63, -41, -18]) return shape @@ -2098,7 +2141,7 @@ def left_key_position(row, direction, low_corner=False, side='right'): pos = np.array( key_position([-mount_width * 0.5, direction * mount_height * 0.5, 0], 0, row) ) - if trackball_in_wall and side==ball_side: + if trackball_in_wall and (side == ball_side or ball_side == 'both'): if low_corner: y_offset = tbiw_left_wall_lower_y_offset @@ -2318,30 +2361,48 @@ def front_wall(): return shape -def thumb_walls(): - if thumb_style == "MINI": + +def thumb_walls(side='right', style_override=None): + if style_override is None: + _thumb_style = thumb_style + else: + _thumb_style = style_override + + if _thumb_style == "MINI": return mini_thumb_walls() - if thumb_style == "MINIDOX": + elif _thumb_style == "MINIDOX": return minidox_thumb_walls() - elif thumb_style == "CARBONFET": + elif _thumb_style == "CARBONFET": return carbonfet_thumb_walls() - elif thumb_style == "TRACKBALL": - return trackball_thumb_walls() + elif _thumb_style == "TRACKBALL" : + if (side == ball_side or ball_side == 'both'): + return trackball_thumb_walls() + else: + return thumb_walls(side, style_override=other_thumb) else: return default_thumb_walls() -def thumb_connection(side='right'): - if thumb_style == "MINI": +def thumb_connection(side='right', style_override=None): + if style_override is None: + _thumb_style = thumb_style + else: + _thumb_style = style_override + + if _thumb_style == "MINI": return mini_thumb_connection(side=side) - if thumb_style == "MINIDOX": + elif _thumb_style == "MINIDOX": return minidox_thumb_connection(side=side) - elif thumb_style == "CARBONFET": + elif _thumb_style == "CARBONFET": return carbonfet_thumb_connection(side=side) - elif thumb_style == "TRACKBALL": - return trackball_thumb_connection(side=side) + elif _thumb_style == "TRACKBALL": + if (side == ball_side or ball_side == 'both'): + return trackball_thumb_connection(side=side) + else: + return thumb_connection(side, style_override=other_thumb) else: return default_thumb_connection(side=side) + def default_thumb_walls(): print('thumb_walls()') # thumb, walls @@ -2777,7 +2838,7 @@ def case_walls(side='right'): left_wall(side=side), right_wall(), front_wall(), - thumb_walls(), + thumb_walls(side=side), thumb_connection(side=side), ]) ) @@ -2951,7 +3012,7 @@ def generate_trackball_in_wall(): def oled_position_rotation(side='right'): _oled_center_row = None - if trackball_in_wall and side == ball_side: + if trackball_in_wall and (side == ball_side or ball_side == 'both'): _oled_center_row = tbiw_oled_center_row _oled_translation_offset = tbiw_oled_translation_offset _oled_rotation_offset = tbiw_oled_rotation_offset @@ -2972,7 +3033,7 @@ def oled_position_rotation(side='right'): list(np.array([-mount_width / 2, 0, 0]) + np.array([0, (mount_height / 2), 0])), 0, _oled_center_row ) - if trackball_in_wall and side==ball_side: + if trackball_in_wall and (side == ball_side or ball_side == 'both'): _left_wall_x_offset = tbiw_left_wall_x_offset_override else: _left_wall_x_offset = left_wall_x_offset @@ -2982,7 +3043,7 @@ def oled_position_rotation(side='right'): angle_x = np.arctan2(base_pt1[2] - base_pt2[2], base_pt1[1] - base_pt2[1]) angle_z = np.arctan2(base_pt1[0] - base_pt2[0], base_pt1[1] - base_pt2[1]) - if trackball_in_wall and side == ball_side: + if trackball_in_wall and (side == ball_side or ball_side == 'both'): # oled_mount_rotation_xyz = (0, rad2deg(angle_x), -rad2deg(angle_z)-90) + np.array(oled_rotation_offset) # oled_mount_rotation_xyz = (rad2deg(angle_x)*.707, rad2deg(angle_x)*.707, -45) + np.array(oled_rotation_offset) oled_mount_rotation_xyz = (0, rad2deg(angle_x), -90) + np.array(_oled_rotation_offset) @@ -3485,7 +3546,7 @@ def model_side(side="right"): if debug_exports: export_file(shape=thumb_shape, fname=path.join(r"..", "things", r"debug_thumb_shape")) shape = union([shape, thumb_shape]) - thumb_connector_shape = thumb_connectors() + thumb_connector_shape = thumb_connectors(side=side) shape = union([shape, thumb_connector_shape]) if debug_exports: export_file(shape=shape, fname=path.join(r"..", "things", r"debug_thumb_connector_shape")) @@ -3532,7 +3593,7 @@ def model_side(side="right"): shape = difference(shape, [hole]) shape = union([shape, frame]) - if trackball_in_wall and side == ball_side: + if trackball_in_wall and (side == ball_side or ball_side == 'both'): tbprecut, tb, tbcutout, sensor, ball = generate_trackball_in_wall() shape = difference(shape, [tbprecut]) -- cgit v1.2.3 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 ++++++++++++++++++++----------------------------- 1 file changed, 198 insertions(+), 286 deletions(-) (limited to 'src/dactyl_manuform.py') 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")) -- cgit v1.2.3 From 29a89e462800f26f70f22cbe05211e153339e928 Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Tue, 17 Aug 2021 20:39:54 -0400 Subject: File cleanup. --- src/dactyl_manuform.py | 1 - 1 file changed, 1 deletion(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 1fba393..4f9d6dd 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -278,7 +278,6 @@ def trackball_socket(segments=100, side="right"): # shape = union([shape, cyl]) tb_file = path.join("..", "src", r"trackball_socket_body_34mm") - # tb_file = path.join("..", "src", r"trackball_fused_34mm") tbcut_file = path.join("..", "src", r"trackball_socket_cutter_34mm") sens_file = path.join("..", "src", r"trackball_sensor_mount") senscut_file = path.join("..", "src", r"trackball_sensor_cutter") -- cgit v1.2.3 From 6832d68703355e6f61e4174d97c5f398797b09b0 Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Tue, 17 Aug 2021 21:21:10 -0400 Subject: Name change. --- src/dactyl_manuform.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 4f9d6dd..fda4776 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -761,7 +761,7 @@ def thumbcaps(side='right', style_override=None): return carbonfet_thumbcaps() elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): - if _thumb_style == "TRACKBALL_ORBISSYL": + if _thumb_style == "TRACKBALL_ORBYL": return tbjs_thumbcaps() else: return thumbcaps(side, style_override=other_thumb) @@ -783,7 +783,7 @@ def thumb(side="right", style_override=None): return carbonfet_thumb(side) elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): - if _thumb_style == "TRACKBALL_ORBISSYL": + if _thumb_style == "TRACKBALL_ORBYL": return tbjs_thumb(side) else: return thumb(side, style_override=other_thumb) @@ -805,7 +805,7 @@ def thumb_connectors(side='right', style_override=None): return carbonfet_thumb_connectors() elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): - if _thumb_style == "TRACKBALL_ORBISSYL": + if _thumb_style == "TRACKBALL_ORBYL": return tbjs_thumb_connectors() else: return thumb_connectors(side, style_override=other_thumb) @@ -2297,7 +2297,7 @@ def thumb_walls(side='right', style_override=None): return carbonfet_thumb_walls() elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): - if _thumb_style == "TRACKBALL_ORBISSYL" : + if _thumb_style == "TRACKBALL_ORBYL" : return tbjs_thumb_walls() else: return thumb_walls(side, style_override=other_thumb) @@ -2318,7 +2318,7 @@ def thumb_connection(side='right', style_override=None): return carbonfet_thumb_connection(side=side) elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): - if _thumb_style == "TRACKBALL_ORBISSYL": + if _thumb_style == "TRACKBALL_ORBYL": return tbjs_thumb_connection(side=side) else: return thumb_connection(side, style_override=other_thumb) @@ -2881,7 +2881,7 @@ def generate_trackball(pos, rot): return precut, shape, cutout, sensor, ball def generate_trackball_in_cluster(): - if thumb_style == 'TRACKBALL_ORBISSYL': + if thumb_style == 'TRACKBALL_ORBYL': pos, rot = tbjs_thumb_position_rotation() return generate_trackball(pos, rot) -- cgit v1.2.3 From d8c4a98391895b59fe9e4bf1a323620903babaa4 Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Wed, 18 Aug 2021 07:49:21 -0400 Subject: Fixed Trackball in Wall, extra rotation. Now aims forward. --- src/dactyl_manuform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index fda4776..c913ced 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -2908,7 +2908,7 @@ def tbiw_position_rotation(): angle_x = np.arctan2(base_pt1[2] - base_pt2[2], base_pt1[1] - base_pt2[1]) angle_z = np.arctan2(base_pt1[0] - base_pt2[0], base_pt1[1] - base_pt2[1]) - tbiw_mount_rotation_xyz = (0, rad2deg(angle_x), -90) + np.array(tbiw_rotation_offset) + tbiw_mount_rotation_xyz = (0, rad2deg(angle_x), 0) + np.array(tbiw_rotation_offset) return tbiw_mount_location_xyz, tbiw_mount_rotation_xyz -- cgit v1.2.3 From 3a74bee2fcd1561f5cf23a4f57fe41062203313e Mon Sep 17 00:00:00 2001 From: Edward Date: Thu, 19 Aug 2021 15:40:34 -0400 Subject: allow multiple config files generate_configuration.py now only generates a configuration file; it no longer also runs dactyl_manuform.py. it will save the generated configuration file to the configs directory, and it will be named according to the config_name. passing a --config= argument to the script will set the config_name and save_dir. dactyl_manuform.py now also accepts a --config= argument. if non is passed, the default values from generate_configuration.py are used. otherwise, the defaults will be overridden by the values from the config specified. because of these changes, i removed run_config.json. it should have default values anyway, so it seemed reduandant and confusing. the run command has also been updated to allow for the config changes, and some bugs have also been fixed. --- src/dactyl_manuform.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index bb164b5..5677791 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -1,6 +1,7 @@ import numpy as np from numpy import pi import os.path as path +import getopt, sys import json import os @@ -23,11 +24,15 @@ import generate_configuration as cfg for item in cfg.shape_config: locals()[item] = cfg.shape_config[item] -## LOAD RUN CONFIGURATION FILE AND WRITE TO ANY VARIABLES IN FILE. -with open('run_config.json', mode='r') as fid: - data = json.load(fid) -for item in data: - locals()[item] = data[item] +## CHECK FOR CONFIG FILE AND WRITE TO ANY VARIABLES IN FILE. +opts, args = getopt.getopt(sys.argv[1:], "", ["config="]); +for opt, arg in opts: + if opt in ('--config'): + with open(os.path.join(r"..", "configs", arg + '.json'), mode='r') as fid: + data = json.load(fid) + for item in data: + locals()[item] = data[item] + # Really rough setup. Check for ENGINE, set it not present from configuration. try: -- cgit v1.2.3 From 5281fb752d0d9728191775faef527d0fffd3d7b8 Mon Sep 17 00:00:00 2001 From: Edward Date: Thu, 19 Aug 2021 18:41:33 -0400 Subject: moved parts to their own directory also fixed bug that would not correctly inlcude parts for configs with a `save_dir` set to a subdirectory of the things directory --- src/dactyl_manuform.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index c913ced..22cf2f5 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -39,9 +39,11 @@ except Exception: print('Setting Current Engine = {}'.format(ENGINE)) if save_dir in ['', None, '.']: - save_path = os.path.join(r"..", "things") + save_path = path.join(r"..", "things") + parts_path = path.join(r"..", "src", "parts") else: - save_path = os.path.join(r"..", "things", save_dir) + save_path = path.join(r"..", "things", save_dir) + parts_path = path.join(r"..", r"..", "src", "parts") ############################################### # END EXTREMELY UGLY BOOTSTRAP @@ -96,7 +98,7 @@ else: if 'HS_' in plate_style: symmetry = "asymmetric" - plate_file = path.join("..", "src", r"hot_swap_plate") + plate_file = path.join(parts_path, r"hot_swap_plate") plate_offset = 0.0 if (trackball_in_wall or ('TRACKBALL' in thumb_style)) and not ball_side == 'both': @@ -277,10 +279,10 @@ def trackball_socket(segments=100, side="right"): # cyl = translate(cyl, (0, 0, -8)) # shape = union([shape, cyl]) - tb_file = path.join("..", "src", r"trackball_socket_body_34mm") - tbcut_file = path.join("..", "src", r"trackball_socket_cutter_34mm") - sens_file = path.join("..", "src", r"trackball_sensor_mount") - senscut_file = path.join("..", "src", r"trackball_sensor_cutter") + tb_file = path.join(parts_path, r"trackball_socket_body_34mm") + tbcut_file = path.join(parts_path, r"trackball_socket_cutter_34mm") + sens_file = path.join(parts_path, r"trackball_sensor_mount") + senscut_file = path.join(parts_path, r"trackball_sensor_cutter") # shape = import_file(tb_file) -- cgit v1.2.3 From 23cfc02dca6c44b127144730e01d5ae89a9ee7b4 Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Fri, 20 Aug 2021 07:40:48 -0400 Subject: Fixes to base plate and screw mount "handedness" and baseplate mirroring. Minor fix to trackball in wall rotations. --- src/dactyl_manuform.py | 74 +++++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 31 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index c913ced..21af75b 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -2903,12 +2903,17 @@ def tbiw_position_rotation(): left_wall_x_offset = tbiw_left_wall_x_offset_override - tbiw_mount_location_xyz = (np.array(base_pt1)+np.array(base_pt2))/2. + np.array(((-left_wall_x_offset/2), 0, 0)) + np.array(tbiw_translational_offset) + tbiw_mount_location_xyz = ( + (np.array(base_pt1)+np.array(base_pt2))/2. + + np.array(((-left_wall_x_offset/2), 0, 0)) + + np.array(tbiw_translational_offset) + ) + # tbiw_mount_location_xyz[2] = (oled_translation_offset[2] + base_pt0[2])/2 angle_x = np.arctan2(base_pt1[2] - base_pt2[2], base_pt1[1] - base_pt2[1]) angle_z = np.arctan2(base_pt1[0] - base_pt2[0], base_pt1[1] - base_pt2[1]) - tbiw_mount_rotation_xyz = (0, rad2deg(angle_x), 0) + np.array(tbiw_rotation_offset) + tbiw_mount_rotation_xyz = (rad2deg(angle_x), 0, rad2deg(angle_z)) + np.array(tbiw_rotation_offset) return tbiw_mount_location_xyz, tbiw_mount_rotation_xyz @@ -3283,7 +3288,7 @@ def screw_insert_shape(bottom_radius, top_radius, height): return shape -def screw_insert(column, row, bottom_radius, top_radius, height): +def screw_insert(column, row, bottom_radius, top_radius, height, side='right'): debugprint('screw_insert()') shift_right = column == lastcol shift_left = column == 0 @@ -3325,7 +3330,7 @@ def screw_insert(column, row, bottom_radius, top_radius, height): ) elif shift_left: position = list( - np.array(left_key_position(row, 0)) + np.array(wall_locate3(-1, 0)) + np.array((shift_left_adjust,0,0)) + np.array(left_key_position(row, 0, side=side)) + np.array(wall_locate3(-1, 0)) + np.array((shift_left_adjust,0,0)) ) else: position = key_position( @@ -3367,15 +3372,15 @@ def screw_insert_thumb(bottom_radius, top_radius, height): shape = translate(shape, [position[0], position[1], height / 2]) return shape -def screw_insert_all_shapes(bottom_radius, top_radius, height, offset=0): +def screw_insert_all_shapes(bottom_radius, top_radius, height, offset=0, side='right'): print('screw_insert_all_shapes()') shape = ( - translate(screw_insert(0, 0, bottom_radius, top_radius, height), (0, 0, offset)), - translate(screw_insert(0, lastrow-1, bottom_radius, top_radius, height), (0, left_wall_lower_y_offset, offset)), - translate(screw_insert(3, lastrow, bottom_radius, top_radius, height), (0, 0, offset)), - translate(screw_insert(3, 0, bottom_radius, top_radius, height), (0,0, offset)), - translate(screw_insert(lastcol, 0, bottom_radius, top_radius, height), (0, 0, offset)), - translate(screw_insert(lastcol, lastrow-1, bottom_radius, top_radius, height), (0, 0, offset)), + translate(screw_insert(0, 0, bottom_radius, top_radius, height, side=side), (0, 0, offset)), + translate(screw_insert(0, lastrow-1, bottom_radius, top_radius, height, side=side), (0, left_wall_lower_y_offset, offset)), + translate(screw_insert(3, lastrow, bottom_radius, top_radius, height, side=side), (0, 0, offset)), + translate(screw_insert(3, 0, bottom_radius, top_radius, height, side=side), (0,0, offset)), + translate(screw_insert(lastcol, 0, bottom_radius, top_radius, height, side=side), (0, 0, offset)), + translate(screw_insert(lastcol, lastrow-1, bottom_radius, top_radius, height, side=side), (0, 0, offset)), translate(screw_insert_thumb(bottom_radius, top_radius, height), (0, 0, offset)), ) @@ -3384,20 +3389,21 @@ def screw_insert_all_shapes(bottom_radius, top_radius, height, offset=0): -def screw_insert_holes(): +def screw_insert_holes(side='right'): return screw_insert_all_shapes( - screw_insert_bottom_radius, screw_insert_top_radius, screw_insert_height+.02, offset=-.01 + screw_insert_bottom_radius, screw_insert_top_radius, screw_insert_height+.02, offset=-.01, side=side ) -def screw_insert_outers(): +def screw_insert_outers(side='right'): return screw_insert_all_shapes( screw_insert_bottom_radius + 1.6, screw_insert_top_radius + 1.6, screw_insert_height + 1.5, + side=side ) -def screw_insert_screw_holes(): - return screw_insert_all_shapes(1.7, 1.7, 350) +def screw_insert_screw_holes(side='right'): + return screw_insert_all_shapes(1.7, 1.7, 350, side=side) @@ -3462,7 +3468,7 @@ def model_side(side="right"): if debug_exports: export_file(shape=walls_shape, fname=path.join(r"..", "things", r"debug_walls_shape")) s2 = union([walls_shape]) - s2 = union([s2, *screw_insert_outers()]) + s2 = union([s2, *screw_insert_outers(side=side)]) if controller_mount_type in ['RJ9_USB_TEENSY', 'USB_TEENSY']: s2 = union([s2, teensy_holder()]) @@ -3480,7 +3486,7 @@ def model_side(side="right"): if controller_mount_type in ['None']: 0 # do nothing, only here to expressly state inaction. - s2 = difference(s2, [union(screw_insert_holes())]) + s2 = difference(s2, [union(screw_insert_holes(side=side))]) shape = union([shape, s2]) if controller_mount_type in ['RJ9_USB_TEENSY', 'RJ9_USB_WALL']: @@ -3534,12 +3540,12 @@ def model_side(side="right"): # NEEDS TO BE SPECIAL FOR CADQUERY -def baseplate(wedge_angle=None): +def baseplate(wedge_angle=None, side='right'): if ENGINE == 'cadquery': # shape = mod_r - shape = union([case_walls(), *screw_insert_outers()]) - # tool = translate(screw_insert_screw_holes(), [0, 0, -10]) - tool = screw_insert_all_shapes(screw_hole_diameter/2., screw_hole_diameter/2., 350) + shape = union([case_walls(side=side), *screw_insert_outers(side=side)]) + # tool = translate(screw_insert_screw_holes(side=side), [0, 0, -10]) + tool = screw_insert_all_shapes(screw_hole_diameter/2., screw_hole_diameter/2., 350, side=side) for item in tool: item = translate(item, [0, 0, -10]) shape = difference(shape, [item]) @@ -3605,11 +3611,11 @@ def baseplate(wedge_angle=None): else: shape = union([ - case_walls(), - *screw_insert_outers() + case_walls(side=side), + *screw_insert_outers(side=side) ]) - tool = translate(union(screw_insert_screw_holes()), [0, 0, -10]) + tool = translate(union(screw_insert_screw_holes(side=side)), [0, 0, -10]) base = box(1000, 1000, .01) shape = shape - tool shape = intersect(shape, base) @@ -3623,21 +3629,27 @@ def run(): mod_r = model_side(side="right") export_file(shape=mod_r, fname=path.join(save_path, config_name + r"_right")) + base = baseplate(side='right') + export_file(shape=base, fname=path.join(save_path, config_name + r"_right_plate")) + export_dxf(shape=base, fname=path.join(save_path, config_name + r"_right_plate")) + if symmetry == "asymmetric": mod_l = model_side(side="left") export_file(shape=mod_l, fname=path.join(save_path, config_name + r"_left")) + base_l = mirror(baseplate(side='left'), 'YZ') + export_file(shape=base_l, fname=path.join(save_path, config_name + r"_left_plate")) + export_dxf(shape=base_l, fname=path.join(save_path, config_name + r"_left_plate")) + else: export_file(shape=mirror(mod_r, 'YZ'), fname=path.join(save_path, config_name + r"_left")) + lbase = mirror(base, 'YZ') + export_file(shape=lbase, fname=path.join(save_path, config_name + r"_left_plate")) + export_dxf(shape=lbase, fname=path.join(save_path, config_name + r"_left_plate")) + - base = baseplate() - export_file(shape=base, fname=path.join(save_path, config_name + r"_right_plate")) - export_dxf(shape=base, fname=path.join(save_path, config_name + r"_right_plate")) - lbase = mirror(base, 'YZ') - export_file(shape=lbase, fname=path.join(save_path, config_name + r"_left_plate")) - export_dxf(shape=lbase, fname=path.join(save_path, config_name + r"_left_plate")) if oled_mount_type == 'UNDERCUT': export_file(shape=oled_undercut_mount_frame()[1], fname=path.join(save_path, config_name + r"_oled_undercut_test")) -- cgit v1.2.3 From b9c0013ea9dd83aaa83c994b0a572ace64d75c72 Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Fri, 20 Aug 2021 16:56:35 -0400 Subject: Now supports trackball in wall and in a cluster. An unlikely config, but it simplifies construction by removing the setting interdependency. --- src/dactyl_manuform.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 27e74c6..079ef6f 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -3509,11 +3509,23 @@ 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() + + shape = difference(shape, [tbprecut]) + # export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_1")) + shape = union([shape, tb]) + # export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_2")) + shape = difference(shape, [tbcutout]) + # export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_3a")) + # export_file(shape=add([shape, sensor]), fname=path.join(save_path, config_name + r"_test_3b")) + shape = union([shape, sensor]) + + if show_caps: + shape = add([shape, ball]) + 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() + 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")) -- cgit v1.2.3 From c9df94ec88a1465bc900bc75dc9c1288056c26cf Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Fri, 20 Aug 2021 17:57:30 -0400 Subject: Adapted Trackball from Cjen1 to match newer structure. Appears to work as intended. --- src/dactyl_manuform.py | 1072 ++++++++++++++++++++++++------------------------ 1 file changed, 545 insertions(+), 527 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 1c5960c..0fd4be6 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -608,7 +608,7 @@ def thumborigin(): return origin -def thumb_tl_place(shape): +def default_thumb_tl_place(shape): debugprint('thumb_tl_place()') shape = rotate(shape, [7.5, -18, 10]) shape = translate(shape, thumborigin()) @@ -616,14 +616,14 @@ def thumb_tl_place(shape): return shape -def thumb_tr_place(shape): +def default_thumb_tr_place(shape): debugprint('thumb_tr_place()') shape = rotate(shape, [10, -15, 10]) shape = translate(shape, thumborigin()) shape = translate(shape, [-12, -16, 3]) return shape -def thumb_mr_place(shape): +def default_thumb_mr_place(shape): debugprint('thumb_mr_place()') shape = rotate(shape, [-6, -34, 48]) shape = translate(shape, thumborigin()) @@ -631,7 +631,7 @@ def thumb_mr_place(shape): return shape -def thumb_ml_place(shape): +def default_thumb_ml_place(shape): debugprint('thumb_ml_place()') shape = rotate(shape, [6, -34, 40]) shape = translate(shape, thumborigin()) @@ -639,7 +639,7 @@ def thumb_ml_place(shape): return shape -def thumb_br_place(shape): +def default_thumb_br_place(shape): debugprint('thumb_br_place()') shape = rotate(shape, [-16, -33, 54]) shape = translate(shape, thumborigin()) @@ -647,7 +647,7 @@ def thumb_br_place(shape): return shape -def thumb_bl_place(shape): +def default_thumb_bl_place(shape): debugprint('thumb_bl_place()') shape = rotate(shape, [-4, -35, 52]) shape = translate(shape, thumborigin()) @@ -655,63 +655,63 @@ def thumb_bl_place(shape): return shape -def thumb_1x_layout(shape, cap=False): +def default_thumb_1x_layout(shape, cap=False): debugprint('thumb_1x_layout()') if cap: shape_list = [ - thumb_mr_place(rotate(shape, [0, 0, thumb_plate_mr_rotation])), - thumb_ml_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])), - thumb_br_place(rotate(shape, [0, 0, thumb_plate_br_rotation])), - thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])), + default_thumb_mr_place(rotate(shape, [0, 0, thumb_plate_mr_rotation])), + default_thumb_ml_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])), + default_thumb_br_place(rotate(shape, [0, 0, thumb_plate_br_rotation])), + default_thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])), ] if default_1U_cluster: - shape_list.append(thumb_tr_place(rotate(rotate(shape, (0, 0, 90)), [0, 0, thumb_plate_tr_rotation]))) - shape_list.append(thumb_tr_place(rotate(rotate(shape, (0, 0, 90)), [0, 0, thumb_plate_tr_rotation]))) - shape_list.append(thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation]))) + shape_list.append(default_thumb_tr_place(rotate(rotate(shape, (0, 0, 90)), [0, 0, thumb_plate_tr_rotation]))) + shape_list.append(default_thumb_tr_place(rotate(rotate(shape, (0, 0, 90)), [0, 0, thumb_plate_tr_rotation]))) + shape_list.append(default_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation]))) shapes = add(shape_list) else: shape_list = [ - thumb_mr_place(rotate(shape, [0, 0, thumb_plate_mr_rotation])), - thumb_ml_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])), - thumb_br_place(rotate(shape, [0, 0, thumb_plate_br_rotation])), - thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])), + default_thumb_mr_place(rotate(shape, [0, 0, thumb_plate_mr_rotation])), + default_thumb_ml_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])), + default_thumb_br_place(rotate(shape, [0, 0, thumb_plate_br_rotation])), + default_thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])), ] if default_1U_cluster: - shape_list.append(thumb_tr_place(rotate(rotate(shape, (0, 0, 90)), [0, 0, thumb_plate_tr_rotation]))) + shape_list.append(default_thumb_tr_place(rotate(rotate(shape, (0, 0, 90)), [0, 0, thumb_plate_tr_rotation]))) shapes = union(shape_list) return shapes -def thumb_15x_layout(shape, cap=False, plate=True): +def default_thumb_15x_layout(shape, cap=False, plate=True): debugprint('thumb_15x_layout()') if plate: if cap: shape = rotate(shape, (0, 0, 90)) - cap_list = [thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation]))] - cap_list.append(thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation]))) + cap_list = [default_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation]))] + cap_list.append(default_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation]))) return add(cap_list) else: - shape_list = [thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation]))] + shape_list = [default_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation]))] if not default_1U_cluster: - shape_list.append(thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation]))) + shape_list.append(default_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation]))) return union(shape_list) else: if cap: shape = rotate(shape, (0, 0, 90)) shape_list = [ - thumb_tl_place(shape), + default_thumb_tl_place(shape), ] - shape_list.append(thumb_tr_place(shape)) + shape_list.append(default_thumb_tr_place(shape)) return add(shape_list) else: shape_list = [ - thumb_tl_place(shape), + default_thumb_tl_place(shape), ] if not default_1U_cluster: - shape_list.append(thumb_tr_place(shape)) + shape_list.append(default_thumb_tr_place(shape)) return union(shape_list) @@ -762,12 +762,12 @@ def thumbcaps(side='right', style_override=None): elif _thumb_style == "CARBONFET": return carbonfet_thumbcaps() - elif "TRACKBALL" in _thumb_style: + elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): if _thumb_style == "TRACKBALL_ORBYL": return tbjs_thumbcaps() elif _thumb_style == "TRACKBALL_CJ": - return tb_thumbcaps() + return tbcj_thumbcaps() else: return thumbcaps(side, style_override=other_thumb) @@ -788,16 +788,16 @@ def thumb(side="right", style_override=None): elif _thumb_style == "CARBONFET": return carbonfet_thumb(side) - elif "TRACKBALL" in _thumb_style: + elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): if _thumb_style == "TRACKBALL_ORBYL": return tbjs_thumb(side) elif _thumb_style == "TRACKBALL_CJ": - return tb_thumb(side) + return tbcj_thumb(side) else: return thumb(side, style_override=other_thumb) - else: + else: return default_thumb(side) @@ -819,7 +819,7 @@ def thumb_connectors(side='right', style_override=None): if _thumb_style == "TRACKBALL_ORBYL": return tbjs_thumb_connectors() elif _thumb_style == "TRACKBALL_CJ": - return tb_thumb_connectors() + return tbcj_thumb_connectors() else: return thumb_connectors(side, style_override=other_thumb) @@ -828,17 +828,17 @@ def thumb_connectors(side='right', style_override=None): def default_thumbcaps(): - t1 = thumb_1x_layout(sa_cap(1), cap=True) + t1 = default_thumb_1x_layout(sa_cap(1), cap=True) if not default_1U_cluster: - t1.add(thumb_15x_layout(sa_cap(1.5), cap=True)) + t1.add(default_thumb_15x_layout(sa_cap(1.5), cap=True)) return t1 def default_thumb(side="right"): print('thumb()') - shape = thumb_1x_layout(rotate(single_plate(side=side), (0, 0, -90))) - shape = union([shape, thumb_15x_layout(rotate(single_plate(side=side), (0, 0, -90)))]) - shape = union([shape, thumb_15x_layout(double_plate(), plate=False)]) + shape = default_thumb_1x_layout(rotate(single_plate(side=side), (0, 0, -90))) + shape = union([shape, default_thumb_15x_layout(rotate(single_plate(side=side), (0, 0, -90)))]) + shape = union([shape, default_thumb_15x_layout(double_plate(), plate=False)]) return shape @@ -879,10 +879,10 @@ def default_thumb_connectors(): hulls.append( triangle_hulls( [ - thumb_tl_place(thumb_post_tr()), - thumb_tl_place(thumb_post_br()), - thumb_tr_place(web_post_tl()), - thumb_tr_place(web_post_bl()), + default_thumb_tl_place(thumb_post_tr()), + default_thumb_tl_place(thumb_post_br()), + default_thumb_tr_place(web_post_tl()), + default_thumb_tr_place(web_post_bl()), ] ) ) @@ -890,10 +890,10 @@ def default_thumb_connectors(): hulls.append( triangle_hulls( [ - thumb_tl_place(thumb_post_tr()), - thumb_tl_place(thumb_post_br()), - thumb_tr_place(thumb_post_tl()), - thumb_tr_place(thumb_post_bl()), + default_thumb_tl_place(thumb_post_tr()), + default_thumb_tl_place(thumb_post_br()), + default_thumb_tr_place(thumb_post_tl()), + default_thumb_tr_place(thumb_post_bl()), ] ) ) @@ -902,10 +902,10 @@ def default_thumb_connectors(): hulls.append( triangle_hulls( [ - thumb_br_place(web_post_tr()), - thumb_br_place(web_post_br()), - thumb_mr_place(web_post_tl()), - thumb_mr_place(web_post_bl()), + default_thumb_br_place(web_post_tr()), + default_thumb_br_place(web_post_br()), + default_thumb_mr_place(web_post_tl()), + default_thumb_mr_place(web_post_bl()), ] ) ) @@ -914,10 +914,10 @@ def default_thumb_connectors(): hulls.append( triangle_hulls( [ - thumb_br_place(web_post_tr()), - thumb_br_place(web_post_br()), - thumb_mr_place(web_post_tl()), - thumb_mr_place(web_post_bl()), + default_thumb_br_place(web_post_tr()), + default_thumb_br_place(web_post_br()), + default_thumb_mr_place(web_post_tl()), + default_thumb_mr_place(web_post_bl()), ] ) ) @@ -925,10 +925,10 @@ def default_thumb_connectors(): hulls.append( triangle_hulls( [ - thumb_bl_place(web_post_tr()), - thumb_bl_place(web_post_br()), - thumb_ml_place(web_post_tl()), - thumb_ml_place(web_post_bl()), + default_thumb_bl_place(web_post_tr()), + default_thumb_bl_place(web_post_br()), + default_thumb_ml_place(web_post_tl()), + default_thumb_ml_place(web_post_bl()), ] ) ) @@ -937,14 +937,14 @@ def default_thumb_connectors(): hulls.append( triangle_hulls( [ - thumb_br_place(web_post_tl()), - thumb_bl_place(web_post_bl()), - thumb_br_place(web_post_tr()), - thumb_bl_place(web_post_br()), - thumb_mr_place(web_post_tl()), - thumb_ml_place(web_post_bl()), - thumb_mr_place(web_post_tr()), - thumb_ml_place(web_post_br()), + default_thumb_br_place(web_post_tl()), + default_thumb_bl_place(web_post_bl()), + default_thumb_br_place(web_post_tr()), + default_thumb_bl_place(web_post_br()), + default_thumb_mr_place(web_post_tl()), + default_thumb_ml_place(web_post_bl()), + default_thumb_mr_place(web_post_tr()), + default_thumb_ml_place(web_post_br()), ] ) ) @@ -953,15 +953,15 @@ def default_thumb_connectors(): hulls.append( triangle_hulls( [ - thumb_tl_place(thumb_post_tl()), - thumb_ml_place(web_post_tr()), - thumb_tl_place(thumb_post_bl()), - thumb_ml_place(web_post_br()), - thumb_tl_place(thumb_post_br()), - thumb_mr_place(web_post_tr()), - thumb_tr_place(web_post_bl()), - thumb_mr_place(web_post_br()), - thumb_tr_place(web_post_br()), + default_thumb_tl_place(thumb_post_tl()), + default_thumb_ml_place(web_post_tr()), + default_thumb_tl_place(thumb_post_bl()), + default_thumb_ml_place(web_post_br()), + default_thumb_tl_place(thumb_post_br()), + default_thumb_mr_place(web_post_tr()), + default_thumb_tr_place(web_post_bl()), + default_thumb_mr_place(web_post_br()), + default_thumb_tr_place(web_post_br()), ] ) ) @@ -970,15 +970,15 @@ def default_thumb_connectors(): hulls.append( triangle_hulls( [ - thumb_tl_place(thumb_post_tl()), - thumb_ml_place(web_post_tr()), - thumb_tl_place(thumb_post_bl()), - thumb_ml_place(web_post_br()), - thumb_tl_place(thumb_post_br()), - thumb_mr_place(web_post_tr()), - thumb_tr_place(thumb_post_bl()), - thumb_mr_place(web_post_br()), - thumb_tr_place(thumb_post_br()), + default_thumb_tl_place(thumb_post_tl()), + default_thumb_ml_place(web_post_tr()), + default_thumb_tl_place(thumb_post_bl()), + default_thumb_ml_place(web_post_br()), + default_thumb_tl_place(thumb_post_br()), + default_thumb_mr_place(web_post_tr()), + default_thumb_tr_place(thumb_post_bl()), + default_thumb_mr_place(web_post_br()), + default_thumb_tr_place(thumb_post_br()), ] ) ) @@ -987,19 +987,19 @@ def default_thumb_connectors(): hulls.append( triangle_hulls( [ - thumb_tl_place(thumb_post_tl()), + default_thumb_tl_place(thumb_post_tl()), key_place(web_post_bl(), 0, cornerrow), - thumb_tl_place(thumb_post_tr()), + default_thumb_tl_place(thumb_post_tr()), key_place(web_post_br(), 0, cornerrow), - thumb_tr_place(web_post_tl()), + default_thumb_tr_place(web_post_tl()), key_place(web_post_bl(), 1, cornerrow), - thumb_tr_place(web_post_tr()), + default_thumb_tr_place(web_post_tr()), key_place(web_post_br(), 1, cornerrow), key_place(web_post_tl(), 2, lastrow), key_place(web_post_bl(), 2, lastrow), - thumb_tr_place(web_post_tr()), + default_thumb_tr_place(web_post_tr()), key_place(web_post_bl(), 2, lastrow), - thumb_tr_place(web_post_br()), + default_thumb_tr_place(web_post_br()), key_place(web_post_br(), 2, lastrow), key_place(web_post_bl(), 3, lastrow), key_place(web_post_tr(), 2, lastrow), @@ -1015,19 +1015,19 @@ def default_thumb_connectors(): hulls.append( triangle_hulls( [ - thumb_tl_place(thumb_post_tl()), + default_thumb_tl_place(thumb_post_tl()), key_place(web_post_bl(), 0, cornerrow), - thumb_tl_place(thumb_post_tr()), + default_thumb_tl_place(thumb_post_tr()), key_place(web_post_br(), 0, cornerrow), - thumb_tr_place(thumb_post_tl()), + default_thumb_tr_place(thumb_post_tl()), key_place(web_post_bl(), 1, cornerrow), - thumb_tr_place(thumb_post_tr()), + default_thumb_tr_place(thumb_post_tr()), key_place(web_post_br(), 1, cornerrow), key_place(web_post_tl(), 2, lastrow), key_place(web_post_bl(), 2, lastrow), - thumb_tr_place(thumb_post_tr()), + default_thumb_tr_place(thumb_post_tr()), key_place(web_post_bl(), 2, lastrow), - thumb_tr_place(thumb_post_br()), + default_thumb_tr_place(thumb_post_br()), key_place(web_post_br(), 2, lastrow), key_place(web_post_bl(), 3, lastrow), key_place(web_post_tr(), 2, lastrow), @@ -1752,360 +1752,6 @@ def carbonfet_thumb_connectors(): return union(hulls) -############################ -# TRACKBALL THUMB CLUSTER -############################ - -# single_plate = the switch shape - -def tb_thumb_tr_place(shape): - shape = rotate(shape, [10, -15, 10]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-12, -16, 3]) - return shape - -def tb_thumb_tl_place(shape): - shape = rotate(shape, [7.5, -18, 10]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-32.5, -14.5, -2.5]) - return shape - -def tb_thumb_ml_place(shape): - shape = rotate(shape, [6, -34, 40]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-51, -25, -12]) - return shape - -def tb_thumb_bl_place(shape): - shape = rotate(shape, [-4, -35, 52]) - shape = translate(shape, thumborigin()) - shape = translate(shape, [-56.3, -43.3, -23.5]) - return shape - -def tb_thumb_layout(shape): - return union([ - tb_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])), - tb_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation])), - tb_thumb_ml_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])), - tb_thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])), - ]) - - -#def oct_corner(i, radius, shape): -# i = (i+1)%8 -# -# points_x = [1, 2, 2, 1, -1, -2, -2, -1] -# points_y = [2, 1, -1, -2, -2, -1, 1, 2] -# -# return translate(shape, (points_x[i] * radius / 2, points_y[i] * radius / 2, 0)) - -import math -def oct_corner(i, diameter, shape): - radius = diameter / 2 - i = (i+1)%8 - - r = radius - m = radius * math.tan(math.pi / 8) - - points_x = [m, r, r, m, -m, -r, -r, -m] - points_y = [r, m, -m, -r, -r, -m, m, r] - - return translate(shape, (points_x[i], points_y[i], 0)) - -tb_inner_diameter = 42 -tb_thickness = 2 -tb_outer_diameter = 53 - -def trackball_edge_post(i): - shape = box(post_size, post_size, tb_thickness) - shape = oct_corner(i, tb_outer_diameter, shape) - return shape - -def trackball_web_post(i): - shape = box(post_size, post_size, tb_thickness) - shape = oct_corner(i, tb_outer_diameter, shape) - return shape - -def trackball_holder(): - center = box(post_size, post_size, tb_thickness) - - shape = [] - for i in range(8): - shape_ = hull_from_shapes([ - center, - trackball_edge_post(i), - trackball_edge_post(i+1), - ]) - shape.append(shape_) - shape = union(shape) - - shape = difference( - shape, - [cylinder(tb_inner_diameter/2, tb_thickness + 0.1)] - ) - - return shape - -def trackball_place(shape): - loc = np.array([-15, -60, -12]) + thumborigin() - shape = translate(shape, loc) - shape = rotate(shape, (0,0,0)) - return shape - -def tb_thumb(side="right"): - t = tb_thumb_layout(single_plate(side=side)) - tb = trackball_place(trackball_holder()) - return union([t, tb]) - -def tb_thumbcaps(): - t = tb_thumb_layout(sa_cap(1)) - return t - -def thumb_post_tr(): - return translate(web_post(), - [(mount_width / 2) - post_adj, ((mount_height/2) + double_plate_height) - post_adj, 0] - ) - - -def thumb_post_tl(): - return translate(web_post(), - [-(mount_width / 2) + post_adj, ((mount_height/2) + double_plate_height) - post_adj, 0] - ) - - -def thumb_post_bl(): - return translate(web_post(), - [-(mount_width / 2) + post_adj, -((mount_height/2) + double_plate_height) + post_adj, 0] - ) - - -def thumb_post_br(): - return translate(web_post(), - [(mount_width / 2) - post_adj, -((mount_height/2) + double_plate_height) + post_adj, 0] - ) - -def tb_thumb_connectors(): - hulls = [] - - # Top two - hulls.append( - triangle_hulls( - [ - tb_thumb_tl_place(web_post_tr()), - tb_thumb_tl_place(web_post_br()), - tb_thumb_tr_place(web_post_tl()), - tb_thumb_tr_place(web_post_bl()), - ] - ) - ) - - # centers of the bottom four - hulls.append( - triangle_hulls( - [ - tb_thumb_bl_place(web_post_tr()), - tb_thumb_bl_place(web_post_br()), - tb_thumb_ml_place(web_post_tl()), - tb_thumb_ml_place(web_post_bl()), - ] - ) - ) - - # top two to the middle two, starting on the left - - hulls.append( - triangle_hulls( - [ - tb_thumb_tl_place(web_post_tl()), - tb_thumb_ml_place(web_post_tr()), - tb_thumb_tl_place(web_post_bl()), - tb_thumb_ml_place(web_post_br()), - tb_thumb_tl_place(web_post_br()), - tb_thumb_tr_place(web_post_bl()), - tb_thumb_tr_place(web_post_br()), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ - tb_thumb_tl_place(web_post_tl()), - key_place(web_post_bl(), 0, cornerrow), - tb_thumb_tl_place(web_post_tr()), - key_place(web_post_br(), 0, cornerrow), - tb_thumb_tr_place(web_post_tl()), - key_place(web_post_bl(), 1, cornerrow), - tb_thumb_tr_place(web_post_tr()), - key_place(web_post_br(), 1, cornerrow), - key_place(web_post_tl(), 2, lastrow), - key_place(web_post_bl(), 2, lastrow), - tb_thumb_tr_place(web_post_tr()), - key_place(web_post_bl(), 2, lastrow), - tb_thumb_tr_place(web_post_br()), - 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), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ - key_place(web_post_br(), 1, cornerrow), - key_place(web_post_tl(), 2, lastrow), - key_place(web_post_bl(), 2, cornerrow), - key_place(web_post_tr(), 2, lastrow), - key_place(web_post_br(), 2, cornerrow), - key_place(web_post_bl(), 3, cornerrow), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ - key_place(web_post_tr(), 3, lastrow), - key_place(web_post_br(), 3, lastrow), - key_place(web_post_tr(), 3, lastrow), - key_place(web_post_bl(), 4, cornerrow), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ - trackball_place(trackball_web_post(4)), - tb_thumb_bl_place(web_post_bl()), - trackball_place(trackball_web_post(5)), - tb_thumb_bl_place(web_post_br()), - trackball_place(trackball_web_post(6)), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ - tb_thumb_bl_place(web_post_br()), - trackball_place(trackball_web_post(6)), - tb_thumb_ml_place(web_post_bl()), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ - tb_thumb_ml_place(web_post_bl()), - trackball_place(trackball_web_post(6)), - tb_thumb_ml_place(web_post_br()), - tb_thumb_tr_place(web_post_bl()), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ - trackball_place(trackball_web_post(6)), - tb_thumb_tr_place(web_post_bl()), - trackball_place(trackball_web_post(7)), - tb_thumb_tr_place(web_post_br()), - trackball_place(trackball_web_post(0)), - tb_thumb_tr_place(web_post_br()), - key_place(web_post_bl(), 3, lastrow), - ] - ) - ) - - return union(hulls) - -def tb_thumb_walls(): - shape = union([wall_brace(tb_thumb_ml_place, -0.3, 1, web_post_tr(), tb_thumb_ml_place, 0, 1, web_post_tl())]) - shape = union([shape, wall_brace(tb_thumb_bl_place, 0, 1, web_post_tr(), tb_thumb_bl_place, 0, 1, web_post_tl())]) - shape = union([shape, wall_brace(tb_thumb_bl_place, -1, 0, web_post_tl(), tb_thumb_bl_place, -1, 0, web_post_bl())]) - shape = union([shape, wall_brace(tb_thumb_bl_place, -1, 0, web_post_tl(), tb_thumb_bl_place, 0, 1, web_post_tl())]) - shape = union([shape, wall_brace(tb_thumb_ml_place, 0, 1, web_post_tl(), tb_thumb_bl_place, 0, 1, web_post_tr())]) - - corner = box(1,1,tb_thickness) - - points = [ - (tb_thumb_bl_place, -1, 0, web_post_bl()), - (trackball_place, 0, -1, trackball_web_post(4)), - (trackball_place, 0, -1, trackball_web_post(3)), - (trackball_place, 0, -1, trackball_web_post(2)), - (trackball_place, 1, -1, trackball_web_post(1)), - (trackball_place, 1, 0, trackball_web_post(0)), - ((lambda sh: key_place(sh, 3, lastrow)), 0, -1, web_post_bl()), - ] - for i,_ in enumerate(points[:-1]): - (pa, dxa, dya, sa) = points[i] - (pb, dxb, dyb, sb) = points[i + 1] - - shape = union([shape, wall_brace(pa, dxa, dya, sa, pb, dxb, dyb, sb)]) - - return shape - -def tb_thumb_connection(): - # clunky bit on the top left thumb connection (normal connectors don't work well) - shape = union([bottom_hull( - [ - 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), - thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), - thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), - ] - )]) - - 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), - thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), - thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), - thumb_tl_place(web_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), - thumb_tl_place(web_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), - thumb_tl_place(web_post_tl()), - ] - )]) - - shape = union([shape, hull_from_shapes( - [ - thumb_ml_place(web_post_tr()), - thumb_ml_place(translate(web_post_tr(), wall_locate1(-0.3, 1))), - thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), - thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), - thumb_tl_place(web_post_tl()), - ] - )]) - - return shape ############################ # Trackball (Ball + 4-key) THUMB CLUSTER @@ -2421,9 +2067,297 @@ def tbjs_thumb_connectors(): return union(hulls) -########## -## Case ## -########## + + + +############################ +# TRACKBALL THUMB CLUSTER +############################ + +# single_plate = the switch shape + +def tbcj_thumb_tr_place(shape): + shape = rotate(shape, [10, -15, 10]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-12, -16, 3]) + return shape + +def tbcj_thumb_tl_place(shape): + shape = rotate(shape, [7.5, -18, 10]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-32.5, -14.5, -2.5]) + return shape + +def tbcj_thumb_ml_place(shape): + shape = rotate(shape, [6, -34, 40]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-51, -25, -12]) + return shape + +def tbcj_thumb_bl_place(shape): + shape = rotate(shape, [-4, -35, 52]) + shape = translate(shape, thumborigin()) + shape = translate(shape, [-56.3, -43.3, -23.5]) + return shape + +def tbcj_thumb_layout(shape): + return union([ + tbcj_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])), + tbcj_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation])), + tbcj_thumb_ml_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])), + tbcj_thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])), + ]) + + +#def oct_corner(i, radius, shape): +# i = (i+1)%8 +# +# points_x = [1, 2, 2, 1, -1, -2, -2, -1] +# points_y = [2, 1, -1, -2, -2, -1, 1, 2] +# +# return translate(shape, (points_x[i] * radius / 2, points_y[i] * radius / 2, 0)) + +import math +def oct_corner(i, diameter, shape): + radius = diameter / 2 + i = (i+1)%8 + + r = radius + m = radius * math.tan(math.pi / 8) + + points_x = [m, r, r, m, -m, -r, -r, -m] + points_y = [r, m, -m, -r, -r, -m, m, r] + + return translate(shape, (points_x[i], points_y[i], 0)) + +def tbcj_edge_post(i): + shape = box(post_size, post_size, tbcj_thickness) + shape = oct_corner(i, tbcj_outer_diameter, shape) + return shape + +def tbcj_web_post(i): + shape = box(post_size, post_size, tbcj_thickness) + shape = oct_corner(i, tbcj_outer_diameter, shape) + return shape + +def tbcj_holder(): + center = box(post_size, post_size, tbcj_thickness) + + shape = [] + for i in range(8): + shape_ = hull_from_shapes([ + center, + tbcj_edge_post(i), + tbcj_edge_post(i + 1), + ]) + shape.append(shape_) + shape = union(shape) + + shape = difference( + shape, + [cylinder(tbcj_inner_diameter/2, tbcj_thickness + 0.1)] + ) + + return shape + +def tbcj_thumb_position_rotation(): + # loc = np.array([-15, -60, -12]) + thumborigin() + # shape = translate(shape, loc) + # shape = rotate(shape, (0,0,0)) + pos = np.array([-15, -60, -12]) + thumborigin() + rot = (0,0,0) + return pos, rot + + +def tbcj_place(shape): + loc = np.array([-15, -60, -12]) + thumborigin() + shape = translate(shape, loc) + shape = rotate(shape, (0,0,0)) + return shape + +def tbcj_thumb(side="right"): + t = tbcj_thumb_layout(single_plate(side=side)) + tb = tbcj_place(tbcj_holder()) + return union([t, tb]) + +def tbcj_thumbcaps(): + t = tbcj_thumb_layout(sa_cap(1)) + return t + + +# TODO: VERIFY THEY CAN BE DELETED. THEY LOOK LIKE REPLICATES. +# def thumb_post_tr(): +# return translate(web_post(), +# [(mount_width / 2) - post_adj, ((mount_height/2) + double_plate_height) - post_adj, 0] +# ) +# +# +# def thumb_post_tl(): +# return translate(web_post(), +# [-(mount_width / 2) + post_adj, ((mount_height/2) + double_plate_height) - post_adj, 0] +# ) +# +# +# def thumb_post_bl(): +# return translate(web_post(), +# [-(mount_width / 2) + post_adj, -((mount_height/2) + double_plate_height) + post_adj, 0] +# ) +# +# +# def thumb_post_br(): +# return translate(web_post(), +# [(mount_width / 2) - post_adj, -((mount_height/2) + double_plate_height) + post_adj, 0] +# ) + +def tbcj_thumb_connectors(): + hulls = [] + + # Top two + hulls.append( + triangle_hulls( + [ + tbcj_thumb_tl_place(web_post_tr()), + tbcj_thumb_tl_place(web_post_br()), + tbcj_thumb_tr_place(web_post_tl()), + tbcj_thumb_tr_place(web_post_bl()), + ] + ) + ) + + # centers of the bottom four + hulls.append( + triangle_hulls( + [ + tbcj_thumb_bl_place(web_post_tr()), + tbcj_thumb_bl_place(web_post_br()), + tbcj_thumb_ml_place(web_post_tl()), + tbcj_thumb_ml_place(web_post_bl()), + ] + ) + ) + + # top two to the middle two, starting on the left + + hulls.append( + triangle_hulls( + [ + tbcj_thumb_tl_place(web_post_tl()), + tbcj_thumb_ml_place(web_post_tr()), + tbcj_thumb_tl_place(web_post_bl()), + tbcj_thumb_ml_place(web_post_br()), + tbcj_thumb_tl_place(web_post_br()), + tbcj_thumb_tr_place(web_post_bl()), + tbcj_thumb_tr_place(web_post_br()), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + tbcj_thumb_tl_place(web_post_tl()), + key_place(web_post_bl(), 0, cornerrow), + tbcj_thumb_tl_place(web_post_tr()), + key_place(web_post_br(), 0, cornerrow), + tbcj_thumb_tr_place(web_post_tl()), + key_place(web_post_bl(), 1, cornerrow), + tbcj_thumb_tr_place(web_post_tr()), + key_place(web_post_br(), 1, cornerrow), + key_place(web_post_tl(), 2, lastrow), + key_place(web_post_bl(), 2, lastrow), + tbcj_thumb_tr_place(web_post_tr()), + key_place(web_post_bl(), 2, lastrow), + tbcj_thumb_tr_place(web_post_br()), + 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), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + key_place(web_post_br(), 1, cornerrow), + key_place(web_post_tl(), 2, lastrow), + key_place(web_post_bl(), 2, cornerrow), + key_place(web_post_tr(), 2, lastrow), + key_place(web_post_br(), 2, cornerrow), + key_place(web_post_bl(), 3, cornerrow), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + key_place(web_post_tr(), 3, lastrow), + key_place(web_post_br(), 3, lastrow), + key_place(web_post_tr(), 3, lastrow), + key_place(web_post_bl(), 4, cornerrow), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + tbcj_place(tbcj_web_post(4)), + tbcj_thumb_bl_place(web_post_bl()), + tbcj_place(tbcj_web_post(5)), + tbcj_thumb_bl_place(web_post_br()), + tbcj_place(tbcj_web_post(6)), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + tbcj_thumb_bl_place(web_post_br()), + tbcj_place(tbcj_web_post(6)), + tbcj_thumb_ml_place(web_post_bl()), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + tbcj_thumb_ml_place(web_post_bl()), + tbcj_place(tbcj_web_post(6)), + tbcj_thumb_ml_place(web_post_br()), + tbcj_thumb_tr_place(web_post_bl()), + ] + ) + ) + + hulls.append( + triangle_hulls( + [ + tbcj_place(tbcj_web_post(6)), + tbcj_thumb_tr_place(web_post_bl()), + tbcj_place(tbcj_web_post(7)), + tbcj_thumb_tr_place(web_post_br()), + tbcj_place(tbcj_web_post(0)), + tbcj_thumb_tr_place(web_post_br()), + key_place(web_post_bl(), 3, lastrow), + ] + ) + ) + + return union(hulls) + + + +########## +## Case ## +########## def left_key_position(row, direction, low_corner=False, side='right'): debugprint("left_key_position()") @@ -2669,7 +2603,7 @@ def thumb_walls(side='right', style_override=None): if _thumb_style == "TRACKBALL_ORBYL" : return tbjs_thumb_walls() elif thumb_style == "TRACKBALL_CJ": - return tb_thumb_walls() + return tbcj_thumb_walls() else: return thumb_walls(side, style_override=other_thumb) @@ -2694,7 +2628,7 @@ def thumb_connection(side='right', style_override=None): if _thumb_style == "TRACKBALL_ORBYL": return tbjs_thumb_connection(side=side) elif thumb_style == "TRACKBALL_CJ": - return tb_thumb_connection(side=side) + return tbcj_thumb_connection(side=side) else: return thumb_connection(side, style_override=other_thumb) else: @@ -2705,26 +2639,26 @@ def default_thumb_walls(): print('thumb_walls()') # thumb, walls if default_1U_cluster: - shape = union([wall_brace(thumb_mr_place, 0, -1, web_post_br(), thumb_tr_place, 0, -1, web_post_br())]) + shape = union([wall_brace(default_thumb_mr_place, 0, -1, web_post_br(), default_thumb_tr_place, 0, -1, web_post_br())]) else: - shape = union([wall_brace(thumb_mr_place, 0, -1, web_post_br(), thumb_tr_place, 0, -1, thumb_post_br())]) - shape = union([shape, wall_brace(thumb_mr_place, 0, -1, web_post_br(), thumb_mr_place, 0, -1, web_post_bl())]) - shape = union([shape, wall_brace(thumb_br_place, 0, -1, web_post_br(), thumb_br_place, 0, -1, web_post_bl())]) - shape = union([shape, wall_brace(thumb_ml_place, -0.3, 1, web_post_tr(), thumb_ml_place, 0, 1, web_post_tl())]) - shape = union([shape, wall_brace(thumb_bl_place, 0, 1, web_post_tr(), thumb_bl_place, 0, 1, web_post_tl())]) - shape = union([shape, wall_brace(thumb_br_place, -1, 0, web_post_tl(), thumb_br_place, -1, 0, web_post_bl())]) - shape = union([shape, wall_brace(thumb_bl_place, -1, 0, web_post_tl(), thumb_bl_place, -1, 0, web_post_bl())]) + shape = union([wall_brace(default_thumb_mr_place, 0, -1, web_post_br(), default_thumb_tr_place, 0, -1, thumb_post_br())]) + shape = union([shape, wall_brace(default_thumb_mr_place, 0, -1, web_post_br(), default_thumb_mr_place, 0, -1, web_post_bl())]) + shape = union([shape, wall_brace(default_thumb_br_place, 0, -1, web_post_br(), default_thumb_br_place, 0, -1, web_post_bl())]) + shape = union([shape, wall_brace(default_thumb_ml_place, -0.3, 1, web_post_tr(), default_thumb_ml_place, 0, 1, web_post_tl())]) + shape = union([shape, wall_brace(default_thumb_bl_place, 0, 1, web_post_tr(), default_thumb_bl_place, 0, 1, web_post_tl())]) + shape = union([shape, wall_brace(default_thumb_br_place, -1, 0, web_post_tl(), default_thumb_br_place, -1, 0, web_post_bl())]) + shape = union([shape, wall_brace(default_thumb_bl_place, -1, 0, web_post_tl(), default_thumb_bl_place, -1, 0, web_post_bl())]) # thumb, corners - shape = union([shape, wall_brace(thumb_br_place, -1, 0, web_post_bl(), thumb_br_place, 0, -1, web_post_bl())]) - shape = union([shape, wall_brace(thumb_bl_place, -1, 0, web_post_tl(), thumb_bl_place, 0, 1, web_post_tl())]) + shape = union([shape, wall_brace(default_thumb_br_place, -1, 0, web_post_bl(), default_thumb_br_place, 0, -1, web_post_bl())]) + shape = union([shape, wall_brace(default_thumb_bl_place, -1, 0, web_post_tl(), default_thumb_bl_place, 0, 1, web_post_tl())]) # thumb, tweeners - shape = union([shape, wall_brace(thumb_mr_place, 0, -1, web_post_bl(), thumb_br_place, 0, -1, web_post_br())]) - shape = union([shape, wall_brace(thumb_ml_place, 0, 1, web_post_tl(), thumb_bl_place, 0, 1, web_post_tr())]) - shape = union([shape, wall_brace(thumb_bl_place, -1, 0, web_post_bl(), thumb_br_place, -1, 0, web_post_tl())]) + shape = union([shape, wall_brace(default_thumb_mr_place, 0, -1, web_post_bl(), default_thumb_br_place, 0, -1, web_post_br())]) + shape = union([shape, wall_brace(default_thumb_ml_place, 0, 1, web_post_tl(), default_thumb_bl_place, 0, 1, web_post_tr())]) + shape = union([shape, wall_brace(default_thumb_bl_place, -1, 0, web_post_bl(), default_thumb_br_place, -1, 0, web_post_tl())]) if default_1U_cluster: - shape = union([shape, wall_brace(thumb_tr_place, 0, -1, web_post_br(), (lambda sh: key_place(sh, 3, lastrow)), 0, -1, web_post_bl())]) + shape = union([shape, wall_brace(default_thumb_tr_place, 0, -1, web_post_br(), (lambda sh: key_place(sh, 3, lastrow)), 0, -1, web_post_bl())]) else: - shape = union([shape, wall_brace(thumb_tr_place, 0, -1, thumb_post_br(), (lambda sh: key_place(sh, 3, lastrow)), 0, -1, web_post_bl())]) + shape = union([shape, wall_brace(default_thumb_tr_place, 0, -1, thumb_post_br(), (lambda sh: key_place(sh, 3, lastrow)), 0, -1, web_post_bl())]) return shape @@ -2736,8 +2670,8 @@ def default_thumb_connection(side='right'): [ left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), - thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), - thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), + default_thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), + default_thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), ] )]) @@ -2746,9 +2680,9 @@ def default_thumb_connection(side='right'): [ left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), - thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), - thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), - thumb_tl_place(thumb_post_tl()), + default_thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), + default_thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), + default_thumb_tl_place(thumb_post_tl()), ] ) ]) # ) @@ -2758,7 +2692,7 @@ def default_thumb_connection(side='right'): left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), - thumb_tl_place(thumb_post_tl()), + default_thumb_tl_place(thumb_post_tl()), ] )]) @@ -2767,22 +2701,73 @@ def default_thumb_connection(side='right'): left_key_place(web_post(), cornerrow, -1, low_corner=True, side=side), left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), key_place(web_post_bl(), 0, cornerrow), - thumb_tl_place(thumb_post_tl()), + default_thumb_tl_place(thumb_post_tl()), ] )]) shape = union([shape, hull_from_shapes( [ - thumb_ml_place(web_post_tr()), - thumb_ml_place(translate(web_post_tr(), wall_locate1(-0.3, 1))), - thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), - thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), - thumb_tl_place(thumb_post_tl()), + default_thumb_ml_place(web_post_tr()), + default_thumb_ml_place(translate(web_post_tr(), wall_locate1(-0.3, 1))), + default_thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), + default_thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), + default_thumb_tl_place(thumb_post_tl()), ] )]) return shape + +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=side, low_corner=True), # left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True), + tbjs_place(tbjs_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 tbjs_thumb_walls(): print('thumb_walls()') # thumb, walls @@ -2827,55 +2812,86 @@ def tbjs_thumb_walls(): return shape -def tbjs_thumb_connection(side='right'): - print('thumb_connection()') +def tbcj_thumb_connection(side='right'): # clunky bit on the top left thumb connection (normal connectors don't work well) - hulls = [] - hulls.append( - triangle_hulls( + shape = union([bottom_hull( + [ + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), + default_thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), + default_thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), + ] + )]) + + shape = union([shape, + hull_from_shapes( [ - 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()), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), + default_thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), + default_thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), + default_thumb_tl_place(web_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), + shape = union([shape, hull_from_shapes( + [ + left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate2(-1, 0)), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate3(-1, 0)), cornerrow, -1, low_corner=True, side=side), + default_thumb_tl_place(web_post_tl()), + ] + )]) + + shape = union([shape, hull_from_shapes( + [ + left_key_place(web_post(), cornerrow, -1, low_corner=True, side=side), + left_key_place(translate(web_post(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True, side=side), + key_place(web_post_bl(), 0, cornerrow), + default_thumb_tl_place(web_post_tl()), + ] + )]) + + shape = union([shape, hull_from_shapes( + [ + default_thumb_ml_place(web_post_tr()), + default_thumb_ml_place(translate(web_post_tr(), wall_locate1(-0.3, 1))), + default_thumb_ml_place(translate(web_post_tr(), wall_locate2(-0.3, 1))), + default_thumb_ml_place(translate(web_post_tr(), wall_locate3(-0.3, 1))), + default_thumb_tl_place(web_post_tl()), + ] + )]) - 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 tbcj_thumb_walls(): + shape = union([wall_brace(tbcj_thumb_ml_place, -0.3, 1, web_post_tr(), tbcj_thumb_ml_place, 0, 1, web_post_tl())]) + shape = union([shape, wall_brace(tbcj_thumb_bl_place, 0, 1, web_post_tr(), tbcj_thumb_bl_place, 0, 1, web_post_tl())]) + shape = union([shape, wall_brace(tbcj_thumb_bl_place, -1, 0, web_post_tl(), tbcj_thumb_bl_place, -1, 0, web_post_bl())]) + shape = union([shape, wall_brace(tbcj_thumb_bl_place, -1, 0, web_post_tl(), tbcj_thumb_bl_place, 0, 1, web_post_tl())]) + shape = union([shape, wall_brace(tbcj_thumb_ml_place, 0, 1, web_post_tl(), tbcj_thumb_bl_place, 0, 1, web_post_tr())]) + + corner = box(1,1,tbcj_thickness) + + points = [ + (tbcj_thumb_bl_place, -1, 0, web_post_bl()), + (tbcj_place, 0, -1, tbcj_web_post(4)), + (tbcj_place, 0, -1, tbcj_web_post(3)), + (tbcj_place, 0, -1, tbcj_web_post(2)), + (tbcj_place, 1, -1, tbcj_web_post(1)), + (tbcj_place, 1, 0, tbcj_web_post(0)), + ((lambda sh: key_place(sh, 3, lastrow)), 0, -1, web_post_bl()), + ] + for i,_ in enumerate(points[:-1]): + (pa, dxa, dya, sa) = points[i] + (pb, dxb, dyb, sb) = points[i + 1] + + shape = union([shape, wall_brace(pa, dxa, dya, sa, pb, dxb, dyb, sb)]) + + return shape + + def mini_thumb_walls(): # thumb, walls shape = union([wall_brace(mini_thumb_mr_place, 0, -1, web_post_br(), mini_thumb_tr_place, 0, -1, mini_thumb_post_br())]) @@ -3258,6 +3274,8 @@ def generate_trackball(pos, rot): def generate_trackball_in_cluster(): if thumb_style == 'TRACKBALL_ORBYL': pos, rot = tbjs_thumb_position_rotation() + elif thumb_style == 'TRACKBALL_CJ': + pos, rot = tbcj_thumb_position_rotation() return generate_trackball(pos, rot) @@ -3811,9 +3829,9 @@ def wire_post(direction, offset): def wire_posts(): debugprint('wire_posts()') - shape = thumb_ml_place(wire_post(1, 0).translate([-5, 0, -2])) - shape = union([shape, thumb_ml_place(wire_post(-1, 6).translate([0, 0, -2.5]))]) - shape = union([shape, thumb_ml_place(wire_post(1, 0).translate([5, 0, -2]))]) + shape = default_thumb_ml_place(wire_post(1, 0).translate([-5, 0, -2])) + shape = union([shape, default_thumb_ml_place(wire_post(-1, 6).translate([0, 0, -2.5]))]) + shape = union([shape, default_thumb_ml_place(wire_post(1, 0).translate([5, 0, -2]))]) for column in range(lastcol): for row in range(lastrow - 1): -- cgit v1.2.3 From 9e2c0c3b72eb0bb27210bf19d76e7e4b6f5ce295 Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Sat, 21 Aug 2021 20:31:07 -0400 Subject: Added config update to add new parameters to config. Retained ability to run the run_config.json file if there are no CLI arguments. Retained ability to run the run_config.json file if there are no CLI arguments. Will eventually deprecate run_config in favor of the configs directory, but don't want to mess up existing configs until they have time to migrate. Un-ignored configs. Would like to build a set of user configs through PRs to see variety. Add gallery directory for those with submit configs for people to see examples. All PRs for configs are expected to have identically named files (with some suffix for multiple) to show example images. --- src/dactyl_manuform.py | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 1dc1507..8156ca6 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -24,14 +24,20 @@ import generate_configuration as cfg for item in cfg.shape_config: locals()[item] = cfg.shape_config[item] -## CHECK FOR CONFIG FILE AND WRITE TO ANY VARIABLES IN FILE. -opts, args = getopt.getopt(sys.argv[1:], "", ["config="]); -for opt, arg in opts: - if opt in ('--config'): - with open(os.path.join(r"..", "configs", arg + '.json'), mode='r') as fid: - data = json.load(fid) - for item in data: - locals()[item] = data[item] +if len(sys.argv) <= 1: + with open(os.path.join(r".", 'run_config.json'), mode='r') as fid: + data = json.load(fid) + +else: + ## CHECK FOR CONFIG FILE AND WRITE TO ANY VARIABLES IN FILE. + opts, args = getopt.getopt(sys.argv[1:], "", ["config="]) + for opt, arg in opts: + if opt in ('--config'): + with open(os.path.join(r"..", "configs", arg + '.json'), mode='r') as fid: + data = json.load(fid) + +for item in data: + locals()[item] = data[item] # Really rough setup. Check for ENGINE, set it not present from configuration. @@ -152,15 +158,6 @@ teensy_holder_width = 7 + teensy_pcb_thickness teensy_holder_height = 6 + teensy_width - -# wire_post_height = 7 -# wire_post_overhang = 3.5 -# wire_post_diameter = 2.6 -# -# screw_insert_height = 3.8 -# screw_insert_bottom_radius = 5.31 / 2 -# screw_insert_top_radius = 5.1 / 2 - # save_path = path.join("..", "things", save_dir) if not path.isdir(save_path): os.mkdir(save_path) @@ -2605,7 +2602,7 @@ def thumb_walls(side='right', style_override=None): elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): - if _thumb_style == "TRACKBALL_ORBYL" : + if _thumb_style == "TRACKBALL_ORBYL": return tbjs_thumb_walls() elif thumb_style == "TRACKBALL_CJ": return tbcj_thumb_walls() -- cgit v1.2.3 From f94209c3a0c065eb3af5ff0a75f8ffc6dbd0223f Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Sun, 22 Aug 2021 11:35:37 -0400 Subject: Fixed docker directories in batch file. Added note for when run_config is used vs. configuration argument. --- src/dactyl_manuform.py | 1 + 1 file changed, 1 insertion(+) (limited to 'src/dactyl_manuform.py') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 8156ca6..a04a291 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -25,6 +25,7 @@ for item in cfg.shape_config: locals()[item] = cfg.shape_config[item] if len(sys.argv) <= 1: + print("NO CONFIGURATION SPECIFIED, USING run_config.json") with open(os.path.join(r".", 'run_config.json'), mode='r') as fid: data = json.load(fid) -- cgit v1.2.3