Compare commits
4 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
f6ccde7848 | |
|
|
e9423dbcf0 | |
|
|
1cd946e2fd | |
|
|
8293ebe799 |
449
src/main.py
449
src/main.py
|
|
@ -1,47 +1,50 @@
|
||||||
import datetime
|
"""
|
||||||
from math import radians, sin, cos
|
Generate Dactyl case
|
||||||
|
"""
|
||||||
|
|
||||||
|
from math import radians, sin
|
||||||
from lib import *
|
from lib import *
|
||||||
from shapes import *
|
from shapes import *
|
||||||
import lib
|
import lib
|
||||||
import mat
|
import mat
|
||||||
|
|
||||||
switch_thickness = 1.3
|
SWITCH_THICKNESS = 1.3
|
||||||
switch_top_thickness = 2.8
|
SWITCH_TOP_THICKNESS = 2.8
|
||||||
web_thickness = 3
|
WEB_THICKNESS = 3
|
||||||
switch_rim_thickness = 2
|
SWITCH_RIM_THICKNESS = 2
|
||||||
|
|
||||||
post_width = 0.5
|
POST_WIDTH = 0.5
|
||||||
post_rad = post_width / 2
|
POST_RAD = POST_WIDTH / 2
|
||||||
|
|
||||||
keyhole_size = 13.8
|
KEYHOLE_SIZE = 13.8
|
||||||
keyswitch_height = 15
|
KEYSWITCH_HEIGHT = 15
|
||||||
keyswitch_width = 15
|
KEYSWITCH_WIDTH = 15
|
||||||
|
|
||||||
plate_outer_width = keyhole_size + switch_rim_thickness * 2
|
PLATE_OUTER_WIDTH = KEYHOLE_SIZE + SWITCH_RIM_THICKNESS * 2
|
||||||
|
|
||||||
max_num_rows = 4
|
MAX_NUM_ROWS = 4
|
||||||
num_cols = 6
|
NUM_COLS = 6
|
||||||
num_pinky_columns = 2
|
NUM_PINKY_COLUMNS = 2
|
||||||
|
|
||||||
cols_with_max_rows = [2, 3]
|
cols_with_max_rows = [2, 3]
|
||||||
|
|
||||||
sa_profile_key_height = 2
|
SA_PROFILE_KEY_HEIGHT = 2
|
||||||
cap_top_height = switch_top_thickness + sa_profile_key_height
|
CAP_TOP_HEIGHT = SWITCH_TOP_THICKNESS + SA_PROFILE_KEY_HEIGHT
|
||||||
|
|
||||||
# extra space between the base of keys
|
# extra space between the base of keys
|
||||||
extra_height = 3
|
EXTRA_HEIGHT = 3
|
||||||
extra_width = 3
|
EXTRA_WIDTH = 3
|
||||||
mount_height = keyswitch_height
|
MOUNT_HEIGHT = KEYSWITCH_HEIGHT
|
||||||
mount_width = keyswitch_width
|
MOUNT_WIDTH = KEYSWITCH_WIDTH
|
||||||
# use 10 for faster prototyping, 15 for real
|
# use 10 for faster prototyping, 15 for real
|
||||||
tenting_angle = 11.0
|
TENTING_ANGLE = 11.0
|
||||||
z_offset = 6.0
|
Z_OFFSET = 9.0
|
||||||
|
|
||||||
should_include_risers = False
|
SHOULD_INCLUDE_RISERS = False
|
||||||
|
|
||||||
|
|
||||||
def is_pinky(col):
|
def is_pinky(col):
|
||||||
return col >= num_cols - num_pinky_columns
|
return col >= NUM_COLS - NUM_PINKY_COLUMNS
|
||||||
|
|
||||||
|
|
||||||
# aka: alpha
|
# aka: alpha
|
||||||
|
|
@ -53,13 +56,13 @@ def row_curve_deg(col):
|
||||||
# aka: beta
|
# aka: beta
|
||||||
col_curve_deg = 4.0
|
col_curve_deg = 4.0
|
||||||
|
|
||||||
column_radius = cap_top_height + ((mount_width + extra_width) / 2) / sin(
|
column_radius = CAP_TOP_HEIGHT + ((MOUNT_WIDTH + EXTRA_WIDTH) / 2) / sin(
|
||||||
radians(col_curve_deg) / 2
|
radians(col_curve_deg) / 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def row_radius(col):
|
def row_radius(col):
|
||||||
return cap_top_height + ((mount_height + extra_height) / 2) / sin(
|
return CAP_TOP_HEIGHT + ((MOUNT_HEIGHT + EXTRA_HEIGHT) / 2) / sin(
|
||||||
radians(row_curve_deg(col)) / 2
|
radians(row_curve_deg(col)) / 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -80,13 +83,13 @@ def column_extra_transform(col):
|
||||||
|
|
||||||
def num_rows_for_col(col):
|
def num_rows_for_col(col):
|
||||||
if col in cols_with_max_rows:
|
if col in cols_with_max_rows:
|
||||||
return max_num_rows
|
return MAX_NUM_ROWS
|
||||||
else:
|
else:
|
||||||
return max_num_rows - 1
|
return MAX_NUM_ROWS - 1
|
||||||
|
|
||||||
|
|
||||||
def does_coord_exist(row, col):
|
def does_coord_exist(row, col):
|
||||||
return col >= 0 and col < num_cols and row >= 0 and row < num_rows_for_col(col)
|
return col >= 0 and col < NUM_COLS and row >= 0 and row < num_rows_for_col(col)
|
||||||
|
|
||||||
|
|
||||||
def negative(vect):
|
def negative(vect):
|
||||||
|
|
@ -102,21 +105,21 @@ def bottom_hull(shape):
|
||||||
|
|
||||||
|
|
||||||
def single_switch_fn():
|
def single_switch_fn():
|
||||||
outer_width = keyhole_size + switch_rim_thickness * 2
|
outer_width = KEYHOLE_SIZE + SWITCH_RIM_THICKNESS * 2
|
||||||
|
|
||||||
bottom_wall = cube(outer_width, switch_rim_thickness, switch_thickness)
|
bottom_wall = cube(outer_width, SWITCH_RIM_THICKNESS, SWITCH_THICKNESS)
|
||||||
top_wall = translate(0, keyhole_size + switch_rim_thickness, 0)(bottom_wall)
|
top_wall = translate(0, KEYHOLE_SIZE + SWITCH_RIM_THICKNESS, 0)(bottom_wall)
|
||||||
|
|
||||||
left_wall = cube(switch_rim_thickness, outer_width, switch_thickness)
|
left_wall = cube(SWITCH_RIM_THICKNESS, outer_width, SWITCH_THICKNESS)
|
||||||
right_wall = translate(keyhole_size + switch_rim_thickness, 0, 0)(left_wall)
|
right_wall = translate(KEYHOLE_SIZE + SWITCH_RIM_THICKNESS, 0, 0)(left_wall)
|
||||||
|
|
||||||
nub_len = 2.75
|
nub_len = 2.75
|
||||||
nub_cyl = translate(0, 0, -1)(rotate_x(90)(cylinder(1, nub_len, 30, center=True)))
|
nub_cyl = translate(0, 0, -1)(rotate_x(90)(cylinder(1, nub_len, 30, center=True)))
|
||||||
# nub_cube = translate(-switch_rim_thickness / 2, 0, 0.)(cube(switch_rim_thickness, nub_len, 4, center=True))
|
# nub_cube = translate(-SWITCH_RIM_THICKNESS / 2, 0, 0.)(cube(SWITCH_RIM_THICKNESS, nub_len, 4, center=True))
|
||||||
# left_nub = translate(switch_rim_thickness, (outer_width) / 2, 0)(hull(nub_cyl, nub_cube))
|
# left_nub = translate(SWITCH_RIM_THICKNESS, (outer_width) / 2, 0)(hull(nub_cyl, nub_cube))
|
||||||
|
|
||||||
# right_nub_cube = translate(switch_rim_thickness / 2, 0, 0)(cube(switch_rim_thickness, nub_len, 4, center=True))
|
# right_nub_cube = translate(SWITCH_RIM_THICKNESS / 2, 0, 0)(cube(SWITCH_RIM_THICKNESS, nub_len, 4, center=True))
|
||||||
# right_nub = translate(-switch_rim_thickness + outer_width, (outer_width) / 2, 0)(hull(nub_cyl, right_nub_cube))
|
# right_nub = translate(-SWITCH_RIM_THICKNESS + outer_width, (outer_width) / 2, 0)(hull(nub_cyl, right_nub_cube))
|
||||||
|
|
||||||
return translate(-outer_width / 2, -outer_width / 2, 0)(
|
return translate(-outer_width / 2, -outer_width / 2, 0)(
|
||||||
union(
|
union(
|
||||||
|
|
@ -132,8 +135,8 @@ def single_switch_fn():
|
||||||
|
|
||||||
single_switch = single_switch_fn()
|
single_switch = single_switch_fn()
|
||||||
|
|
||||||
filled_switch = translate(0, 0, switch_thickness / 2.0)(
|
filled_switch = translate(0, 0, SWITCH_THICKNESS / 2.0)(
|
||||||
cube(plate_outer_width, plate_outer_width, switch_thickness, center=True)
|
cube(PLATE_OUTER_WIDTH, PLATE_OUTER_WIDTH, SWITCH_THICKNESS, center=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
sa_length = 16.5
|
sa_length = 16.5
|
||||||
|
|
@ -160,7 +163,7 @@ def sa_cap_fn():
|
||||||
top = translate(0, 0, sa_extra_height)(top)
|
top = translate(0, 0, sa_extra_height)(top)
|
||||||
|
|
||||||
return colour(220, 163, 163, 1)(
|
return colour(220, 163, 163, 1)(
|
||||||
translate(0, 0, switch_top_thickness + 1.5)(hull(bot, mid, top))
|
translate(0, 0, SWITCH_TOP_THICKNESS + 1.5)(hull(bot, mid, top))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -168,8 +171,8 @@ sa_cap = sa_cap_fn()
|
||||||
|
|
||||||
|
|
||||||
def row_cols():
|
def row_cols():
|
||||||
for row in range(max_num_rows):
|
for row in range(MAX_NUM_ROWS):
|
||||||
for col in range(num_cols):
|
for col in range(NUM_COLS):
|
||||||
if row < num_rows_for_col(col):
|
if row < num_rows_for_col(col):
|
||||||
yield (row, col)
|
yield (row, col)
|
||||||
|
|
||||||
|
|
@ -178,11 +181,11 @@ def all_of_shape(shape):
|
||||||
return [grid_position(row, col, shape) for (row, col) in row_cols()]
|
return [grid_position(row, col, shape) for (row, col) in row_cols()]
|
||||||
|
|
||||||
|
|
||||||
web_post = translate(-post_rad, -post_rad, switch_thickness - web_thickness)(
|
web_post = translate(-POST_RAD, -POST_RAD, SWITCH_THICKNESS - WEB_THICKNESS)(
|
||||||
cube(post_width, post_width, web_thickness)
|
cube(POST_WIDTH, POST_WIDTH, WEB_THICKNESS)
|
||||||
)
|
)
|
||||||
short_web_post = translate(-post_rad, -post_rad, 0)(
|
short_web_post = translate(-POST_RAD, -POST_RAD, 0)(
|
||||||
cube(post_width, post_width, post_width)
|
cube(POST_WIDTH, POST_WIDTH, POST_WIDTH)
|
||||||
)
|
)
|
||||||
|
|
||||||
SQUARE_OFFSET_IDXS = [
|
SQUARE_OFFSET_IDXS = [
|
||||||
|
|
@ -209,7 +212,7 @@ def apply_translate_square(square, shape):
|
||||||
return square_apply(square, fn)
|
return square_apply(square, fn)
|
||||||
|
|
||||||
|
|
||||||
outer_post_delta = keyhole_size / 2 + switch_rim_thickness # - post_rad/2
|
outer_post_delta = KEYHOLE_SIZE / 2 + SWITCH_RIM_THICKNESS # - POST_RAD/2
|
||||||
|
|
||||||
outer_post_translate_square = square_translater_at_offset(outer_post_delta)
|
outer_post_translate_square = square_translater_at_offset(outer_post_delta)
|
||||||
|
|
||||||
|
|
@ -221,7 +224,7 @@ web_post_bl = translate(-outer_post_delta, -outer_post_delta, 0)(web_post)
|
||||||
web_posts = apply_translate_square(outer_post_translate_square, web_post)
|
web_posts = apply_translate_square(outer_post_translate_square, web_post)
|
||||||
short_web_posts = apply_translate_square(outer_post_translate_square, short_web_post)
|
short_web_posts = apply_translate_square(outer_post_translate_square, short_web_post)
|
||||||
|
|
||||||
inner_post_delta = keyhole_size / 2 + post_rad
|
inner_post_delta = KEYHOLE_SIZE / 2 + POST_RAD
|
||||||
inner_post_translate_square = square_translater_at_offset(inner_post_delta)
|
inner_post_translate_square = square_translater_at_offset(inner_post_delta)
|
||||||
|
|
||||||
inner_web_posts = apply_translate_square(inner_post_translate_square, web_post)
|
inner_web_posts = apply_translate_square(inner_post_translate_square, web_post)
|
||||||
|
|
@ -304,8 +307,8 @@ def place_on_grid_base(row, column, domain):
|
||||||
# Column offset
|
# Column offset
|
||||||
domain.translate(*column_offset(column)),
|
domain.translate(*column_offset(column)),
|
||||||
# Misc
|
# Misc
|
||||||
domain.rotate_y(tenting_angle),
|
domain.rotate_y(TENTING_ANGLE),
|
||||||
domain.translate(0, 0, z_offset),
|
domain.translate(0, 0, Z_OFFSET),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -331,8 +334,8 @@ def connectors():
|
||||||
return hull(*posts1, *posts2)
|
return hull(*posts1, *posts2)
|
||||||
|
|
||||||
all_connectors = []
|
all_connectors = []
|
||||||
for col in range(num_cols - 1):
|
for col in range(NUM_COLS - 1):
|
||||||
for row in range(max_num_rows):
|
for row in range(MAX_NUM_ROWS):
|
||||||
if does_coord_exist(row, col) and does_coord_exist(row, col + 1):
|
if does_coord_exist(row, col) and does_coord_exist(row, col + 1):
|
||||||
if (row, col) == (0, 3):
|
if (row, col) == (0, 3):
|
||||||
right_edge = [
|
right_edge = [
|
||||||
|
|
@ -348,8 +351,8 @@ def connectors():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
for col in range(num_cols):
|
for col in range(NUM_COLS):
|
||||||
for row in range(max_num_rows - 1):
|
for row in range(MAX_NUM_ROWS - 1):
|
||||||
if does_coord_exist(row, col) and does_coord_exist(row + 1, col):
|
if does_coord_exist(row, col) and does_coord_exist(row + 1, col):
|
||||||
all_connectors.append(
|
all_connectors.append(
|
||||||
make_edge_connection(
|
make_edge_connection(
|
||||||
|
|
@ -357,7 +360,7 @@ def connectors():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
for col in range(num_cols - 1):
|
for col in range(NUM_COLS - 1):
|
||||||
row = num_rows_for_col(col) - 1
|
row = num_rows_for_col(col) - 1
|
||||||
next_col = col + 1
|
next_col = col + 1
|
||||||
next_row = num_rows_for_col(next_col) - 1
|
next_row = num_rows_for_col(next_col) - 1
|
||||||
|
|
@ -395,8 +398,8 @@ def connectors():
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
for col in range(num_cols - 1):
|
for col in range(NUM_COLS - 1):
|
||||||
for row in range(max_num_rows - 1):
|
for row in range(MAX_NUM_ROWS - 1):
|
||||||
if does_diag_exist(row, col):
|
if does_diag_exist(row, col):
|
||||||
p1 = grid_position(row, col, web_post_br)
|
p1 = grid_position(row, col, web_post_br)
|
||||||
p2 = grid_position(row + 1, col, web_post_tr)
|
p2 = grid_position(row + 1, col, web_post_tr)
|
||||||
|
|
@ -477,7 +480,7 @@ def wall_connect_from_placer(
|
||||||
delta1=None,
|
delta1=None,
|
||||||
delta2=None,
|
delta2=None,
|
||||||
connectors=True,
|
connectors=True,
|
||||||
walls=False
|
walls=True
|
||||||
):
|
):
|
||||||
offsetter1 = make_offsetter(idx1, delta1)
|
offsetter1 = make_offsetter(idx1, delta1)
|
||||||
offsetter2 = make_offsetter(idx2, delta2)
|
offsetter2 = make_offsetter(idx2, delta2)
|
||||||
|
|
@ -487,8 +490,8 @@ def wall_connect_from_placer(
|
||||||
|
|
||||||
shapes = []
|
shapes = []
|
||||||
|
|
||||||
# if should_include_risers:
|
if SHOULD_INCLUDE_RISERS:
|
||||||
# shapes.append(hull(place_fn1(post1), place_fn2(post2)))
|
shapes.append(hull(place_fn1(post1), place_fn2(post2)))
|
||||||
|
|
||||||
if connectors:
|
if connectors:
|
||||||
shapes.append(
|
shapes.append(
|
||||||
|
|
@ -498,15 +501,15 @@ def wall_connect_from_placer(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# if walls:
|
if walls:
|
||||||
# shapes.append(
|
shapes.append(
|
||||||
# bottom_hull(
|
bottom_hull(
|
||||||
# hull(
|
hull(
|
||||||
# place_fn1(offsetter1(switch_riser_raw_dot)),
|
place_fn1(offsetter1(switch_riser_raw_dot)),
|
||||||
# place_fn2(offsetter2(switch_riser_raw_dot)),
|
place_fn2(offsetter2(switch_riser_raw_dot)),
|
||||||
# )
|
)
|
||||||
# )
|
)
|
||||||
# )
|
)
|
||||||
|
|
||||||
return union(*shapes)
|
return union(*shapes)
|
||||||
|
|
||||||
|
|
@ -515,15 +518,15 @@ def case_walls():
|
||||||
all_shapes = []
|
all_shapes = []
|
||||||
|
|
||||||
# Top wall
|
# Top wall
|
||||||
for col in range(0, num_cols):
|
for col in range(0, NUM_COLS):
|
||||||
all_shapes.append(wall_connect(0, col, square_idx_tl, 0, col, square_idx_tr))
|
all_shapes.append(wall_connect(0, col, square_idx_tl, 0, col, square_idx_tr))
|
||||||
for col in range(0, num_cols - 1):
|
for col in range(0, NUM_COLS - 1):
|
||||||
all_shapes.append(
|
all_shapes.append(
|
||||||
wall_connect(0, col, square_idx_tr, 0, col + 1, square_idx_tl)
|
wall_connect(0, col, square_idx_tr, 0, col + 1, square_idx_tl)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Right wall
|
# Right wall
|
||||||
max_col = num_cols - 1
|
max_col = NUM_COLS - 1
|
||||||
for row in range(0, num_rows_for_col(max_col)):
|
for row in range(0, num_rows_for_col(max_col)):
|
||||||
all_shapes.append(
|
all_shapes.append(
|
||||||
wall_connect(row, max_col, square_idx_tr, row, max_col, square_idx_br)
|
wall_connect(row, max_col, square_idx_tr, row, max_col, square_idx_br)
|
||||||
|
|
@ -543,10 +546,9 @@ def case_walls():
|
||||||
|
|
||||||
# Bottom wall
|
# Bottom wall
|
||||||
def include_wall(col):
|
def include_wall(col):
|
||||||
return False
|
return col >= 2
|
||||||
# return col >= 2
|
|
||||||
|
|
||||||
for col in range(0, num_cols):
|
for col in range(0, NUM_COLS):
|
||||||
all_shapes.append(
|
all_shapes.append(
|
||||||
wall_connect(
|
wall_connect(
|
||||||
num_rows_for_col(col) - 1,
|
num_rows_for_col(col) - 1,
|
||||||
|
|
@ -558,7 +560,7 @@ def case_walls():
|
||||||
walls=include_wall(col),
|
walls=include_wall(col),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
for col in range(0, num_cols - 1):
|
for col in range(0, NUM_COLS - 1):
|
||||||
all_shapes.append(
|
all_shapes.append(
|
||||||
wall_connect(
|
wall_connect(
|
||||||
num_rows_for_col(col) - 1,
|
num_rows_for_col(col) - 1,
|
||||||
|
|
@ -711,43 +713,43 @@ def thumb_walls():
|
||||||
walls=False,
|
walls=False,
|
||||||
connectors=False,
|
connectors=False,
|
||||||
),
|
),
|
||||||
# hull(
|
hull(
|
||||||
# get_offset_thumb_placer(thumb_br_placer, square_idx_tr, top_dot),
|
get_offset_thumb_placer(thumb_br_placer, square_idx_tr, top_dot),
|
||||||
# get_offset_thumb_placer(thumb_r_placer, square_idx_bl, top_dot),
|
get_offset_thumb_placer(thumb_r_placer, square_idx_bl, top_dot),
|
||||||
# get_offset_thumb_placer(
|
get_offset_thumb_placer(
|
||||||
# thumb_r_placer, square_idx_bl, switch_riser_raw_dot
|
thumb_r_placer, square_idx_bl, switch_riser_raw_dot
|
||||||
# ),
|
),
|
||||||
# ),
|
),
|
||||||
# hull(
|
hull(
|
||||||
# get_offset_thumb_placer(thumb_br_placer, square_idx_tr, top_dot),
|
get_offset_thumb_placer(thumb_br_placer, square_idx_tr, top_dot),
|
||||||
# get_offset_thumb_placer(
|
get_offset_thumb_placer(
|
||||||
# thumb_br_placer, square_idx_tr, switch_riser_raw_dot
|
thumb_br_placer, square_idx_tr, switch_riser_raw_dot
|
||||||
# ),
|
),
|
||||||
# get_offset_thumb_placer(
|
get_offset_thumb_placer(
|
||||||
# thumb_r_placer, square_idx_bl, switch_riser_raw_dot
|
thumb_r_placer, square_idx_bl, switch_riser_raw_dot
|
||||||
# ),
|
),
|
||||||
# ),
|
),
|
||||||
# hull(
|
hull(
|
||||||
# get_offset_thumb_placer(
|
get_offset_thumb_placer(
|
||||||
# thumb_r_placer, square_idx_br, switch_riser_raw_dot
|
thumb_r_placer, square_idx_br, switch_riser_raw_dot
|
||||||
# ),
|
),
|
||||||
# get_offset_thumb_placer(
|
get_offset_thumb_placer(
|
||||||
# thumb_r_placer, square_idx_bl, switch_riser_raw_dot
|
thumb_r_placer, square_idx_bl, switch_riser_raw_dot
|
||||||
# ),
|
),
|
||||||
# get_offset_thumb_placer(
|
get_offset_thumb_placer(
|
||||||
# thumb_br_placer, square_idx_tr, switch_riser_raw_dot
|
thumb_br_placer, square_idx_tr, switch_riser_raw_dot
|
||||||
# ),
|
),
|
||||||
# ),
|
),
|
||||||
# bottom_hull(
|
bottom_hull(
|
||||||
# hull(
|
hull(
|
||||||
# get_offset_thumb_placer(
|
get_offset_thumb_placer(
|
||||||
# thumb_r_placer, square_idx_br, switch_riser_raw_dot
|
thumb_r_placer, square_idx_br, switch_riser_raw_dot
|
||||||
# ),
|
),
|
||||||
# get_offset_thumb_placer(
|
get_offset_thumb_placer(
|
||||||
# thumb_br_placer, square_idx_tr, switch_riser_raw_dot
|
thumb_br_placer, square_idx_tr, switch_riser_raw_dot
|
||||||
# ),
|
),
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -872,37 +874,37 @@ def thumb_connectors():
|
||||||
|
|
||||||
def thumb_to_body_connectors():
|
def thumb_to_body_connectors():
|
||||||
return union(
|
return union(
|
||||||
# bottom_hull(
|
bottom_hull(
|
||||||
# hull(
|
hull(
|
||||||
# thumb_r_placer(
|
thumb_r_placer(
|
||||||
# get_in_square(switch_riser_offset_square, square_idx_br)(
|
get_in_square(switch_riser_offset_square, square_idx_br)(
|
||||||
# switch_riser_raw_dot
|
switch_riser_raw_dot
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# place_on_grid(3, 2)(
|
place_on_grid(3, 2)(
|
||||||
# get_in_square(switch_riser_offset_square, square_idx_bl)(
|
get_in_square(switch_riser_offset_square, square_idx_bl)(
|
||||||
# switch_riser_raw_dot
|
switch_riser_raw_dot
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# hull(
|
hull(
|
||||||
# thumb_r_placer(
|
thumb_r_placer(
|
||||||
# get_in_square(switch_riser_offset_square, square_idx_br)(
|
get_in_square(switch_riser_offset_square, square_idx_br)(
|
||||||
# switch_riser_raw_dot
|
switch_riser_raw_dot
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# thumb_r_placer(
|
thumb_r_placer(
|
||||||
# get_in_square(switch_riser_offset_square, square_idx_tr)(
|
get_in_square(switch_riser_offset_square, square_idx_tr)(
|
||||||
# switch_riser_raw_dot
|
switch_riser_raw_dot
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# place_on_grid(3, 2)(
|
place_on_grid(3, 2)(
|
||||||
# get_in_square(switch_riser_offset_square, square_idx_bl)(
|
get_in_square(switch_riser_offset_square, square_idx_bl)(
|
||||||
# switch_riser_raw_dot
|
switch_riser_raw_dot
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# ),
|
),
|
||||||
hull(
|
hull(
|
||||||
thumb_r_placer(
|
thumb_r_placer(
|
||||||
get_in_square(switch_riser_offset_square, square_idx_tr)(
|
get_in_square(switch_riser_offset_square, square_idx_tr)(
|
||||||
|
|
@ -937,37 +939,37 @@ def thumb_to_body_connectors():
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# bottom_hull(
|
bottom_hull(
|
||||||
# hull(
|
hull(
|
||||||
# thumb_m_placer(
|
thumb_m_placer(
|
||||||
# get_in_square(switch_riser_offset_square, square_idx_tl)(
|
get_in_square(switch_riser_offset_square, square_idx_tl)(
|
||||||
# switch_riser_raw_dot
|
switch_riser_raw_dot
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# place_on_grid(2, 0)(
|
place_on_grid(2, 0)(
|
||||||
# get_in_square(switch_riser_offset_square, square_idx_bl)(
|
get_in_square(switch_riser_offset_square, square_idx_bl)(
|
||||||
# switch_riser_raw_dot
|
switch_riser_raw_dot
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# hull(
|
hull(
|
||||||
# thumb_m_placer(
|
thumb_m_placer(
|
||||||
# get_in_square(switch_riser_offset_square, square_idx_tl)(
|
get_in_square(switch_riser_offset_square, square_idx_tl)(
|
||||||
# switch_riser_raw_dot
|
switch_riser_raw_dot
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# place_on_grid(2, 0)(
|
place_on_grid(2, 0)(
|
||||||
# get_in_square(switch_riser_offset_square, square_idx_bl)(
|
get_in_square(switch_riser_offset_square, square_idx_bl)(
|
||||||
# switch_riser_raw_dot
|
switch_riser_raw_dot
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# place_on_grid(2, 0)(
|
place_on_grid(2, 0)(
|
||||||
# get_in_square(switch_riser_offset_square, square_idx_br)(
|
get_in_square(switch_riser_offset_square, square_idx_br)(
|
||||||
# switch_riser_raw_dot
|
switch_riser_raw_dot
|
||||||
# )
|
)
|
||||||
# ),
|
),
|
||||||
# ),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -985,7 +987,7 @@ def bottom_edge_at_position(row, col):
|
||||||
|
|
||||||
|
|
||||||
def bottom_edge_iterator():
|
def bottom_edge_iterator():
|
||||||
for col in range(num_cols):
|
for col in range(NUM_COLS):
|
||||||
row = num_rows_for_col(col) - 1
|
row = num_rows_for_col(col) - 1
|
||||||
|
|
||||||
yield from bottom_edge_at_position(row, col)
|
yield from bottom_edge_at_position(row, col)
|
||||||
|
|
@ -1048,53 +1050,68 @@ def screw_insert(col, row, shape, ox, oy):
|
||||||
def screw_insert_all_shapes(shape):
|
def screw_insert_all_shapes(shape):
|
||||||
return union(
|
return union(
|
||||||
screw_insert(2, 0, shape, -5.3, 5.9),
|
screw_insert(2, 0, shape, -5.3, 5.9),
|
||||||
screw_insert(num_cols - 1, 0, shape, 6.7, 5.5),
|
screw_insert(NUM_COLS - 1, 0, shape, 6.7, 5.5),
|
||||||
screw_insert(num_cols - 1, num_rows_for_col(num_cols - 1), shape, 6.8, 14.4),
|
screw_insert(NUM_COLS - 1, num_rows_for_col(NUM_COLS - 1), shape, 6.8, 14.4),
|
||||||
screw_insert(0, 0, shape, -6.2, -8),
|
screw_insert(0, 0, shape, -6.2, -8),
|
||||||
screw_insert(1, max_num_rows + 1, shape, -9.8, 3.4),
|
screw_insert(1, MAX_NUM_ROWS + 1, shape, -9.8, 3.4),
|
||||||
screw_insert(0, max_num_rows - 1, shape, -17.4, -2),
|
screw_insert(0, MAX_NUM_ROWS - 1, shape, -17.4, -2),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
trrs_holder_size = [6.0, 11.0, 7.0]
|
TRRS_HOLDER_SIZE = [6.0, 11.0, 7.0]
|
||||||
trrs_hole_size = [2.6, 10.0]
|
TRRS_HOLE_SIZE = [2.6, 10.0]
|
||||||
trrs_holder_thickness = 2.5
|
TRRS_HOLDER_THICKNESS = 2.5
|
||||||
|
TRRS_FRONT_THICKNESS = 1.8
|
||||||
trrs_front_thickness = 1.8
|
|
||||||
|
|
||||||
|
|
||||||
def trrs_key_holder_position():
|
def trrs_key_holder_position():
|
||||||
base_place = point_on_grid(0, 0, 0, keyswitch_width / 2, 0)
|
base_place = point_on_grid(0, 0, 0, KEYSWITCH_WIDTH / 2, 0)
|
||||||
return [base_place[0] - 5, base_place[1] + 1.43, 9.0]
|
return [base_place[0] - 5, base_place[1] + 1.43, 9.0]
|
||||||
|
|
||||||
|
|
||||||
def trrs_holder():
|
def trrs_holder():
|
||||||
shape = cube(
|
shape = cube(
|
||||||
trrs_holder_size[0] + trrs_holder_thickness,
|
TRRS_HOLDER_SIZE[0] + TRRS_HOLDER_THICKNESS,
|
||||||
trrs_holder_size[1] + trrs_front_thickness,
|
TRRS_HOLDER_SIZE[1] + TRRS_FRONT_THICKNESS,
|
||||||
trrs_holder_size[2] + trrs_holder_thickness * 2,
|
TRRS_HOLDER_SIZE[2] + TRRS_HOLDER_THICKNESS * 2,
|
||||||
)
|
)
|
||||||
|
|
||||||
placed_shape = translate(
|
placed_shape = translate(
|
||||||
-trrs_holder_size[0] / 2,
|
-TRRS_HOLDER_SIZE[0] / 2,
|
||||||
-trrs_holder_size[1],
|
-TRRS_HOLDER_SIZE[1],
|
||||||
-(trrs_holder_size[2] / 2 + trrs_holder_thickness),
|
-(TRRS_HOLDER_SIZE[2] / 2 + TRRS_HOLDER_THICKNESS),
|
||||||
)(shape)
|
)(shape)
|
||||||
|
|
||||||
return translate(*trrs_key_holder_position())(placed_shape)
|
return translate(*trrs_key_holder_position())(placed_shape)
|
||||||
|
|
||||||
|
|
||||||
def trrs_holder_hole():
|
def trrs_holder_hole():
|
||||||
rect_hole = cube(*trrs_holder_size)
|
x, y, z = TRRS_HOLDER_SIZE
|
||||||
|
rect_hole = cube(x, y, z)
|
||||||
rect_hole = translate(
|
rect_hole = translate(
|
||||||
-trrs_holder_size[0] / 2, -trrs_holder_size[1], -trrs_holder_size[2] / 2,
|
-x / 2, -y - 1, -z / 2,
|
||||||
)(rect_hole)
|
)(rect_hole)
|
||||||
|
|
||||||
cylinder_hole = cylinder(*trrs_hole_size, segments=30)
|
rect2 = cube(x, y, z - 3)
|
||||||
|
rect2 = translate(
|
||||||
|
-x / 2 + 5, -y - 1, -z / 3,
|
||||||
|
)(rect2)
|
||||||
|
|
||||||
|
cylinder_hole = cylinder(*TRRS_HOLE_SIZE, segments=30)
|
||||||
cylinder_hole = rotate_x(90)(cylinder_hole)
|
cylinder_hole = rotate_x(90)(cylinder_hole)
|
||||||
cylinder_hole = translate(0, 5, 0)(cylinder_hole)
|
cylinder_hole = translate(0, 5, 0)(cylinder_hole)
|
||||||
|
|
||||||
return translate(*trrs_key_holder_position())(union(rect_hole, cylinder_hole))
|
return translate(
|
||||||
|
*trrs_key_holder_position()
|
||||||
|
)(
|
||||||
|
union(
|
||||||
|
union(
|
||||||
|
rect_hole,
|
||||||
|
rect2,
|
||||||
|
),
|
||||||
|
cylinder_hole
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
usb_holder_hole_dims = [9, 8, 3.5]
|
usb_holder_hole_dims = [9, 8, 3.5]
|
||||||
|
|
@ -1102,7 +1119,7 @@ usb_holder_thickness = 0.5
|
||||||
|
|
||||||
|
|
||||||
def usb_holder_position():
|
def usb_holder_position():
|
||||||
base_place = point_on_grid(0, 0, 0, keyswitch_width / 2, 0)
|
base_place = point_on_grid(0, 0, 0, KEYSWITCH_WIDTH / 2, 0)
|
||||||
return [base_place[0] + 8, base_place[1] + 2, 4]
|
return [base_place[0] + 8, base_place[1] + 2, 4]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1182,8 +1199,8 @@ reset_switch_body_hole = place_reset_switch_shape(unplaced_reset_switch_body_hol
|
||||||
|
|
||||||
|
|
||||||
def right_shell():
|
def right_shell():
|
||||||
global should_include_risers
|
global SHOULD_INCLUDE_RISERS
|
||||||
should_include_risers = True
|
SHOULD_INCLUDE_RISERS = True
|
||||||
|
|
||||||
cover = translate(-60, 20, 0)(cube(15, 15, 20))
|
cover = translate(-60, 20, 0)(cube(15, 15, 20))
|
||||||
|
|
||||||
|
|
@ -1192,7 +1209,7 @@ def right_shell():
|
||||||
all_switches(),
|
all_switches(),
|
||||||
connectors(),
|
connectors(),
|
||||||
case_walls(),
|
case_walls(),
|
||||||
# screw_insert_all_shapes(screw_insert_outer),
|
screw_insert_all_shapes(screw_insert_outer),
|
||||||
# all_caps(),
|
# all_caps(),
|
||||||
thumb_switches(),
|
thumb_switches(),
|
||||||
thumb_walls(),
|
thumb_walls(),
|
||||||
|
|
@ -1200,15 +1217,15 @@ def right_shell():
|
||||||
# thumb_caps(),
|
# thumb_caps(),
|
||||||
thumb_to_body_connectors(),
|
thumb_to_body_connectors(),
|
||||||
|
|
||||||
# trrs_holder(),
|
trrs_holder(),
|
||||||
# usb_holder_rim(),
|
usb_holder_rim(),
|
||||||
|
),
|
||||||
|
union(
|
||||||
|
blocker(),
|
||||||
|
screw_insert_all_shapes(screw_insert_inner),
|
||||||
|
trrs_holder_hole(),
|
||||||
|
usb_holder_hole(),
|
||||||
),
|
),
|
||||||
# union(
|
|
||||||
# blocker(),
|
|
||||||
# screw_insert_all_shapes(screw_insert_inner),
|
|
||||||
# trrs_holder_hole(),
|
|
||||||
# usb_holder_hole(),
|
|
||||||
# ),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# return intersection(cover, full_proto)
|
# return intersection(cover, full_proto)
|
||||||
|
|
@ -1233,8 +1250,8 @@ def wall_shape():
|
||||||
|
|
||||||
|
|
||||||
def model_outline():
|
def model_outline():
|
||||||
global should_include_risers
|
global SHOULD_INCLUDE_RISERS
|
||||||
should_include_risers = True
|
SHOULD_INCLUDE_RISERS = True
|
||||||
|
|
||||||
solid_bottom = project()(
|
solid_bottom = project()(
|
||||||
union(
|
union(
|
||||||
|
|
@ -1275,7 +1292,7 @@ def place_weight_hole(x, y):
|
||||||
def bottom_weight_cutouts():
|
def bottom_weight_cutouts():
|
||||||
shapes = []
|
shapes = []
|
||||||
|
|
||||||
base_point = point_on_grid(0, num_cols - 1, 0, 0, 0)
|
base_point = point_on_grid(0, NUM_COLS - 1, 0, 0, 0)
|
||||||
base_x = base_point[0] - 9
|
base_x = base_point[0] - 9
|
||||||
base_y = base_point[1] - 4
|
base_y = base_point[1] - 4
|
||||||
|
|
||||||
|
|
@ -1336,7 +1353,7 @@ def bottom_plate():
|
||||||
cylinderr1r2(screw_hole_radius, screw_hole_radius, bottom_height)
|
cylinderr1r2(screw_hole_radius, screw_hole_radius, bottom_height)
|
||||||
),
|
),
|
||||||
# bottom_weight_cutouts(),
|
# bottom_weight_cutouts(),
|
||||||
# reset_switch_body_hole,
|
reset_switch_body_hole,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -1346,8 +1363,8 @@ def left_bottom_plate():
|
||||||
|
|
||||||
|
|
||||||
def thumb_corner():
|
def thumb_corner():
|
||||||
global should_include_risers
|
global SHOULD_INCLUDE_RISERS
|
||||||
should_include_risers = False
|
SHOULD_INCLUDE_RISERS = False
|
||||||
return difference(
|
return difference(
|
||||||
union(
|
union(
|
||||||
thumb_switches(),
|
thumb_switches(),
|
||||||
|
|
|
||||||
7722
things/left.scad
7722
things/left.scad
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
7722
things/right.scad
7722
things/right.scad
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue