diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dactyl_manuform.py | 1129 | ||||
-rw-r--r-- | src/generate_configuration.py | 137 | ||||
-rw-r--r-- | src/helpers_blender.py | 3 | ||||
-rw-r--r-- | src/helpers_cadquery.py | 31 | ||||
-rw-r--r-- | src/helpers_solid.py | 31 | ||||
-rw-r--r-- | src/parts/trackball_sensor_mount.stl | bin | 307684 -> 307684 bytes | |||
-rw-r--r-- | src/run_config.json | 215 |
7 files changed, 976 insertions, 570 deletions
diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index a04a291..7af6073 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -4,6 +4,7 @@ import os.path as path import getopt, sys import json import os +import copy from scipy.spatial import ConvexHull as sphull @@ -272,31 +273,48 @@ def single_plate(cylinder_segments=100, side="right"): return plate +def plate_pcb_cutout(side="right"): + shape = box(*plate_pcb_size) + shape = translate(shape, (0, 0, -plate_pcb_size[2]/2)) + shape = translate(shape, plate_pcb_offset) + + if side == "left": + shape = mirror(shape, 'YZ') + + return shape + def trackball_cutout(segments=100, side="right"): - shape = cylinder(trackball_hole_diameter / 2, trackball_hole_height) + if trackball_modular: + hole_diameter = ball_diameter + 2 * (ball_gap + ball_wall_thickness + trackball_modular_clearance+trackball_modular_lip_width)-.1 + shape = cylinder(hole_diameter / 2, trackball_hole_height) + else: + shape = cylinder(trackball_hole_diameter / 2, trackball_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]) + if trackball_modular: + hole_diameter = ball_diameter + 2 * (ball_gap + ball_wall_thickness + trackball_modular_clearance) + ring_diameter = hole_diameter + 2 * trackball_modular_lip_width + ring_height = trackball_modular_ring_height + ring_z_offset = mount_thickness - trackball_modular_ball_height + shape = cylinder(ring_diameter / 2, ring_height) + shape = translate(shape, (0, 0, -ring_height / 2 + ring_z_offset)) - 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") + cutter = cylinder(hole_diameter / 2, ring_height + .2) + cutter = translate(cutter, (0, 0, -ring_height / 2 + ring_z_offset)) + sensor = None - # shape = import_file(tb_file) - # # shape = difference(shape, [import_file(senscut_file)]) - # # shape = union([shape, import_file(sens_file)]) - # cutter = import_file(tbcut_file) + else: + 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) - sensor = import_file(sens_file) - cutter = import_file(tbcut_file) - cutter = union([cutter, import_file(senscut_file)]) + shape = import_file(tb_file) + sensor = import_file(sens_file) + cutter = import_file(tbcut_file) + cutter = union([cutter, import_file(senscut_file)]) # return shape, cutter return shape, cutter, sensor @@ -496,6 +514,19 @@ def key_holes(side="right"): return shape +def plate_pcb_cutouts(side="right"): + debugprint('plate_pcb_cutouts()') + # hole = single_plate() + cutouts = [] + for column in range(ncols): + for row in range(nrows): + if (column in [2, 3]) or (not row == lastrow): + cutouts.append(key_place(plate_pcb_cutout(side=side), column, row)) + + # cutouts = union(cutouts) + + return cutouts + def caps(): caps = None @@ -561,7 +592,11 @@ def connectors(): debugprint('connectors()') hulls = [] for column in range(ncols - 1): - for row in range(lastrow): # need to consider last_row? + if (column in [2]): + iterrows = lastrow+1 + else: + iterrows = lastrow + for row in range(iterrows): # need to consider last_row? # for row in range(nrows): # need to consider last_row? places = [] places.append(key_place(web_post_tl(), column + 1, row)) @@ -571,8 +606,11 @@ def connectors(): hulls.append(triangle_hulls(places)) for column in range(ncols): - # for row in range(nrows-1): - for row in range(cornerrow): + if (column in [2, 3]): + iterrows = lastrow + else: + iterrows = cornerrow + for row in range(iterrows): places = [] places.append(key_place(web_post_bl(), column, row)) places.append(key_place(web_post_br(), column, row)) @@ -581,8 +619,11 @@ def connectors(): hulls.append(triangle_hulls(places)) for column in range(ncols - 1): - # for row in range(nrows-1): # need to consider last_row? - for row in range(cornerrow): # need to consider last_row? + if (column in [2]): + iterrows = lastrow + else: + iterrows = cornerrow + for row in range(iterrows): places = [] places.append(key_place(web_post_br(), column, row)) places.append(key_place(web_post_tr(), column, row + 1)) @@ -590,6 +631,22 @@ def connectors(): places.append(key_place(web_post_tl(), column + 1, row + 1)) hulls.append(triangle_hulls(places)) + if column == 1: + places = [] + places.append(key_place(web_post_bl(), column + 1, iterrows)) + places.append(key_place(web_post_br(), column, iterrows)) + places.append(key_place(web_post_tl(), column + 1, iterrows + 1)) + places.append(key_place(web_post_bl(), column + 1, iterrows + 1)) + hulls.append(triangle_hulls(places)) + if column == 3: + places = [] + places.append(key_place(web_post_br(), column, iterrows)) + places.append(key_place(web_post_bl(), column + 1, iterrows)) + places.append(key_place(web_post_tr(), column, iterrows + 1)) + places.append(key_place(web_post_br(), column, iterrows + 1)) + hulls.append(triangle_hulls(places)) + + return union(hulls) @@ -606,7 +663,7 @@ def thumborigin(): origin[i] = origin[i] + thumb_offsets[i] if thumb_style == 'MINIDOX': - origin[1] = origin[1] - .4*(trackball_Usize-1)*sa_length + origin[1] = origin[1] - .4*(minidox_Usize-1)*sa_length return origin @@ -686,6 +743,10 @@ def default_thumb_1x_layout(shape, cap=False): shapes = union(shape_list) return shapes +def default_thumb_pcb_plate_cutouts(side="right"): + shape = default_thumb_1x_layout(plate_pcb_cutout(side=side)) + shape = union([shape, default_thumb_15x_layout(plate_pcb_cutout(side=side))]) + return shape def default_thumb_15x_layout(shape, cap=False, plate=True): debugprint('thumb_15x_layout()') @@ -722,6 +783,9 @@ def default_thumb_15x_layout(shape, cap=False, plate=True): def adjustable_plate_size(Usize=1.5): return (Usize * sa_length - mount_height) / 2 +def usize_dimention(Usize=1.5): + return Usize * sa_length + def adjustable_plate_half(Usize=1.5): debugprint('double_plate()') @@ -737,6 +801,14 @@ def adjustable_plate(Usize=1.5): top_plate = adjustable_plate_half(Usize) return union((top_plate, mirror(top_plate, 'XZ'))) +def adjustable_square_plate(Uwidth=1.5, Uheight=1.5): + width = usize_dimention(Usize=Uwidth) + height = usize_dimention(Usize=Uheight) + print("width: {}, height: {}, thickness:{}".format(width, height, web_thickness)) + shape = box(width, height, web_thickness) + shape = difference(shape, [box(mount_width-.01, mount_height-.01, 2*web_thickness)]) + shape = translate(shape, (0, 0, web_thickness/2)) + return shape def double_plate_half(): debugprint('double_plate()') @@ -830,6 +902,31 @@ def thumb_connectors(side='right', style_override=None): return default_thumb_connectors() +def thumb_pcb_plate_cutouts(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_pcb_plate_cutouts(side) + elif _thumb_style == "MINIDOX": + return minidox_thumb_pcb_plate_cutouts(side) + elif _thumb_style == "CARBONFET": + return carbonfet_thumb_pcb_plate_cutouts(side) + + elif "TRACKBALL" in _thumb_style: + if (side == ball_side or ball_side == 'both'): + if _thumb_style == "TRACKBALL_ORBYL": + return tbjs_thumb_pcb_plate_cutouts(side) + elif _thumb_style == "TRACKBALL_CJ": + return tbcj_thumb_pcb_plate_cutouts(side) + else: + return thumb_pcb_plate_cutouts(side, style_override=other_thumb) + + else: + return default_thumb_pcb_plate_cutouts(side) + def default_thumbcaps(): t1 = default_thumb_1x_layout(sa_cap(1), cap=True) if not default_1U_cluster: @@ -842,6 +939,7 @@ def default_thumb(side="right"): 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)]) + shape = difference(shape, [default_thumb_pcb_plate_cutouts()]) return shape @@ -998,19 +1096,12 @@ def default_thumb_connectors(): key_place(web_post_bl(), 1, cornerrow), 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), default_thumb_tr_place(web_post_tr()), key_place(web_post_bl(), 2, lastrow), 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), - 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), ] ) ) @@ -1032,41 +1123,10 @@ def default_thumb_connectors(): key_place(web_post_bl(), 2, lastrow), 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), - 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) ############################ @@ -1134,6 +1194,11 @@ def mini_thumb(side="right"): return shape +def mini_thumb_pcb_plate_cutouts(side="right"): + shape = mini_thumb_1x_layout(plate_pcb_cutout(side=side)) + shape = union([shape, mini_thumb_15x_layout(plate_pcb_cutout(side=side))]) + return shape + def mini_thumb_post_tr(): return translate(web_post(), @@ -1242,49 +1307,13 @@ def mini_thumb_connectors(): key_place(web_post_bl(), 1, cornerrow), mini_thumb_tr_place(mini_thumb_post_tr()), key_place(web_post_br(), 1, cornerrow), - key_place(web_post_tl(), 2, lastrow), + # key_place(web_post_tl(), 2, lastrow), key_place(web_post_bl(), 2, lastrow), mini_thumb_tr_place(mini_thumb_post_tr()), key_place(web_post_bl(), 2, lastrow), mini_thumb_tr_place(mini_thumb_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), - ] - ) - ) - hulls.append( - triangle_hulls( - [ - key_place(web_post_tr(), 3, lastrow), - key_place(web_post_br(), 3, lastrow), - key_place(web_post_bl(), 4, cornerrow), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ - 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), ] ) ) @@ -1361,9 +1390,11 @@ def minidox_thumb(side="right"): shape = minidox_thumb_fx_layout(rotate(single_plate(side=side), [0.0, 0.0, -90])) shape = union([shape, minidox_thumb_fx_layout(adjustable_plate(minidox_Usize))]) # shape = minidox_thumb_1x_layout(single_plate(side=side)) + return shape - - +def minidox_thumb_pcb_plate_cutouts(side="right"): + shape = minidox_thumb_fx_layout(plate_pcb_cutout(side=side)) + shape = union([shape, minidox_thumb_fx_layout(plate_pcb_cutout())]) return shape def minidox_thumb_post_tr(): @@ -1434,49 +1465,12 @@ def minidox_thumb_connectors(): key_place(web_post_bl(), 1, cornerrow), minidox_thumb_tr_place(minidox_thumb_post_tr()), key_place(web_post_br(), 1, cornerrow), - key_place(web_post_tl(), 2, lastrow), key_place(web_post_bl(), 2, lastrow), minidox_thumb_tr_place(minidox_thumb_post_tr()), key_place(web_post_bl(), 2, lastrow), minidox_thumb_tr_place(minidox_thumb_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), - ] - ) - ) - hulls.append( - triangle_hulls( - [ - key_place(web_post_tr(), 3, lastrow), - key_place(web_post_br(), 3, lastrow), - key_place(web_post_bl(), 4, cornerrow), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ - 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), ] ) ) @@ -1561,6 +1555,11 @@ def carbonfet_thumb(side="right"): return shape +def carbonfet_thumb_pcb_plate_cutouts(side="right"): + shape = carbonfet_thumb_1x_layout(plate_pcb_cutout(side=side)) + shape = union([shape, carbonfet_thumb_15x_layout(plate_pcb_cutout())]) + return shape + def carbonfet_thumb_post_tr(): return translate(web_post(), [(mount_width / 2) - post_adj, (mount_height / 1.15) - post_adj, 0] @@ -1674,7 +1673,6 @@ def carbonfet_thumb_connectors(): key_place(web_post_bl(), 1, cornerrow), carbonfet_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), carbonfet_thumb_tl_place(web_post_tr()), key_place(web_post_bl(), 2, lastrow), @@ -1690,28 +1688,6 @@ def carbonfet_thumb_connectors(): hulls.append( triangle_hulls( [ - key_place(web_post_tr(), 3, lastrow), - key_place(web_post_br(), 3, cornerrow), - key_place(web_post_tl(), 3, lastrow), - key_place(web_post_bl(), 3, cornerrow), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ - key_place(web_post_tr(), 2, lastrow), - key_place(web_post_br(), 2, lastrow), - key_place(web_post_tl(), 3, lastrow), - key_place(web_post_bl(), 3, lastrow), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ carbonfet_thumb_tr_place(web_post_br()), carbonfet_thumb_tr_place(web_post_tr()), key_place(web_post_bl(), 3, lastrow), @@ -1719,40 +1695,6 @@ def carbonfet_thumb_connectors(): ) ) - 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_tl(), 3, lastrow), - 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_bl(), 4, cornerrow), - ] - ) - ) - - hulls.append( - triangle_hulls( - [ - key_place(web_post_tr(), 3, lastrow), - key_place(web_post_br(), 3, cornerrow), - key_place(web_post_bl(), 4, cornerrow), - ] - ) - ) - return union(hulls) @@ -1764,7 +1706,7 @@ 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] + shift = [-.9*tbjs_key_diameter/2+27-42, -.1*tbjs_key_diameter/2+3-25, -5] for i in range(len(pos)): pos[i] = pos[i] + shift[i] + tbjs_translation_offset[i] @@ -1790,9 +1732,7 @@ def tbjs_thumb_tl_place(shape): shape = translate(shape, (t_off[0], t_off[1]+tbjs_key_diameter/2, t_off[2])) shape = rotate(shape, [0,0,-80]) shape = tbjs_place(shape) - # shape = rotate(shape, [5, 10, -65]) - # shape = translate(shape, thumborigin()) - # shape = translate(shape, [-14, -9, 0]) + return shape def tbjs_thumb_mr_place(shape): @@ -1804,9 +1744,6 @@ def tbjs_thumb_mr_place(shape): shape = rotate(shape, [0,0,-130]) shape = tbjs_place(shape) - # shape = rotate(shape, [7, 20, -105]) - # shape = translate(shape, thumborigin()) - # shape = translate(shape, [-12, -32, -5]) return shape def tbjs_thumb_br_place(shape): @@ -1819,9 +1756,6 @@ def tbjs_thumb_br_place(shape): shape = rotate(shape, [0,0,-180]) shape = tbjs_place(shape) - # shape = rotate(shape, [25, -11, 0]) - # shape = translate(shape, thumborigin()) - # shape = translate(shape, [-40, -50, -16]) return shape @@ -1834,67 +1768,47 @@ def tbjs_thumb_bl_place(shape): shape = rotate(shape, [0,0,-230]) shape = tbjs_place(shape) - # shape = rotate(shape, [25, 0, -45]) - # shape = translate(shape, thumborigin()) - # shape = translate(shape, [-63, -41, -18]) return shape -# def tbjs_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 tbjs_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 tbjs_thumb_1x_layout(shape): return union([ 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 tbjs_thumb_pcb_plate_cutouts(side="right"): + return tbjs_thumb_1x_layout(plate_pcb_cutout(side=side)) + def tbjs_thumb_fx_layout(shape): - return union([ - # 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])), - ]) + return [ + tbjs_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tr_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([ - # Relocating positioning to individual parts due to complexity. - # tbjs_place(rotate(shape, [0, 0, trackball_rotation])), tbjs_place(shape), ]) def tbjs_thumbcaps(): t1 = tbjs_thumb_1x_layout(sa_cap(1)) + # t1 = tbjs_thumb_fx_layout(sa_cap(1)) # t1.add(tbjs_thumb_15x_layout(rotate(sa_cap(1), [0, 0, rad2deg(pi / 2)]))) return t1 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 = tbjs_thumb_fx_layout(rotate(single_plate(side=side), [0.0, 0.0, -90])) + shape = tbjs_thumb_1x_layout(single_plate(side=side)) + # shape = tbjs_thumb_fx_layout(adjustable_square_plate(Uwidth=tbjs_Uwidth, Uheight=tbjs_Uheight)) + shape = union([shape, *tbjs_thumb_fx_layout(adjustable_square_plate(Uwidth=tbjs_Uwidth, Uheight=tbjs_Uheight))]) # shape = union([shape, trackball_layout(trackball_socket())]) # shape = tbjs_thumb_1x_layout(single_plate(side=side)) @@ -1904,28 +1818,28 @@ def tbjs_thumb(side="right"): 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] + [(mount_width / 2) + adjustable_plate_size(tbjs_Uwidth) - post_adj, ((mount_height/2) + adjustable_plate_size(tbjs_Uheight)) - post_adj, 0] ) 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] + [-(mount_width / 2) - adjustable_plate_size(tbjs_Uwidth) + post_adj, ((mount_height/2) + adjustable_plate_size(tbjs_Uheight)) - post_adj, 0] ) 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] + [-(mount_width / 2) - adjustable_plate_size(tbjs_Uwidth) + post_adj, -((mount_height/2) + adjustable_plate_size(tbjs_Uheight)) + post_adj, 0] ) 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] + [(mount_width / 2) + adjustable_plate_size(tbjs_Uwidth) - post_adj, - ((mount_height/2) + adjustable_plate_size(tbjs_Uheight)) + post_adj, 0] ) @@ -1986,21 +1900,21 @@ def tbjs_thumb_connectors(): triangle_hulls( [ tbjs_place(tbjs_post_l()), - tbjs_thumb_bl_place(web_post_tl()), + tbjs_thumb_bl_place(tbjs_thumb_post_tl()), tbjs_place(tbjs_post_bl()), - tbjs_thumb_bl_place(web_post_tr()), - tbjs_thumb_br_place(web_post_tl()), + tbjs_thumb_bl_place(tbjs_thumb_post_tr()), + tbjs_thumb_br_place(tbjs_thumb_post_tl()), tbjs_place(tbjs_post_bl()), - tbjs_thumb_br_place(web_post_tr()), + tbjs_thumb_br_place(tbjs_thumb_post_tr()), tbjs_place(tbjs_post_br()), - tbjs_thumb_br_place(web_post_tr()), + tbjs_thumb_br_place(tbjs_thumb_post_tr()), tbjs_place(tbjs_post_br()), - tbjs_thumb_mr_place(web_post_br()), + tbjs_thumb_mr_place(tbjs_thumb_post_br()), tbjs_place(tbjs_post_r()), - tbjs_thumb_mr_place(web_post_bl()), - tbjs_thumb_tl_place(web_post_br()), + tbjs_thumb_mr_place(tbjs_thumb_post_bl()), + tbjs_thumb_tl_place(tbjs_thumb_post_br()), tbjs_place(tbjs_post_r()), - tbjs_thumb_tl_place(web_post_bl()), + tbjs_thumb_tl_place(tbjs_thumb_post_bl()), tbjs_place(tbjs_post_tr()), key_place(web_post_bl(), 0, cornerrow), tbjs_place(tbjs_post_tl()), @@ -2012,10 +1926,10 @@ def tbjs_thumb_connectors(): hulls.append( triangle_hulls( [ - 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()), + tbjs_thumb_bl_place(tbjs_thumb_post_tr()), + tbjs_thumb_br_place(tbjs_thumb_post_tl()), + tbjs_thumb_bl_place(tbjs_thumb_post_br()), + tbjs_thumb_br_place(tbjs_thumb_post_bl()), ] ) ) @@ -2024,10 +1938,10 @@ def tbjs_thumb_connectors(): hulls.append( triangle_hulls( [ - 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()), + tbjs_thumb_br_place(tbjs_thumb_post_tr()), + tbjs_thumb_mr_place(tbjs_thumb_post_br()), + tbjs_thumb_br_place(tbjs_thumb_post_br()), + tbjs_thumb_mr_place(tbjs_thumb_post_tr()), ] ) ) @@ -2035,34 +1949,10 @@ def tbjs_thumb_connectors(): hulls.append( triangle_hulls( [ - 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()), - ] - ) - ) - - 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), + tbjs_thumb_mr_place(tbjs_thumb_post_bl()), + tbjs_thumb_tl_place(tbjs_thumb_post_br()), + tbjs_thumb_mr_place(tbjs_thumb_post_tl()), + tbjs_thumb_tl_place(tbjs_thumb_post_tr()), ] ) ) @@ -2164,18 +2054,15 @@ def tbcj_holder(): 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) + 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)) + shape = rotate(shape, (0, 0, 0)) return shape def tbcj_thumb(side="right"): @@ -2183,6 +2070,10 @@ def tbcj_thumb(side="right"): tb = tbcj_place(tbcj_holder()) return union([t, tb]) +def tbcj_thumb_pcb_plate_cutouts(side="right"): + t = tbcj_thumb_layout(plate_pcb_cutout(side=side)) + return t + def tbcj_thumbcaps(): t = tbcj_thumb_layout(sa_cap(1)) return t @@ -2266,43 +2157,12 @@ def tbcj_thumb_connectors(): 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), ] ) ) @@ -2370,27 +2230,31 @@ def left_key_position(row, direction, low_corner=False, side='right'): if trackball_in_wall and (side == ball_side or ball_side == 'both'): if low_corner: + x_offset = tbiw_left_wall_lower_x_offset y_offset = tbiw_left_wall_lower_y_offset z_offset = tbiw_left_wall_lower_z_offset else: + x_offset = 0.0 y_offset = 0.0 z_offset = 0.0 return list(pos - np.array([ - tbiw_left_wall_x_offset_override, + tbiw_left_wall_x_offset_override - x_offset, -y_offset, tbiw_left_wall_z_offset_override + z_offset ])) if low_corner: + x_offset = left_wall_lower_x_offset y_offset = left_wall_lower_y_offset z_offset = left_wall_lower_z_offset else: + x_offset = 0.0 y_offset = 0.0 z_offset = 0.0 - return list(pos - np.array([left_wall_x_offset, -y_offset, left_wall_z_offset + z_offset])) + return list(pos - np.array([left_wall_x_offset - x_offset, -y_offset, left_wall_z_offset + z_offset])) def left_key_place(shape, row, direction, low_corner=False, side='right'): @@ -2423,40 +2287,45 @@ def wall_locate3(dx, dy, back=False): dy * (wall_y_offset + wall_base_y_thickness), -wall_z_offset, ] - # return [ - # dx * (wall_xy_offset + wall_thickness), - # dy * (wall_xy_offset + wall_thickness), - # -wall_z_offset, - # ] -def wall_brace(place1, dx1, dy1, post1, place2, dx2, dy2, post2, back=False): +def wall_brace(place1, dx1, dy1, post1, place2, dx2, dy2, post2, back=False, skeleton=False, skel_bottom=False): debugprint("wall_brace()") hulls = [] hulls.append(place1(post1)) - hulls.append(place1(translate(post1, wall_locate1(dx1, dy1)))) - hulls.append(place1(translate(post1, wall_locate2(dx1, dy1)))) - hulls.append(place1(translate(post1, wall_locate3(dx1, dy1, back)))) + if not skeleton: + hulls.append(place1(translate(post1, wall_locate1(dx1, dy1)))) + hulls.append(place1(translate(post1, wall_locate2(dx1, dy1)))) + if not skeleton or skel_bottom: + hulls.append(place1(translate(post1, wall_locate3(dx1, dy1, back)))) hulls.append(place2(post2)) - hulls.append(place2(translate(post2, wall_locate1(dx2, dy2)))) - hulls.append(place2(translate(post2, wall_locate2(dx2, dy2)))) - hulls.append(place2(translate(post2, wall_locate3(dx2, dy2, back)))) + if not skeleton: + hulls.append(place2(translate(post2, wall_locate1(dx2, dy2)))) + hulls.append(place2(translate(post2, wall_locate2(dx2, dy2)))) + + if not skeleton or skel_bottom: + hulls.append(place2(translate(post2, wall_locate3(dx2, dy2, back)))) + shape1 = hull_from_shapes(hulls) hulls = [] - hulls.append(place1(translate(post1, wall_locate2(dx1, dy1)))) - hulls.append(place1(translate(post1, wall_locate3(dx1, dy1, back)))) - hulls.append(place2(translate(post2, wall_locate2(dx2, dy2)))) - hulls.append(place2(translate(post2, wall_locate3(dx2, dy2, back)))) - shape2 = bottom_hull(hulls) + if not skeleton: + hulls.append(place1(translate(post1, wall_locate2(dx1, dy1)))) + hulls.append(place2(translate(post2, wall_locate2(dx2, dy2)))) + if not skeleton or skel_bottom: + hulls.append(place1(translate(post1, wall_locate3(dx1, dy1, back)))) + hulls.append(place2(translate(post2, wall_locate3(dx2, dy2, back)))) - return union([shape1, shape2]) - # return shape1 + if len(hulls)>0: + shape2 = bottom_hull(hulls) + shape1 = union([shape1, shape2]) + return shape1 -def key_wall_brace(x1, y1, dx1, dy1, post1, x2, y2, dx2, dy2, post2, back=False): + +def key_wall_brace(x1, y1, dx1, dy1, post1, x2, y2, dx2, dy2, post2, back=False, skeleton=False, skel_bottom=False): debugprint("key_wall_brace()") return wall_brace( (lambda shape: key_place(shape, x1, y1)), @@ -2467,54 +2336,80 @@ def key_wall_brace(x1, y1, dx1, dy1, post1, x2, y2, dx2, dy2, post2, back=False) dx2, dy2, post2, - back + back, + skeleton=skeleton, + skel_bottom=False, ) -def back_wall(): +def back_wall(skeleton=False): print("back_wall()") x = 0 - shape = union([key_wall_brace(x, 0, 0, 1, web_post_tl(), x, 0, 0, 1, web_post_tr(), back=True)]) + shape = None + shape = union([shape, key_wall_brace( + x, 0, 0, 1, web_post_tl(), x, 0, 0, 1, web_post_tr(), back=True, + )]) for i in range(ncols - 1): x = i + 1 - shape = union([shape, key_wall_brace(x, 0, 0, 1, web_post_tl(), x, 0, 0, 1, web_post_tr(), back=True)]) shape = union([shape, key_wall_brace( - x, 0, 0, 1, web_post_tl(), x - 1, 0, 0, 1, web_post_tr(), back=True + x, 0, 0, 1, web_post_tl(), x, 0, 0, 1, web_post_tr(), back=True, + )]) + + skelly = skeleton and not x==1 + shape = union([shape, key_wall_brace( + x, 0, 0, 1, web_post_tl(), x - 1, 0, 0, 1, web_post_tr(), back=True, + skeleton=skelly, skel_bottom=True, )]) + shape = union([shape, key_wall_brace( - lastcol, 0, 0, 1, web_post_tr(), lastcol, 0, 1, 0, web_post_tr(), back=True + lastcol, 0, 0, 1, web_post_tr(), lastcol, 0, 1, 0, web_post_tr(), back=True, + skeleton=skeleton, skel_bottom=True, )]) + if not skeleton: + shape = union([shape, + key_wall_brace( + lastcol, 0, 0, 1, web_post_tr(), lastcol, 0, 1, 0, web_post_tr() + ) + ]) return shape -def right_wall(): +def right_wall(skeleton=False): print("right_wall()") y = 0 - shape = union([ - key_wall_brace( - lastcol, y, 1, 0, web_post_tr(), lastcol, y, 1, 0, web_post_br() - ) - ]) + + shape = None + + shape = union([shape,key_wall_brace( + lastcol, y, 1, 0, web_post_tr(), lastcol, y, 1, 0, web_post_br(), + skeleton=skeleton, + )]) for i in range(lastrow - 1): y = i + 1 shape = union([shape, key_wall_brace( - lastcol, y - 1, 1, 0, web_post_br(), lastcol, y, 1, 0, web_post_tr() + lastcol, y - 1, 1, 0, web_post_br(), lastcol, y, 1, 0, web_post_tr(), + skeleton=skeleton, )]) shape = union([shape, key_wall_brace( - lastcol, y, 1, 0, web_post_tr(), lastcol, y, 1, 0, web_post_br() + lastcol, y, 1, 0, web_post_tr(), lastcol, y, 1, 0, web_post_br(), + skeleton=skeleton, )]) #STRANGE PARTIAL OFFSET shape = union([ shape, - key_wall_brace(lastcol, cornerrow, 0, -1, web_post_br(), lastcol, cornerrow, 1, 0, web_post_br()) + key_wall_brace( + lastcol, cornerrow, 0, -1, web_post_br(), lastcol, cornerrow, 1, 0, web_post_br(), + skeleton=skeleton + ), ]) + return shape -def left_wall(side='right'): +def left_wall(side='right', skeleton=False): print('left_wall()') shape = union([wall_brace( (lambda sh: key_place(sh, 0, 0)), 0, 1, web_post_tl(), @@ -2524,6 +2419,7 @@ def left_wall(side='right'): shape = union([shape, wall_brace( (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(), + skeleton=skeleton, )]) for i in range(lastrow): @@ -2532,14 +2428,17 @@ def left_wall(side='right'): 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(), + skeleton=skeleton and (y < (lastrow-1)), ) + shape = union([shape, temp_shape1]) + 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]) for i in range(lastrow - 1): @@ -2548,26 +2447,26 @@ def left_wall(side='right'): temp_shape1 = wall_brace( (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(), + skeleton=skeleton and (y < (lastrow - 1)), ) + shape = union([shape, temp_shape1]) + 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, side=side), left_key_place(web_post(), y - 1, -1, side=side), )) - shape = union([shape, temp_shape1]) + shape = union([shape, temp_shape2]) return shape -def front_wall(): +def front_wall(skeleton=False): print('front_wall()') - shape = union([ - key_wall_brace( - lastcol, 0, 0, 1, web_post_tr(), lastcol, 0, 1, 0, web_post_tr() - ) - ]) + shape = None + shape = union([shape,key_wall_brace( 3, lastrow, 0, -1, web_post_bl(), 3, lastrow, 0.5, -1, web_post_br() )]) @@ -2588,57 +2487,57 @@ def front_wall(): return shape -def thumb_walls(side='right', style_override=None): +def thumb_walls(side='right', style_override=None, skeleton=False): if style_override is None: _thumb_style = thumb_style else: _thumb_style = style_override if _thumb_style == "MINI": - return mini_thumb_walls() + return mini_thumb_walls(skeleton=skeleton) elif _thumb_style == "MINIDOX": - return minidox_thumb_walls() + return minidox_thumb_walls(skeleton=skeleton) elif _thumb_style == "CARBONFET": - return carbonfet_thumb_walls() + return carbonfet_thumb_walls(skeleton=skeleton) elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): if _thumb_style == "TRACKBALL_ORBYL": - return tbjs_thumb_walls() + return tbjs_thumb_walls(skeleton=skeleton) elif thumb_style == "TRACKBALL_CJ": - return tbcj_thumb_walls() + return tbcj_thumb_walls(skeleton=skeleton) else: - return thumb_walls(side, style_override=other_thumb) + return thumb_walls(side, style_override=other_thumb, skeleton=skeleton) else: - return default_thumb_walls() + return default_thumb_walls(skeleton=skeleton) -def thumb_connection(side='right', style_override=None): +def thumb_connection(side='right', style_override=None, skeleton=False): if style_override is None: _thumb_style = thumb_style else: _thumb_style = style_override if _thumb_style == "MINI": - return mini_thumb_connection(side=side) + return mini_thumb_connection(side=side, skeleton=skeleton) elif _thumb_style == "MINIDOX": - return minidox_thumb_connection(side=side) + return minidox_thumb_connection(side=side, skeleton=skeleton) elif _thumb_style == "CARBONFET": - return carbonfet_thumb_connection(side=side) + return carbonfet_thumb_connection(side=side, skeleton=skeleton) elif "TRACKBALL" in _thumb_style: if (side == ball_side or ball_side == 'both'): if _thumb_style == "TRACKBALL_ORBYL": - return tbjs_thumb_connection(side=side) + return tbjs_thumb_connection(side=side, skeleton=skeleton) elif thumb_style == "TRACKBALL_CJ": - return tbcj_thumb_connection(side=side) + return tbcj_thumb_connection(side=side, skeleton=skeleton) else: - return thumb_connection(side, style_override=other_thumb) + return thumb_connection(side, style_override=other_thumb, skeleton=skeleton) else: - return default_thumb_connection(side=side) + return default_thumb_connection(side=side, skeleton=skeleton) -def default_thumb_walls(): +def default_thumb_walls(skeleton=False): print('thumb_walls()') # thumb, walls if default_1U_cluster: @@ -2666,10 +2565,11 @@ def default_thumb_walls(): return shape -def default_thumb_connection(side='right'): +def default_thumb_connection(side='right', skeleton=False): print('thumb_connection()') # clunky bit on the top left thumb connection (normal connectors don't work well) - shape = union([bottom_hull( + shape = None + shape = union([shape, 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), @@ -2721,7 +2621,7 @@ def default_thumb_connection(side='right'): return shape -def tbjs_thumb_connection(side='right'): +def tbjs_thumb_connection(side='right', skeleton=False): print('thumb_connection()') # clunky bit on the top left thumb connection (normal connectors don't work well) hulls = [] @@ -2729,7 +2629,8 @@ def tbjs_thumb_connection(side='right'): 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), + 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()), ] ) @@ -2739,31 +2640,23 @@ def tbjs_thumb_connection(side='right'): triangle_hulls( [ key_place(web_post_bl(), 0, cornerrow), - tbjs_thumb_tl_place(web_post_bl()), + tbjs_thumb_tl_place(tbjs_thumb_post_bl()), key_place(web_post_br(), 0, cornerrow), - tbjs_thumb_tl_place(web_post_tl()), + tbjs_thumb_tl_place(tbjs_thumb_post_tl()), key_place(web_post_bl(), 1, cornerrow), - tbjs_thumb_tl_place(web_post_tl()), + tbjs_thumb_tl_place(tbjs_thumb_post_tl()), key_place(web_post_br(), 1, cornerrow), - tbjs_thumb_tl_place(web_post_tr()), - key_place(web_post_tl(), 2, lastrow), + tbjs_thumb_tl_place(tbjs_thumb_post_tr()), key_place(web_post_bl(), 2, lastrow), - tbjs_thumb_tl_place(web_post_tr()), + tbjs_thumb_tl_place(tbjs_thumb_post_tr()), key_place(web_post_bl(), 2, lastrow), - tbjs_thumb_mr_place(web_post_tl()), + tbjs_thumb_mr_place(tbjs_thumb_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()), + tbjs_thumb_mr_place(tbjs_thumb_post_tr()), + tbjs_thumb_mr_place(tbjs_thumb_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), ] ) ) @@ -2771,28 +2664,28 @@ def tbjs_thumb_connection(side='right'): return shape -def tbjs_thumb_walls(): +def tbjs_thumb_walls(skeleton=False): print('thumb_walls()') # thumb, walls shape = wall_brace( - tbjs_thumb_mr_place, .5, 1, web_post_tr(), + tbjs_thumb_mr_place, .5, 1, tbjs_thumb_post_tr(), (lambda sh: key_place(sh, 3, lastrow)), 0, -1, web_post_bl(), ) shape = union([shape, wall_brace( - tbjs_thumb_mr_place, .5, 1, web_post_tr(), - tbjs_thumb_br_place, 0, -1, web_post_br(), + tbjs_thumb_mr_place, .5, 1, tbjs_thumb_post_tr(), + tbjs_thumb_br_place, 0, -1, tbjs_thumb_post_br(), )]) shape = union([shape, wall_brace( - tbjs_thumb_br_place, 0, -1, web_post_br(), - tbjs_thumb_br_place, 0, -1, web_post_bl(), + tbjs_thumb_br_place, 0, -1, tbjs_thumb_post_br(), + tbjs_thumb_br_place, 0, -1, tbjs_thumb_post_bl(), )]) shape = union([shape, wall_brace( - tbjs_thumb_br_place, 0, -1, web_post_bl(), - tbjs_thumb_bl_place, 0, -1, web_post_br(), + tbjs_thumb_br_place, 0, -1, tbjs_thumb_post_bl(), + tbjs_thumb_bl_place, 0, -1, tbjs_thumb_post_br(), )]) shape = union([shape, wall_brace( - tbjs_thumb_bl_place, 0, -1, web_post_br(), - tbjs_thumb_bl_place, -1, -1, web_post_bl(), + tbjs_thumb_bl_place, 0, -1, tbjs_thumb_post_br(), + tbjs_thumb_bl_place, -1, -1, tbjs_thumb_post_bl(), )]) shape = union([shape, wall_brace( @@ -2805,17 +2698,17 @@ def tbjs_thumb_walls(): )]) shape = union([shape, wall_brace( tbjs_place, -1, 0, tbjs_post_l(), - tbjs_thumb_bl_place, -1, 0, web_post_tl(), + tbjs_thumb_bl_place, -1, 0, tbjs_thumb_post_tl(), )]) shape = union([shape, wall_brace( - tbjs_thumb_bl_place, -1, 0, web_post_tl(), - tbjs_thumb_bl_place, -1, -1, web_post_bl(), + tbjs_thumb_bl_place, -1, 0, tbjs_thumb_post_tl(), + tbjs_thumb_bl_place, -1, -1, tbjs_thumb_post_bl(), )]) return shape -def tbcj_thumb_connection(side='right'): +def tbcj_thumb_connection(side='right', skeleton=False): # clunky bit on the top left thumb connection (normal connectors don't work well) shape = union([bottom_hull( [ @@ -2868,7 +2761,7 @@ def tbcj_thumb_connection(side='right'): return shape -def tbcj_thumb_walls(): +def tbcj_thumb_walls(skeleton=False): 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())]) @@ -2895,7 +2788,7 @@ def tbcj_thumb_walls(): return shape -def mini_thumb_walls(): +def mini_thumb_walls(skeleton=False): # 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())]) shape = union([shape, wall_brace(mini_thumb_mr_place, 0, -1, web_post_br(), mini_thumb_mr_place, 0, -1, web_post_bl())]) @@ -2913,7 +2806,7 @@ def mini_thumb_walls(): return shape -def mini_thumb_connection(side='right'): +def mini_thumb_connection(side='right', skeleton=False): # clunky bit on the top left thumb connection (normal connectors don't work well) shape = union([bottom_hull( [ @@ -2969,7 +2862,7 @@ def mini_thumb_connection(side='right'): return shape -def minidox_thumb_walls(): +def minidox_thumb_walls(skeleton=False): # thumb, walls shape = union([wall_brace(minidox_thumb_tr_place, 0, -1, minidox_thumb_post_br(), minidox_thumb_tr_place, 0, -1, minidox_thumb_post_bl())]) @@ -2988,7 +2881,7 @@ def minidox_thumb_walls(): return shape -def minidox_thumb_connection(side='right'): +def minidox_thumb_connection(side='right', skeleton=False): # clunky bit on the top left thumb connection (normal connectors don't work well) shape = union([bottom_hull( [ @@ -3027,7 +2920,6 @@ def minidox_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), - # key_place(translate(web_post_bl(), wall_locate1(-1, 0)), cornerrow, -1, low_corner=True), minidox_thumb_tl_place(minidox_thumb_post_tl()), ] )]) @@ -3047,7 +2939,7 @@ def minidox_thumb_connection(side='right'): -def carbonfet_thumb_walls(): +def carbonfet_thumb_walls(skeleton=False): # thumb, walls shape = union([wall_brace(carbonfet_thumb_mr_place, 0, -1, web_post_br(), carbonfet_thumb_tr_place, 0, -1, web_post_br())]) shape = union([shape, wall_brace(carbonfet_thumb_mr_place, 0, -1, web_post_br(), carbonfet_thumb_mr_place, 0, -1.15, web_post_bl())]) @@ -3064,7 +2956,7 @@ 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(side='right'): +def carbonfet_thumb_connection(side='right', skeleton=False): # clunky bit on the top left thumb connection (normal connectors don't work well) shape = bottom_hull( [ @@ -3120,16 +3012,16 @@ def carbonfet_thumb_connection(side='right'): return shape -def case_walls(side='right'): +def case_walls(side='right', skeleton=False): print('case_walls()') return ( union([ - back_wall(), - left_wall(side=side), - right_wall(), - front_wall(), - thumb_walls(side=side), - thumb_connection(side=side), + back_wall(skeleton=skeleton), + left_wall(side=side, skeleton=skeleton), + right_wall(skeleton=skeleton), + front_wall(skeleton=skeleton), + # thumb_walls(side=side), + # thumb_connection(side=side), ]) ) @@ -3233,8 +3125,129 @@ def external_mount_hole(): ) return shape -def generate_trackball(pos, rot): + +pcb_mount_ref_position = key_position( + #TRRS POSITION IS REFERENCE BY CONVENIENCE + list(np.array(wall_locate3(0, 1)) + np.array([0, (mount_height / 2), 0])), 0, 0 +) + +pcb_mount_ref_position[0] = pcb_mount_ref_position[0] + pcb_mount_ref_offset[0] +pcb_mount_ref_position[1] = pcb_mount_ref_position[1] + pcb_mount_ref_offset[1] +pcb_mount_ref_position[2] = 0.0 + pcb_mount_ref_offset[2] + +def pcb_usb_hole(): + debugprint('pcb_holder()') + pcb_usb_position = copy.deepcopy(pcb_mount_ref_position) + pcb_usb_position[0] = pcb_usb_position[0] + pcb_usb_hole_offset[0] + pcb_usb_position[1] = pcb_usb_position[1] + pcb_usb_hole_offset[1] + pcb_usb_position[2] = pcb_usb_position[2] + pcb_usb_hole_offset[2] + + shape = box(*pcb_usb_hole_size) + shape = translate(shape, + ( + pcb_usb_position[0], + pcb_usb_position[1], + pcb_usb_hole_size[2] / 2 + usb_holder_thickness, + ) + ) + return shape + + + +pcb_holder_position = copy.deepcopy(pcb_mount_ref_position) +pcb_holder_position[0] = pcb_holder_position[0] + pcb_holder_offset[0] +pcb_holder_position[1] = pcb_holder_position[1] + pcb_holder_offset[1] +pcb_holder_position[2] = pcb_holder_position[2] + pcb_holder_offset[2] +pcb_holder_thickness = pcb_holder_size[2] + +def pcb_holder(): + debugprint('pcb_holder()') + shape = box(*pcb_holder_size) + shape = translate(shape, + ( + pcb_holder_position[0], + pcb_holder_position[1] - pcb_holder_size[1] / 2, + pcb_holder_thickness / 2, + ) + ) + return shape + + +def wall_thinner(): + debugprint('wall_thinner()') + shape = box(*wall_thinner_size) + shape = translate(shape, + ( + pcb_holder_position[0], + pcb_holder_position[1] - wall_thinner_size[1]/2, + wall_thinner_size[2]/2 + pcb_holder_thickness, + ) + ) + return shape + + + + +def trrs_hole(): + debugprint('trrs_hole()') + trrs_position = copy.deepcopy(pcb_mount_ref_position) + trrs_position[0] = trrs_position[0] + trrs_offset[0] + trrs_position[1] = trrs_position[1] + trrs_offset[1] + trrs_position[2] = trrs_position[2] + trrs_offset[2] + + trrs_hole_size = [3, 20] + + + shape = cylinder(*trrs_hole_size) + shape = rotate(shape, [0, 90, 90]) + shape = translate(shape, + ( + trrs_position[0], + trrs_position[1], + trrs_hole_size[0] + pcb_holder_thickness, + ) + ) + return shape + +pcb_screw_position = copy.deepcopy(pcb_mount_ref_position) +pcb_screw_position[1] = pcb_screw_position[1] + pcb_screw_y_offset + +def pcb_screw_hole(): + debugprint('pcb_screw_hole()') + holes = [] + hole = cylinder(*pcb_screw_hole_size) + hole = translate(hole, pcb_screw_position) + hole = translate(hole, (0, 0, pcb_screw_hole_size[1]/2-.1)) + for offset in pcb_screw_x_offsets: + holes.append(translate(hole, (offset, 0, 0))) + + return holes + + +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 + ) + + 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]) + + oled_mount_rotation_xyz = (rad2deg(angle_x), 0, -rad2deg(angle_z)) + np.array(oled_rotation_offset) + + + + +def generate_trackball(pos, rot): precut = trackball_cutout() precut = rotate(precut, tb_socket_rotation_offset) precut = translate(precut, tb_socket_translation_offset) @@ -3671,9 +3684,7 @@ def teensy_holder(): def screw_insert_shape(bottom_radius, top_radius, height): debugprint('screw_insert_shape()') if bottom_radius == top_radius: - base = translate(cylinder(radius=bottom_radius, height=height), - (0, 0, -height / 2) - ) + base = cylinder(radius=bottom_radius, height=height) else: base = translate(cone(r1=bottom_radius, r2=top_radius, height=height), (0, 0, -height / 2)) @@ -3742,35 +3753,61 @@ def screw_insert(column, row, bottom_radius, top_radius, height, side='right'): return shape -def screw_insert_thumb(bottom_radius, top_radius, height): - if thumb_style == 'MINI': - position = thumborigin() - position = list(np.array(position) + np.array([-29, -51, -16])) - position[2] = 0 +def thumb_screw_insert(bottom_radius, top_radius, height, offset=None, side='right'): + shape = screw_insert_shape(bottom_radius, top_radius, height) + shapes = [] + if offset is None: + offset = 0.0 + + origin = thumborigin() - elif thumb_style == 'MINIDOX': - position = thumborigin() - position = list(np.array(position) + np.array([-37, -32, -16])) - position[1] = position[1] - .4 * (minidox_Usize - 1) * sa_length - position[2] = 0 + if ('TRACKBALL' in thumb_style) and not (side == ball_side or ball_side == 'both'): + _thumb_style = other_thumb + else: + _thumb_style = thumb_style + + if _thumb_style == 'MINI': + if separable_thumb: + xypositions = copy.deepcopy(mini_separable_thumb_screw_xy_locations) + else: + xypositions = copy.deepcopy(mini_thumb_screw_xy_locations) + + elif _thumb_style == 'MINIDOX': + if separable_thumb: + xypositions = copy.deepcopy(minidox_separable_thumb_screw_xy_locations) + else: + xypositions = copy.deepcopy(minidox_thumb_screw_xy_locations) + xypositions[0][1] = xypositions[0][1] - .4 * (minidox_Usize - 1) * sa_length - elif thumb_style == 'CARBONFET': - 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 + elif _thumb_style == 'CARBONFET': + if separable_thumb: + xypositions = copy.deepcopy(carbonfet_separable_thumb_screw_xy_locations) + else: + xypositions = copy.deepcopy(carbonfet_thumb_screw_xy_locations) + + elif _thumb_style == 'TRACKBALL_ORBYL': + if separable_thumb: + xypositions = copy.deepcopy(orbyl_separable_thumb_screw_xy_locations) + else: + xypositions = copy.deepcopy(orbyl_thumb_screw_xy_locations) + + elif _thumb_style == 'TRACKBALL_CJ': + if separable_thumb: + xypositions = copy.deepcopy(tbcj_separable_thumb_screw_xy_locations) + else: + xypositions = copy.deepcopy(tbcj_thumb_screw_xy_locations) else: - position = thumborigin() - position = list(np.array(position) + np.array([-21, -58, 0])) - position[2] = 0 + if separable_thumb: + xypositions = copy.deepcopy(default_separable_thumb_screw_xy_locations) + else: + xypositions = copy.deepcopy(default_thumb_screw_xy_locations) - shape = screw_insert_shape(bottom_radius, top_radius, height) - shape = translate(shape, [position[0], position[1], height / 2]) - return shape + for xyposition in xypositions: + position = list(np.array(origin) + np.array([*xyposition, -origin[2]])) + shapes.append(translate(shape, [position[0], position[1], height / 2 + offset])) + + return shapes def screw_insert_all_shapes(bottom_radius, top_radius, height, offset=0, side='right'): print('screw_insert_all_shapes()') @@ -3781,26 +3818,36 @@ def screw_insert_all_shapes(bottom_radius, top_radius, height, offset=0, side='r 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)), + # translate(screw_insert_thumb(bottom_radius, top_radius, height), (0, 0, offset)), ) return shape +def thumb_screw_insert_holes(side='right'): + return thumb_screw_insert( + screw_insert_bottom_radius, screw_insert_top_radius, screw_insert_height+.02, offset=-.01, side=side + ) - +def thumb_screw_insert_outers(offset=0.0, side='right'): + # screw_insert_bottom_radius + screw_insert_wall + # screw_insert_top_radius + screw_insert_wall + bottom_radius = screw_insert_outer_radius + top_radius = screw_insert_outer_radius + height = screw_insert_height + 1.5 + return thumb_screw_insert(bottom_radius, top_radius, height, offset=offset, side=side) 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, side=side ) -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_outers(offset=0.0, side='right'): + # screw_insert_bottom_radius + screw_insert_wall + # screw_insert_top_radius + screw_insert_wall + bottom_radius = screw_insert_outer_radius + top_radius = screw_insert_outer_radius + height = screw_insert_height + 1.5 + return screw_insert_all_shapes(bottom_radius, top_radius, height, offset=offset, side=side) def screw_insert_screw_holes(side='right'): return screw_insert_all_shapes(1.7, 1.7, 350, side=side) @@ -3856,17 +3903,10 @@ def model_side(side="right"): shape = union([shape, connector_shape]) if debug_exports: export_file(shape=shape, fname=path.join(r"..", "things", r"debug_connector_shape")) - thumb_shape = thumb(side=side) - 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(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")) - walls_shape = case_walls(side=side) + walls_shape = case_walls(side=side, skeleton=skeletal) 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(side=side)]) @@ -3883,7 +3923,14 @@ def model_side(side="right"): if controller_mount_type in ['EXTERNAL']: s2 = difference(s2, [external_mount_hole()]) - if controller_mount_type in ['None']: + if controller_mount_type in ['PCB_MOUNT']: + s2 = difference(s2, [pcb_usb_hole()]) + s2 = difference(s2, [trrs_hole()]) + s2 = union([s2, pcb_holder()]) + s2 = difference(s2, [wall_thinner()]) + s2 = difference(s2, pcb_screw_hole()) + + if controller_mount_type in [None, 'None']: 0 # do nothing, only here to expressly state inaction. s2 = difference(s2, [union(screw_insert_holes(side=side))]) @@ -3907,7 +3954,7 @@ 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'): + if trackball_in_wall and (side == ball_side or ball_side == 'both') and separable_thumb: tbprecut, tb, tbcutout, sensor, ball = generate_trackball_in_wall() shape = difference(shape, [tbprecut]) @@ -3922,46 +3969,116 @@ def model_side(side="right"): if show_caps: shape = add([shape, ball]) - if (trackball_in_wall or ('TRACKBALL' in thumb_style)) and (side == ball_side or ball_side == 'both'): - tbprecut, tb, tbcutout, sensor, ball = generate_trackball_in_cluster() + if plate_pcb_clear: + shape = difference(shape, [plate_pcb_cutouts(side=side)]) - 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]) + main_shape = shape - if show_caps: - shape = add([shape, ball]) + #BUILD THUMB + + thumb_shape = thumb(side=side) + if debug_exports: + export_file(shape=thumb_shape, fname=path.join(r"..", "things", r"debug_thumb_shape")) + thumb_connector_shape = thumb_connectors(side=side) + if debug_exports: + export_file(shape=thumb_connector_shape, fname=path.join(r"..", "things", r"debug_thumb_connector_shape")) + + thumb_wall_shape = thumb_walls(side=side, skeleton=skeletal) + thumb_wall_shape = union([thumb_wall_shape, *thumb_screw_insert_outers(side=side)]) + thumb_connection_shape = thumb_connection(side=side, skeleton=skeletal) + + + if debug_exports: + thumb_test = union([thumb_shape, thumb_connector_shape, thumb_wall_shape, thumb_connection_shape]) + export_file(shape=thumb_test, fname=path.join(r"..", "things", r"debug_thumb_test_{}_shape".format(side))) + + thumb_section = union([thumb_shape, thumb_connector_shape, thumb_wall_shape, thumb_connection_shape]) + thumb_section = difference(thumb_section, [union(thumb_screw_insert_holes(side=side))]) + + has_trackball = False + if ('TRACKBALL' in thumb_style) and (side == ball_side or ball_side == 'both'): + tbprecut, tb, tbcutout, sensor, ball = generate_trackball_in_cluster() + has_trackball = True + thumb_section = difference(thumb_section, [tbprecut]) + thumb_section = union([thumb_section, tb]) + thumb_section = difference(thumb_section, [tbcutout]) + thumb_section = union([thumb_section, sensor]) + + if plate_pcb_clear: + thumb_section = difference(thumb_section, [thumb_pcb_plate_cutouts(side=side)]) block = box(350, 350, 40) block = translate(block, (0, 0, -20)) - shape = difference(shape, [block]) + main_shape = difference(main_shape, [block]) + thumb_section = difference(thumb_section, [block]) + + + + if separable_thumb: + thumb_section = difference(thumb_section, [main_shape]) + if show_caps: + thumb_section = add([thumb_section, thumbcaps(side=side)]) + if has_trackball: + thumb_section = add([thumb_section, ball]) + else: + main_shape = union([main_shape, thumb_section]) + if show_caps: + main_shape = add([main_shape, thumbcaps(side=side)]) + if has_trackball: + main_shape = add([main_shape, ball]) + + if trackball_in_wall and (side == ball_side or ball_side == 'both') and not separable_thumb: + tbprecut, tb, tbcutout, sensor, ball = generate_trackball_in_wall() + + main_shape = difference(main_shape, [tbprecut]) + # export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_1")) + main_shape = union([main_shape, tb]) + # export_file(shape=shape, fname=path.join(save_path, config_name + r"_test_2")) + main_shape = difference(main_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")) + main_shape = union([main_shape, sensor]) + + if show_caps: + main_shape = add([main_shape, ball]) + + + + if show_caps: - shape = add([shape, thumbcaps(side=side)]) - shape = add([shape, caps()]) + main_shape = add([main_shape, caps()]) if side == "left": - shape = mirror(shape, 'YZ') + main_shape = mirror(main_shape, 'YZ') + thumb_section = mirror(thumb_section, 'YZ') - return shape + return main_shape, thumb_section # NEEDS TO BE SPECIAL FOR CADQUERY def baseplate(wedge_angle=None, side='right'): if ENGINE == 'cadquery': # shape = mod_r - shape = union([case_walls(side=side), *screw_insert_outers(side=side)]) + shape = union([ + case_walls(side=side), + *screw_insert_outers(side=side), + thumb_walls(side=side), + *thumb_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]) + tool = thumb_screw_insert(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]) + + + shape = translate(shape, (0, 0, -0.0001)) square = cq.Workplane('XY').rect(1000, 1000) @@ -4024,7 +4141,9 @@ def baseplate(wedge_angle=None, side='right'): shape = union([ case_walls(side=side), - *screw_insert_outers(side=side) + *screw_insert_outers(side=side), + thumb_walls(side=side), + *thumb_screw_insert_outers(side=side), ]) tool = translate(union(screw_insert_screw_holes(side=side)), [0, 0, -10]) @@ -4038,16 +4157,18 @@ def baseplate(wedge_angle=None, side='right'): def run(): - mod_r = model_side(side="right") + mod_r, tmb_r = model_side(side="right") export_file(shape=mod_r, fname=path.join(save_path, config_name + r"_right")) + export_file(shape=tmb_r, fname=path.join(save_path, config_name + r"_thumb_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") + mod_l, tmb_l = model_side(side="left") export_file(shape=mod_l, fname=path.join(save_path, config_name + r"_left")) + export_file(shape=tmb_l, fname=path.join(save_path, config_name + r"_thumb_left")) base_l = mirror(baseplate(side='left'), 'YZ') export_file(shape=base_l, fname=path.join(save_path, config_name + r"_left_plate")) diff --git a/src/generate_configuration.py b/src/generate_configuration.py index f5fa716..b73877b 100644 --- a/src/generate_configuration.py +++ b/src/generate_configuration.py @@ -21,7 +21,7 @@ shape_config = { 'save_dir': '.', 'config_name': "DM", - 'show_caps': True, + 'show_caps': False, 'show_pcbs': False, #only runs if caps are shown, easist place to initially inject geometry 'nrows': 5, #5, # key rows @@ -44,21 +44,53 @@ shape_config = { 11 # controls overall height# original=9 with centercol=3# use 16 for centercol=2 ), + + 'extra_width': 2.5, # extra space between the base of keys# original= 2 + 'extra_height': 1.0, # original= 0.5 + + + 'web_thickness': 4.0 + 1.1, + 'post_size': 0.1, + # post_adj': post_size / 2 + 'post_adj': 0, + ############################## # THUMB PARAMETERS ############################## + # 'DEFAULT' 6-key, 'MINI' 5-key, 'CARBONFET' 6-key, 'MINIDOX' 3-key, 'TRACKBALL_ORBYL', 'TRACKBALL_CJ' 'thumb_style': 'TRACKBALL_ORBYL', 'default_1U_cluster': True, # only used with default, makes top right thumb cluster key 1U # Thumb key size. May need slight oversizing, check w/ caps. Additional spacing will be automatically added for larger keys. 'minidox_Usize': 1.6, # Thumb plate rotations, anything other than 90 degree increments WILL NOT WORK. + + # Screw locations and extra screw locations for separable thumb, all from thumb origin + # Pulled out of hardcoding as drastic changes to the geometry may require fixes to the screw mounts. + # First screw in separable should be similar to the standard location as it will receive the same modifiers. + 'default_thumb_screw_xy_locations': [[-21, -58]], + 'default_separable_thumb_screw_xy_locations': [[-21, -58]], + 'mini_thumb_screw_xy_locations': [[-29, -52]], + 'mini_separable_thumb_screw_xy_locations': [[-29, -52], [-62, 10], [12, -25]], + 'minidox_thumb_screw_xy_locations': [[-37, -34]], + 'minidox_separable_thumb_screw_xy_locations': [[-37, -34], [-62, 12], [10, -25]], + 'carbonfet_thumb_screw_xy_locations': [[-48, -37]], + 'carbonfet_separable_thumb_screw_xy_locations': [[-48, -37], [-52, 10], [12, -35]], + 'orbyl_thumb_screw_xy_locations': [[-53, -68]], + 'orbyl_separable_thumb_screw_xy_locations': [[-53, -68], [-66, 8], [10, -40]], + 'tbcj_thumb_screw_xy_locations': [[-40, -75]], + 'tbcj_separable_thumb_screw_xy_locations': [[-40, -75], [-63, 10], [15, -40]], + 'thumb_plate_tr_rotation': 0.0, # Top right plate rotation tweaks as thumb cluster is crowded for hot swap, etc. 'thumb_plate_tl_rotation': 0.0, # Top left plate rotation tweaks as thumb cluster is crowded for hot swap, etc. 'thumb_plate_mr_rotation': 0.0, # Mid right plate rotation tweaks as thumb cluster is crowded for hot swap, etc. 'thumb_plate_ml_rotation': 0.0, # Mid left plate rotation tweaks as thumb cluster is crowded for hot swap, etc. 'thumb_plate_br_rotation': 0.0, # Bottom right plate rotation tweaks as thumb cluster is crowded for hot swap, etc. 'thumb_plate_bl_rotation': 0.0, # Bottom right plate rotation tweaks as thumb cluster is crowded for hot swap, etc. + ############################## + # EXPERIMENTAL + 'separable_thumb': True, #creates a separable thumb section with additional screws to hold it down. Only attached at base. + ############################## ################################### ## Trackball in Wall ## @@ -69,6 +101,7 @@ shape_config = { 'tbiw_rotation_offset': (0.0, 0.0, 0.0), 'tbiw_left_wall_x_offset_override': 50.0, 'tbiw_left_wall_z_offset_override': 0.0, + 'tbiw_left_wall_lower_x_offset': 0.0, 'tbiw_left_wall_lower_y_offset': 0.0, 'tbiw_left_wall_lower_z_offset': 0.0, @@ -76,15 +109,33 @@ shape_config = { 'tbiw_oled_translation_offset': (-3.5, 0, 1.5), # Z offset tweaks are expected depending on curvature and OLED mount choice. 'tbiw_oled_rotation_offset': (0, 0, 0), + ########################################################################## + ## Finger Trackball in Wall EXPERIMENTAL WIP!!!! ## + ########################################################################## + 'finger_trackball_in_wall': False, # Separate trackball option, placing it in the OLED area + 'tbiw_ball_center_column': 0.2, # up from cornerrow instead of down from top + 'tbiw_translational_offset': (0.0, 0.0, 0.0), + 'tbiw_rotation_offset': (0.0, 0.0, 0.0), + 'tbiw_top_wall_y_offset_override': 50.0, + 'tbiw_top_wall_z_offset_override': 0.0, + 'tbiw_top_wall_extension_cols': 4, + + + ########################################### ## Trackball JS / ORBYL Thumb Cluster ## ########################################## 'other_thumb': 'DEFAULT', # cluster used for second thumb except if ball_side == 'both' 'tbjs_key_diameter': 70, + 'tbjs_Uwidth': 1.2, # size for inner key near trackball + 'tbjs_Uheight': 1.2, # size for inner key near trackball + # Offsets are per key and are applied before rotating into place around the ball # X and Y act like Tangential and Radial around the ball - 'tbjs_translation_offset': (0, 0, 10), # applied to the whole assy - 'tbjs_rotation_offset': (0, 0, 0), # applied to the whole assy + # 'tbjs_translation_offset': (0, 0, 10), # applied to the whole assy + # 'tbjs_rotation_offset': (0, 10, 0), # applied to the whole assy + 'tbjs_translation_offset': (0, 0, 2), # applied to the whole assy + 'tbjs_rotation_offset': (0, -8, 0), # applied to the whole assy 'tbjs_key_translation_offsets': [ (0.0, 0.0, -3.0-5), (0.0, 0.0, -3.0-5), @@ -109,12 +160,13 @@ shape_config = { ################################### ## Trackball General ## ################################### - # EXPERIMENTAL - 'trackball_modular': False, # May add removable trackball in subsequent releases, no current use. - # END EXPERIMENTAL + 'trackball_modular': False, # Added, creates a hole with space for the lip size listed below. + 'trackball_modular_lip_width': 3.0, # width of lip cleared out in ring location + 'trackball_modular_ball_height': 3.0, # height of ball from ring , used to create identical position to fixed. + 'trackball_modular_ring_height': 10.0, # height mount ring down from ball height. Covers gaps on elevated ball. + 'trackball_modular_clearance': 0.5, # height of ball from ring, used to create identical position to fixed. - 'trackball_Usize': 1.5, # size for inner key near trackball - 'ball_side': 'right', #'left', 'right', or 'both' + 'ball_side': 'both', #'left', 'right', or 'both' 'ball_diameter': 34.0, 'ball_wall_thickness': 3, # should not be changed unless the import models are changed. 'ball_gap': 1.0, @@ -134,17 +186,18 @@ shape_config = { 'pinky_1_5U': False, # LEAVE AS FALSE, CURRENTLY BROKEN 'first_1_5U_row': 0, 'last_1_5U_row': 5, + + 'skeletal': False, ############################## - 'extra_width': 2.5, # extra space between the base of keys# original= 2 - 'extra_height': 1.0, # original= 0.5 'wall_z_offset': 15, # length of the first downward_sloping part of the wall 'wall_x_offset': 5, # offset in the x and/or y direction for the first downward_sloping part of the wall (negative) 'wall_y_offset': 6, # offset in the x and/or y direction for the first downward_sloping part of the wall (negative) 'left_wall_x_offset': 12, # specific values for the left side due to the minimal wall. 'left_wall_z_offset': 3, # specific values for the left side due to the minimal wall. + 'left_wall_lower_x_offset': 0, # specific values for the lower left corner. 'left_wall_lower_y_offset': 0, # specific values for the lower left corner. 'left_wall_lower_z_offset': 0, 'wall_thickness': 4.5, # wall thickness parameter used on upper/mid stage of the wall @@ -193,11 +246,11 @@ shape_config = { 'sa_profile_key_height': 12.7, 'sa_length': 18.5, 'sa_double_length': 37.5, - 'plate_thickness': 4+1.1, + 'plate_thickness': 4 + 1.1, 'plate_rim': 1.5 + 0.5, # Undercut style dimensions - 'clip_thickness': 1.4, + 'clip_thickness': 1.3, 'clip_undercut': 1.0, 'undercut_transition': .2, # NOT FUNCTIONAL WITH OPENSCAD, ONLY WORKS WITH CADQUERY @@ -294,15 +347,18 @@ shape_config = { 'oled_clip_z_gap': .2, } }, - 'web_thickness': 4.0, - 'post_size': 0.1, - # post_adj': post_size / 2 - 'post_adj': 0, - 'screws_offset': 'INSIDE', #'OUTSIDE', 'INSIDE', 'ORIGINAL' + + 'screws_offset': 'INSIDE', # 'OUTSIDE', 'INSIDE', 'ORIGINAL' 'screw_insert_height': 3.8, - 'screw_insert_bottom_radius': 5.31 / 2, - 'screw_insert_top_radius': 5.1 / 2, + + # 'screw_insert_bottom_radius': 5.31 / 2, #Designed for inserts + # 'screw_insert_top_radius': 5.1 / 2, #Designed for inserts + + 'screw_insert_bottom_radius': 2.5 / 2, # Designed for self tapping + 'screw_insert_top_radius': 2.5 / 2, # Designed for self tapping + + 'screw_insert_outer_radius': 4.25, # Common to keep interface to base # Does anyone even use these? I think they just get in the way. 'wire_post_height': 7, @@ -332,30 +388,57 @@ shape_config = { # Offset is from the top inner corner of the top inner key. ################################### + ## PCB Screw Mount ## + ################################### + "pcb_mount_ref_offset": [0, -5, 0], + "pcb_holder_size": [34.6, 7, 4], + "pcb_holder_offset": [8.9, 0, 0], + + "pcb_usb_hole_size": [7.5, 10.0, 4], + "pcb_usb_hole_offset": [15, 0, 4.5], + + "wall_thinner_size": [34, 7, 10], + + "trrs_hole_size": [3, 20], + "trrs_offset": [0, 0, 1.5], + + "pcb_screw_hole_size": [.5, 10], + "pcb_screw_x_offsets": [- 5.5, 7.75, 22], # for the screw positions off of reference + "pcb_screw_y_offset": -2, + + + ################################### ## Bottom Plate Dimensions ################################### # COMMON DIMENSION - 'screw_hole_diameter': 2, + 'screw_hole_diameter': 3, # USED FOR CADQUERY ONLY 'base_thickness': 3.0, # thickness in the middle of the plate 'base_offset': 3.0, # Both start flat/flush on the bottom. This offsets the base up (if positive) 'base_rim_thickness': 5.0, # thickness on the outer frame with screws - 'screw_cbore_diameter': 4.0, - 'screw_cbore_depth': 2.0, + 'screw_cbore_diameter': 6.0, + 'screw_cbore_depth': 2.5, # Offset is from the top inner corner of the top inner key. ################################### ## HOLES ON PLATE FOR PCB MOUNT ################################### - 'plate_holes': False, + 'plate_holes': True, 'plate_holes_xy_offset': (0.0, 0.0), 'plate_holes_width': 14.3, 'plate_holes_height': 14.3, - 'plate_holes_diameter': 1.7, + 'plate_holes_diameter': 1.6, 'plate_holes_depth': 20.0, ################################### + ## EXPERIMENTAL + 'plate_pcb_clear': False, + 'plate_pcb_size': (18.5, 18.5, 5), + 'plate_pcb_offset': (0, 0, 0),# this is off of the back of the plate size. + ################################### + + ################################### ## SHOW PCB FOR FIT CHECK ################################### 'pcb_width': 18.0, @@ -414,4 +497,8 @@ def save_config(): if __name__ == '__main__': - save_config()
\ No newline at end of file + save_config() + + ## HERE FOR QUICK TESTING, SHOULD BE COMMENTED ON COMMIT + # from dactyl_manuform import * + # run()
\ No newline at end of file diff --git a/src/helpers_blender.py b/src/helpers_blender.py index 9213488..00da8e5 100644 --- a/src/helpers_blender.py +++ b/src/helpers_blender.py @@ -82,7 +82,8 @@ def add(shapes): def difference(shape, shapes): debugprint('difference()') for item in shapes: - shape -= item + if item is not None: + shape -= item return shape diff --git a/src/helpers_cadquery.py b/src/helpers_cadquery.py index 5dc78d1..58a876a 100644 --- a/src/helpers_cadquery.py +++ b/src/helpers_cadquery.py @@ -30,6 +30,8 @@ def cone(r1, r2, height): def rotate(shape, angle): + if shape is None: + return None origin = (0, 0, 0) shape = shape.rotate(axisStartPoint=origin, axisEndPoint=(1, 0, 0), angleDegrees=angle[0]) shape = shape.rotate(axisStartPoint=origin, axisEndPoint=(0, 1, 0), angleDegrees=angle[1]) @@ -38,6 +40,8 @@ def rotate(shape, angle): def translate(shape, vector): + if shape is None: + return None return shape.translate(tuple(vector)) @@ -50,10 +54,11 @@ def union(shapes): debugprint('union()') shape = None for item in shapes: - if shape is None: - shape = item - else: - shape = shape.union(item) + if item is not None: + if shape is None: + shape = item + else: + shape = shape.union(item) return shape @@ -61,23 +66,27 @@ def add(shapes): debugprint('union()') shape = None for item in shapes: - if shape is None: - shape = item - else: - shape = shape.add(item) + if item is not None: + if shape is None: + shape = item + else: + shape = shape.add(item) return shape def difference(shape, shapes): debugprint('difference()') for item in shapes: - shape = shape.cut(item) + if item is not None: + shape = shape.cut(item) return shape def intersect(shape1, shape2): - return shape1.intersect(shape2) - + if shape2 is not None: + return shape1.intersect(shape2) + else: + return shape1 def face_from_points(points): # debugprint('face_from_points()') diff --git a/src/helpers_solid.py b/src/helpers_solid.py index 174d65a..2557e01 100644 --- a/src/helpers_solid.py +++ b/src/helpers_solid.py @@ -23,10 +23,14 @@ def cone(r1, r2, height): def rotate(shape, angle): + if shape is None: + return None return sl.rotate(angle)(shape) def translate(shape, vector): + if shape is None: + return None return sl.translate(tuple(vector))(shape) @@ -47,10 +51,11 @@ def union(shapes): debugprint('union()') shape = None for item in shapes: - if shape is None: - shape = item - else: - shape += item + if item is not None: + if shape is None: + shape = item + else: + shape += item return shape @@ -58,23 +63,27 @@ def add(shapes): debugprint('union()') shape = None for item in shapes: - if shape is None: - shape = item - else: - shape += item + if item is not None: + if shape is None: + shape = item + else: + shape += item return shape def difference(shape, shapes): debugprint('difference()') for item in shapes: - shape -= item + if item is not None: + shape -= item return shape def intersect(shape1, shape2): - return sl.intersection()(shape1, shape2) - + if shape2 is not None: + return sl.intersection()(shape1, shape2) + else: + return shape1 def hull_from_points(points): return sl.hull()(*points) diff --git a/src/parts/trackball_sensor_mount.stl b/src/parts/trackball_sensor_mount.stl Binary files differindex b3e1afa..4bbcfa5 100644 --- a/src/parts/trackball_sensor_mount.stl +++ b/src/parts/trackball_sensor_mount.stl diff --git a/src/run_config.json b/src/run_config.json index 48bde38..29f573a 100644 --- a/src/run_config.json +++ b/src/run_config.json @@ -2,7 +2,7 @@ "ENGINE": "solid", "save_dir": ".", "config_name": "DM", - "show_caps": true, + "show_caps": false, "show_pcbs": false, "nrows": 5, "ncols": 6, @@ -20,15 +20,133 @@ 7 ], "keyboard_z_offset": 11, + "extra_width": 2.5, + "extra_height": 1.0, + "web_thickness": 5.1, + "post_size": 0.1, + "post_adj": 0, "thumb_style": "TRACKBALL_ORBYL", "default_1U_cluster": true, "minidox_Usize": 1.6, + "default_thumb_screw_xy_locations": [ + [ + -21, + -58 + ] + ], + "default_separable_thumb_screw_xy_locations": [ + [ + -21, + -58 + ] + ], + "mini_thumb_screw_xy_locations": [ + [ + -29, + -52 + ] + ], + "mini_separable_thumb_screw_xy_locations": [ + [ + -29, + -52 + ], + [ + -62, + 10 + ], + [ + 12, + -25 + ] + ], + "minidox_thumb_screw_xy_locations": [ + [ + -37, + -34 + ] + ], + "minidox_separable_thumb_screw_xy_locations": [ + [ + -37, + -34 + ], + [ + -62, + 12 + ], + [ + 10, + -25 + ] + ], + "carbonfet_thumb_screw_xy_locations": [ + [ + -48, + -37 + ] + ], + "carbonfet_separable_thumb_screw_xy_locations": [ + [ + -48, + -37 + ], + [ + -52, + 10 + ], + [ + 12, + -35 + ] + ], + "orbyl_thumb_screw_xy_locations": [ + [ + -53, + -68 + ] + ], + "orbyl_separable_thumb_screw_xy_locations": [ + [ + -53, + -68 + ], + [ + -66, + 8 + ], + [ + 10, + -40 + ] + ], + "tbcj_thumb_screw_xy_locations": [ + [ + -40, + -75 + ] + ], + "tbcj_separable_thumb_screw_xy_locations": [ + [ + -40, + -75 + ], + [ + -63, + 10 + ], + [ + 15, + -40 + ] + ], "thumb_plate_tr_rotation": 0.0, "thumb_plate_tl_rotation": 0.0, "thumb_plate_mr_rotation": 0.0, "thumb_plate_ml_rotation": 0.0, "thumb_plate_br_rotation": 0.0, "thumb_plate_bl_rotation": 0.0, + "separable_thumb": true, "trackball_in_wall": false, "tbiw_ball_center_row": 0.2, "tbiw_translational_offset": [ @@ -58,14 +176,16 @@ ], "other_thumb": "DEFAULT", "tbjs_key_diameter": 70, + "tbjs_Uwidth": 1.2, + "tbjs_Uheight": 1.2, "tbjs_translation_offset": [ 0, 0, - 10 + 2 ], "tbjs_rotation_offset": [ 0, - 0, + -8, 0 ], "tbjs_key_translation_offsets": [ @@ -116,8 +236,11 @@ "tbcj_thickness": 2, "tbcj_outer_diameter": 53, "trackball_modular": false, - "trackball_Usize": 1.5, - "ball_side": "right", + "trackball_modular_lip_width": 3.0, + "trackball_modular_ball_height": 3.0, + "trackball_modular_ring_height": 10.0, + "trackball_modular_clearance": 0.5, + "ball_side": "both", "ball_diameter": 34.0, "ball_wall_thickness": 3, "ball_gap": 1.0, @@ -148,8 +271,6 @@ "pinky_1_5U": false, "first_1_5U_row": 0, "last_1_5U_row": 5, - "extra_width": 2.5, - "extra_height": 1.0, "wall_z_offset": 15, "wall_x_offset": 5, "wall_y_offset": 6, @@ -202,7 +323,7 @@ "sa_double_length": 37.5, "plate_thickness": 5.1, "plate_rim": 2.0, - "clip_thickness": 1.4, + "clip_thickness": 1.3, "clip_undercut": 1.0, "undercut_transition": 0.2, "plate_file": null, @@ -308,13 +429,11 @@ "oled_clip_z_gap": 0.2 } }, - "web_thickness": 4.0, - "post_size": 0.1, - "post_adj": 0, "screws_offset": "INSIDE", "screw_insert_height": 3.8, - "screw_insert_bottom_radius": 2.655, - "screw_insert_top_radius": 2.55, + "screw_insert_bottom_radius": 1.25, + "screw_insert_top_radius": 1.25, + "screw_insert_outer_radius": 4.25, "wire_post_height": 7, "wire_post_overhang": 3.5, "wire_post_diameter": 2.6, @@ -323,21 +442,81 @@ "external_holder_width": 28.75, "external_holder_xoffset": -5.0, "external_holder_yoffset": -4.5, - "screw_hole_diameter": 2, + "pcb_mount_ref_offset": [ + 0, + -5, + 0 + ], + "pcb_holder_size": [ + 34.6, + 7, + 4 + ], + "pcb_holder_offset": [ + 8.9, + 0, + 0 + ], + "pcb_usb_hole_size": [ + 7.5, + 10.0, + 4 + ], + "pcb_usb_hole_offset": [ + 15, + 0, + 4.5 + ], + "wall_thinner_size": [ + 34, + 7, + 10 + ], + "trrs_hole_size": [ + 3, + 20 + ], + "trrs_offset": [ + 0, + 0, + 1.5 + ], + "pcb_screw_hole_size": [ + 0.5, + 10 + ], + "pcb_screw_x_offsets": [ + -5.5, + 7.75, + 22 + ], + "pcb_screw_y_offset": -2, + "screw_hole_diameter": 3, "base_thickness": 3.0, "base_offset": 3.0, "base_rim_thickness": 5.0, - "screw_cbore_diameter": 4.0, - "screw_cbore_depth": 2.0, - "plate_holes": false, + "screw_cbore_diameter": 6.0, + "screw_cbore_depth": 2.5, + "plate_holes": true, "plate_holes_xy_offset": [ 0.0, 0.0 ], "plate_holes_width": 14.3, "plate_holes_height": 14.3, - "plate_holes_diameter": 1.7, + "plate_holes_diameter": 1.6, "plate_holes_depth": 20.0, + "plate_pcb_clear": false, + "plate_pcb_size": [ + 18.5, + 18.5, + 5 + ], + "plate_pcb_offset": [ + 0, + 0, + 0 + ], "pcb_width": 18.0, "pcb_height": 18.0, "pcb_thickness": 1.5, |