Skip to content

Commit

Permalink
Key plate screw holes and added key plate notches for snapping in swi…
Browse files Browse the repository at this point in the history
…tches rather than a giant undercut.
  • Loading branch information
joshreve committed Jul 8, 2021
1 parent 7f9e638 commit 7746b12
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 25 deletions.
80 changes: 63 additions & 17 deletions src/dactyl_manuform.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ def rad2deg(rad: float) -> float:
return rad * 180 / pi

ENGINE = 'solid'
ENGINE = 'cadquery'
# ENGINE = 'cadquery'
debug_exports = False

# if __name__=='__main__':
#

from src.generate_configuration import *
save_config()

## IMPORT DEFAULT CONFIG IN CASE NEW PARAMETERS EXIST
import src.generate_configuration as cfg
Expand Down Expand Up @@ -50,20 +51,20 @@ def rad2deg(rad: float) -> float:
if plate_style in ['NUB', 'HS_NUB']:
keyswitch_height = nub_keyswitch_height
keyswitch_width = nub_keyswitch_width
elif plate_style in ['UNDERCUT', 'HS_UNDERCUT']:
elif plate_style in ['UNDERCUT', 'HS_UNDERCUT', 'NOTCH', 'HS_NOTCH']:
keyswitch_height = undercut_keyswitch_height
keyswitch_width = undercut_keyswitch_width
else:
keyswitch_height = hole_keyswitch_height
keyswitch_width = hole_keyswitch_width

if plate_style in ['HS_UNDERCUT', 'HS_NUB', 'HS_HOLE']:
if 'HS_' in plate_style:
symmetry = "asymmetric"
plate_file = path.join("..", "src", r"hot_swap_plate")
plate_offset = 0.0

mount_width = keyswitch_width + 3
mount_height = keyswitch_height + 3
mount_width = keyswitch_width + 2 * plate_rim
mount_height = keyswitch_height + 2 * plate_rim
mount_thickness = plate_thickness

if oled_mount_type is not None:
Expand Down Expand Up @@ -418,6 +419,7 @@ def export_dxf(shape, fname):
####################################################



def single_plate(cylinder_segments=100, side="right"):

if plate_style in ['NUB', 'HS_NUB']:
Expand Down Expand Up @@ -448,17 +450,32 @@ def single_plate(cylinder_segments=100, side="right"):
plate = box(mount_width, mount_height, mount_thickness)
plate = translate(plate, (0.0, 0.0, mount_thickness / 2.0))

shape_cut = box(keyswitch_width, keyswitch_height, mount_thickness * 2)
shape_cut = translate(shape_cut, (0.0, 0.0, mount_thickness))
shape_cut = box(keyswitch_width, keyswitch_height, mount_thickness * 2 +.02)
shape_cut = translate(shape_cut, (0.0, 0.0, mount_thickness-.01))

plate = difference(plate, [shape_cut])

if plate_style in ['UNDERCUT', 'HS_UNDERCUT']:
undercut = box(
keyswitch_width + 2 * clip_undercut,
keyswitch_height + 2 * clip_undercut,
mount_thickness
)
if plate_style in ['UNDERCUT', 'HS_UNDERCUT', 'NOTCH', 'HS_NOTCH']:
if plate_style in ['UNDERCUT', 'HS_UNDERCUT']:
undercut = box(
keyswitch_width + 2 * clip_undercut,
keyswitch_height + 2 * clip_undercut,
mount_thickness
)

if plate_style in ['NOTCH', 'HS_NOTCH']:
undercut = box(
notch_width,
keyswitch_height + 2 * clip_undercut,
mount_thickness
)
undercut = union([undercut,
box(
keyswitch_width + 2 * clip_undercut,
notch_width,
mount_thickness
)
])

undercut = translate(undercut, (0.0, 0.0, -clip_thickness + mount_thickness / 2.0))

Expand All @@ -472,6 +489,32 @@ def single_plate(cylinder_segments=100, side="right"):
socket = translate(socket, [0, 0, plate_thickness + plate_offset])
plate = union([plate, socket])


if plate_holes:
half_width = plate_holes_width/2.
half_height = plate_holes_height/2.
x_off = plate_holes_xy_offset[0]
y_off = plate_holes_xy_offset[1]
holes = [
translate(
cylinder(radius=plate_holes_diameter/2, height=plate_holes_depth+.01),
(x_off+half_width, y_off+half_height, plate_holes_depth/2-.01)
),
translate(
cylinder(radius=plate_holes_diameter / 2, height=plate_holes_depth+.01),
(x_off-half_width, y_off+half_height, plate_holes_depth/2-.01)
),
translate(
cylinder(radius=plate_holes_diameter / 2, height=plate_holes_depth+.01),
(x_off-half_width, y_off-half_height, plate_holes_depth/2-.01)
),
translate(
cylinder(radius=plate_holes_diameter / 2, height=plate_holes_depth+.01),
(x_off+half_width, y_off-half_height, plate_holes_depth/2-.01)
),
]
plate = difference(plate, holes)

if side == "left":
plate = mirror(plate, 'YZ')

Expand Down Expand Up @@ -2565,7 +2608,7 @@ def screw_insert_thumb(bottom_radius, top_radius, height):

else:
position = thumborigin()
position = list(np.array(position) + np.array([-25, -61, 0]))
position = list(np.array(position) + np.array([-21, -58, 0]))
position[2] = 0

shape = screw_insert_shape(bottom_radius, top_radius, height)
Expand Down Expand Up @@ -2813,9 +2856,12 @@ def run():


base = baseplate()
export_file(shape=base, fname=path.join(r"..", "things", save_dir, config_name + r"_plate"))
export_dxf(shape=base, fname=path.join(r"..", "things", save_dir, config_name + r"_plate"))
export_file(shape=base, fname=path.join(r"..", "things", save_dir, config_name + r"_right_plate"))
export_dxf(shape=base, fname=path.join(r"..", "things", save_dir, config_name + r"_right_plate"))

lbase = mirror(base, 'YZ')
export_file(shape=lbase, fname=path.join(r"..", "things", save_dir, config_name + r"_left_plate"))
export_dxf(shape=lbase, fname=path.join(r"..", "things", save_dir, config_name + r"_left_plate"))

if oled_mount_type == 'UNDERCUT':
export_file(shape=oled_undercut_mount_frame()[1], fname=path.join(r"..", "things", save_dir, config_name + r"_oled_undercut_test"))
Expand Down
23 changes: 19 additions & 4 deletions src/generate_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,27 @@
# 'NUB' = original side nubs.
# 'UNDERCUT' = snap fit undercut. May require CLIP_THICKNESS and possibly CLIP_UNDERCUT tweaking
# and/or filing to get proper snap.
# 'NOTCH' = snap fit undercut only near switch clip. May require CLIP_THICKNESS and possibly CLIP_UNDERCUT
# tweaking and/or filing to get proper snap.
# 'HS_NUB' = hot swap underside with nubs.
# 'HS_UNDERCUT' = hot swap underside with undercut. Does not generate properly. Hot swap step needs to be modified.
'plate_style': 'UNDERCUT',
# 'HS_NOTCH' = hot swap underside with notch. Does not generate properly. Hot swap step needs to be modified.
'plate_style': 'NOTCH',

'hole_keyswitch_height': 14.0,
'hole_keyswitch_width': 14.0,

'nub_keyswitch_height': 14.4,
'nub_keyswitch_width': 14.4,

'undercut_keyswitch_height': 14.4,
'undercut_keyswitch_width': 14.4,
'undercut_keyswitch_height': 14.0,
'undercut_keyswitch_width': 14.0,
'notch_width': 5.0, # If using notch, it is identical to undecut, but only locally by the switch clip

'sa_profile_key_height': 12.7,
'plate_thickness': 4,
'plate_thickness': 4+1.1,

'plate_rim': 1.5 + 0.5,
# Undercut style dimensions
'clip_thickness': 1.4,
'clip_undercut': 1.0,
Expand Down Expand Up @@ -227,6 +232,16 @@

# Offset is from the top inner corner of the top inner key.

###################################
## EXPERIMENTAL
###################################
'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_depth': 20.0,

###################################
## COLUMN OFFSETS
####################################
Expand Down
19 changes: 15 additions & 4 deletions src/run_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,17 @@
17.5
],
"fixed_tenting": 0.0,
"plate_style": "UNDERCUT",
"plate_style": "NOTCH",
"hole_keyswitch_height": 14.0,
"hole_keyswitch_width": 14.0,
"nub_keyswitch_height": 14.4,
"nub_keyswitch_width": 14.4,
"undercut_keyswitch_height": 14.4,
"undercut_keyswitch_width": 14.4,
"undercut_keyswitch_height": 14.0,
"undercut_keyswitch_width": 14.0,
"notch_width": 5.0,
"sa_profile_key_height": 12.7,
"plate_thickness": 4,
"plate_thickness": 5.1,
"plate_rim": 2.0,
"clip_thickness": 1.4,
"clip_undercut": 1.0,
"undercut_transition": 0.2,
Expand Down Expand Up @@ -173,6 +175,15 @@
"base_rim_thickness": 5.0,
"screw_cbore_diameter": 4.0,
"screw_cbore_depth": 2.0,
"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_depth": 20.0,
"column_offsets": [
[
0,
Expand Down

0 comments on commit 7746b12

Please sign in to comment.