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