summaryrefslogtreecommitdiff
path: root/src/dactyl_manuform.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/dactyl_manuform.py')
-rw-r--r--src/dactyl_manuform.py246
1 files changed, 177 insertions, 69 deletions
diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py
index 171a10c..72135e7 100644
--- a/src/dactyl_manuform.py
+++ b/src/dactyl_manuform.py
@@ -94,7 +94,7 @@ if nrows > 5:
centerrow = nrows - centerrow_offset
lastrow = nrows - 1
-if reduced_outer_keys:
+if reduced_outer_cols>0 or reduced_inner_cols>0:
cornerrow = lastrow - 1
else:
cornerrow = lastrow
@@ -330,8 +330,13 @@ def trackball_ball(segments=100, side="right"):
## SA Keycaps ##
################
-
-
+def keycap(*args, **kwargs):
+ if show_caps == 'CHOC':
+ return choc_cap(*args, **kwargs)
+ elif show_caps == 'MX':
+ return sa_cap(*args, **kwargs)
+ else:
+ return sa_cap(*args, **kwargs)
def sa_cap(Usize=1):
# MODIFIED TO NOT HAVE THE ROTATION. NEEDS ROTATION DURING ASSEMBLY
@@ -379,6 +384,40 @@ def sa_cap(Usize=1):
return key_cap
+
+def choc_cap(Usize=1):
+ # MODIFIED TO NOT HAVE THE ROTATION. NEEDS ROTATION DURING ASSEMBLY
+ # sa_length = 18.25
+
+ if Usize == 1:
+ bl2 = 18.0/2
+ bw2 = 17.5/2
+ bt = 2
+ pl2 = 15.0/2
+ pw2 = 14.5/2
+ pt = 1.5
+ gap = 1.5
+
+ k1 = polyline([(bw2, bl2), (bw2, -bl2), (-bw2, -bl2), (-bw2, bl2), (bw2, bl2)])
+ k1 = extrude_poly(outer_poly=k1, height=0.1)
+ k1 = translate(k1, (0, 0, 0.05))
+ k2 = polyline([(bw2, bl2), (bw2, -bl2), (-bw2, -bl2), (-bw2, bl2), (bw2, bl2)])
+ k2 = extrude_poly(outer_poly=k2, height=0.1)
+ k2 = translate(k2, (0, 0, 0.05+bt))
+ k3 = polyline([(pw2, pl2), (pw2, -pl2), (-pw2, -pl2), (-pw2, pl2), (pw2, pl2)])
+ k3 = extrude_poly(outer_poly=k3, height=0.1)
+ k3 = translate(k3, (0, 0, 0.05+bt+pt))
+ key_cap = hull_from_shapes((k1, k2, k3))
+
+ key_cap = translate(key_cap, (0, 0, 2.8 + 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))
@@ -510,7 +549,7 @@ def key_holes(side="right"):
holes = []
for column in range(ncols):
for row in range(nrows):
- if (column in [2, 3]) or (not row == lastrow) or (not reduced_outer_keys):
+ if (reduced_inner_cols <= column < (ncols - reduced_outer_cols)) or (not row == lastrow):
holes.append(key_place(single_plate(side=side), column, row))
shape = union(holes)
@@ -523,7 +562,7 @@ def plate_pcb_cutouts(side="right"):
cutouts = []
for column in range(ncols):
for row in range(nrows):
- if (column in [2, 3]) or (not row == lastrow):
+ if (reduced_inner_cols <= column < (ncols - reduced_outer_cols)) or (not row == lastrow):
cutouts.append(key_place(plate_pcb_cutout(side=side), column, row))
# cutouts = union(cutouts)
@@ -531,15 +570,16 @@ def plate_pcb_cutouts(side="right"):
return cutouts
-def caps():
+def caps(cap_type="MX"):
caps = None
+
for column in range(ncols):
for row in range(nrows):
- if (column in [2, 3]) or (not row == lastrow):
+ if (reduced_inner_cols <= column < (ncols - reduced_outer_cols)) or (not row == lastrow):
if caps is None:
- caps = key_place(sa_cap(), column, row)
+ caps = key_place(keycap(), column, row)
else:
- caps = add([caps, key_place(sa_cap(), column, row)])
+ caps = add([caps, key_place(keycap(), column, row)])
return caps
@@ -595,7 +635,7 @@ def connectors():
debugprint('connectors()')
hulls = []
for column in range(ncols - 1):
- if (column in [2]) or (not reduced_outer_keys):
+ if reduced_inner_cols <= column < (ncols - reduced_outer_cols-1):
iterrows = lastrow+1
else:
iterrows = lastrow
@@ -609,7 +649,7 @@ def connectors():
hulls.append(triangle_hulls(places))
for column in range(ncols):
- if (column in [2, 3]) or (not reduced_outer_keys):
+ if reduced_inner_cols <= column < (ncols - reduced_outer_cols):
iterrows = lastrow
else:
iterrows = cornerrow
@@ -622,7 +662,7 @@ def connectors():
hulls.append(triangle_hulls(places))
for column in range(ncols - 1):
- if (column in [2]) or (not reduced_outer_keys):
+ if (reduced_inner_cols <= column < (ncols - reduced_outer_cols-1)):
iterrows = lastrow
else:
iterrows = cornerrow
@@ -634,21 +674,21 @@ def connectors():
places.append(key_place(web_post_tl(), column + 1, row + 1))
hulls.append(triangle_hulls(places))
- if reduced_outer_keys:
- 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))
+
+ if column == (reduced_inner_cols-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 == (ncols - reduced_outer_cols - 1):
+ 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)
@@ -662,7 +702,9 @@ def connectors():
def thumborigin():
# debugprint('thumborigin()')
- origin = key_position([mount_width / 2, -(mount_height / 2), 0], 1, cornerrow)
+
+ corner = cornerrow if reduced_inner_cols > 0 else lastrow
+ origin = key_position([mount_width / 2, -(mount_height / 2), 0], 1, corner)
for i in range(len(origin)):
origin[i] = origin[i] + thumb_offsets[i]
@@ -933,9 +975,9 @@ def thumb_pcb_plate_cutouts(side='right', style_override=None):
return default_thumb_pcb_plate_cutouts(side)
def default_thumbcaps():
- t1 = default_thumb_1x_layout(sa_cap(1), cap=True)
+ t1 = default_thumb_1x_layout(keycap(1), cap=True)
if not default_1U_cluster:
- t1.add(default_thumb_15x_layout(sa_cap(1.5), cap=True))
+ t1.add(default_thumb_15x_layout(keycap(1.5), cap=True))
return t1
@@ -1145,9 +1187,14 @@ def default_thumb_connectors():
def mini_thumb_tr_place(shape):
- shape = rotate(shape, [14, -15, 10])
- shape = translate(shape, thumborigin())
- shape = translate(shape, [-15, -10, 5])
+ if mini_index_key:
+ shape = rotate(shape, [-25, 25, 0])
+ shape = translate(shape, thumborigin())
+ shape = translate(shape, [-12.5, -10, 2])
+ else:
+ shape = rotate(shape, [14, -15, 10])
+ shape = translate(shape, thumborigin())
+ shape = translate(shape, [-15, -10, 5])
return shape
@@ -1195,8 +1242,8 @@ def mini_thumb_15x_layout(shape):
def mini_thumbcaps():
- t1 = mini_thumb_1x_layout(sa_cap(1))
- t15 = mini_thumb_15x_layout(rotate(sa_cap(1), [0, 0, rad2deg(pi / 2)]))
+ t1 = mini_thumb_1x_layout(keycap(1))
+ t15 = mini_thumb_15x_layout(rotate(keycap(1), [0, 0, rad2deg(pi / 2)]))
return t1.add(t15)
@@ -1376,8 +1423,8 @@ def minidox_thumb_fx_layout(shape):
])
def minidox_thumbcaps():
- t1 = minidox_thumb_1x_layout(sa_cap(1))
- # t1.add(minidox_thumb_15x_layout(rotate(sa_cap(1), [0, 0, rad2deg(pi / 2)])))
+ t1 = minidox_thumb_1x_layout(keycap(1))
+ # t1.add(minidox_thumb_15x_layout(rotate(keycap(1), [0, 0, rad2deg(pi / 2)])))
return t1
@@ -1545,8 +1592,8 @@ def carbonfet_thumb_15x_layout(shape, plate=True):
def carbonfet_thumbcaps():
- t1 = carbonfet_thumb_1x_layout(sa_cap(1))
- t15 = carbonfet_thumb_15x_layout(rotate(sa_cap(1.5), [0, 0, rad2deg(pi / 2)]))
+ t1 = carbonfet_thumb_1x_layout(keycap(1))
+ t15 = carbonfet_thumb_15x_layout(rotate(keycap(1.5), [0, 0, rad2deg(pi / 2)]))
return t1.add(t15)
@@ -1806,9 +1853,9 @@ def trackball_layout(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)])))
+ t1 = tbjs_thumb_1x_layout(keycap(1))
+ # t1 = tbjs_thumb_fx_layout(keycap(1))
+ # t1.add(tbjs_thumb_15x_layout(rotate(keycap(1), [0, 0, rad2deg(pi / 2)])))
return t1
@@ -2087,7 +2134,7 @@ def tbcj_thumb_pcb_plate_cutouts(side="right"):
return t
def tbcj_thumbcaps():
- t = tbcj_thumb_layout(sa_cap(1))
+ t = tbcj_thumb_layout(keycap(1))
return t
@@ -2396,12 +2443,14 @@ def right_wall(skeleton=False):
shape = None
+ corner = cornerrow if reduced_outer_cols > 0 else lastrow
+
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(cornerrow):
+ for i in range(corner):
y = i + 1
shape = union([shape, key_wall_brace(
lastcol, y - 1, 1, 0, web_post_br(), lastcol, y, 1, 0, web_post_tr(),
@@ -2417,7 +2466,7 @@ def right_wall(skeleton=False):
shape = union([
shape,
key_wall_brace(
- lastcol, cornerrow, 0, -1, web_post_br(), lastcol, cornerrow, 1, 0, web_post_br(),
+ lastcol, corner, 0, -1, web_post_br(), lastcol, corner, 1, 0, web_post_br(),
skeleton=skeleton
),
])
@@ -2438,14 +2487,15 @@ def left_wall(side='right', skeleton=False):
skeleton=skeleton,
)])
- # for i in range(lastrow):
- for i in range(cornerrow+1):
+ corner = cornerrow if reduced_inner_cols > 0 else lastrow
+
+ for i in range(corner+1):
y = i
- low = (y == (cornerrow))
+ low = (y == (corner))
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 < (cornerrow)),
+ skeleton=skeleton and (y < (corner)),
)
shape = union([shape, temp_shape1])
@@ -2458,13 +2508,13 @@ def left_wall(side='right', skeleton=False):
shape = union([shape, temp_shape2])
- for i in range(cornerrow):
+ for i in range(corner):
y = i + 1
- low = (y == (cornerrow))
+ low = (y == (corner))
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 < (cornerrow)),
+ skeleton=skeleton and (y < (corner)),
)
shape = union([shape, temp_shape1])
@@ -2484,26 +2534,84 @@ def front_wall(skeleton=False):
print('front_wall()')
shape = None
- shape = union([shape,key_wall_brace(
- 3, lastrow, 0, -1, web_post_bl(), 3, lastrow, 0.5, -1, web_post_br()
- )])
- shape = union([shape,key_wall_brace(
- 3, lastrow, 0.5, -1, web_post_br(), 4, cornerrow, .5, -1, web_post_bl()
- )])
- shape = union([shape,key_wall_brace(
- 4, cornerrow, .5, -1, web_post_bl(), 4, cornerrow, 0, -1, web_post_br()
- )])
+ # shape = union([shape,key_wall_brace(
+ # 3, lastrow, 0, -1, web_post_bl(), 3, lastrow, 0.5, -1, web_post_br()
+ # )])
+ # shape = union([shape,key_wall_brace(
+ # 3, lastrow, 0.5, -1, web_post_br(), 4, cornerrow, .5, -1, web_post_bl()
+ # )])
+ # shape = union([shape,key_wall_brace(
+ # 4, cornerrow, .5, -1, web_post_bl(), 4, cornerrow, 0, -1, web_post_br()
+ # )])
+
+ # for i in range(ncols - 5):
+ # x = i + 5
+ #
+ # shape = union([shape,key_wall_brace(
+ # x, cornerrow, 0, -1, web_post_bl(), x, cornerrow, 0, -1, web_post_br()
+ # )])
+ #
+ # shape = union([shape, key_wall_brace(
+ # x, cornerrow, 0, -1, web_post_bl(), x - 1, cornerrow, 0, -1, web_post_br()
+ # )])
+
+ # corner = lastrow if 4 < (ncols - reduced_outer_cols) else cornerrow
+ corner = cornerrow
+ if reduced_outer_cols>0:
+ offset_col = ncols - reduced_outer_cols
+ else:
+ offset_col = 99
+
+ for i in range(ncols - 3):
+ x = i + 3
+ print("col {}".format(x))
+ if x < (offset_col - 1):
+ print("pre-offset")
+ if x > 3:
+ shape = union([shape, key_wall_brace(
+ x-1, lastrow, 0, -1, web_post_br(), x, lastrow, 0, -1, web_post_bl()
+ )])
+ shape = union([shape, key_wall_brace(
+ x, lastrow, 0, -1, web_post_bl(), x, lastrow, 0, -1, web_post_br()
+ )])
+ elif x < (offset_col):
+ print("offset setup")
+ if x > 3:
+ shape = union([shape, key_wall_brace(
+ x-1, lastrow, 0, -1, web_post_br(), x, lastrow, 0, -1, web_post_bl()
+ )])
+ shape = union([shape, key_wall_brace(
+ x, lastrow, 0, -1, web_post_bl(), x, lastrow, 0.5, -1, web_post_br()
+ )])
+
+ elif x == (offset_col):
+ print("offset")
+ shape = union([shape, key_wall_brace(
+ x - 1, lastrow, 0.5, -1, web_post_br(), x, cornerrow, .5, -1, web_post_bl()
+ )])
+ shape = union([shape, key_wall_brace(
+ x, cornerrow, .5, -1, web_post_bl(), x, cornerrow, 0, -1, web_post_br()
+ )])
+
+ elif x == (offset_col + 1):
+ print("offset completion")
+ shape = union([shape, key_wall_brace(
+ x, cornerrow, 0, -1, web_post_bl(), x - 1, cornerrow, 0, -1, web_post_br()
+ )])
+ shape = union([shape, key_wall_brace(
+ x, cornerrow, 0, -1, web_post_bl(), x, cornerrow, 0, -1, web_post_br()
+ )])
- for i in range(ncols - 5):
- x = i + 5
- shape = union([shape,key_wall_brace(
- x, cornerrow, 0, -1, web_post_bl(), x, cornerrow, 0, -1, web_post_br()
- )])
+ else:
+ print("post offset")
+ shape = union([shape, key_wall_brace(
+ x, cornerrow, 0, -1, web_post_bl(), x - 1, corner, 0, -1, web_post_br()
+ )])
+ shape = union([shape, key_wall_brace(
+ x, cornerrow, 0, -1, web_post_bl(), x, corner, 0, -1, web_post_br()
+ )])
- shape = union([shape, key_wall_brace(
- x, cornerrow, 0, -1, web_post_bl(), x - 1, cornerrow, 0, -1, web_post_br()
- )])
return shape