summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoshua Shreve <j.a.shreve@gmail.com>2021-08-01 22:37:41 -0400
committerJoshua Shreve <j.a.shreve@gmail.com>2021-08-01 22:37:41 -0400
commit99322cc7501012444597f223fa26a991cc661e03 (patch)
tree200f8a3cdb72507c529f8e734141ab8807a36e8d /src
parent8409bdb6187a6d6e7def10b7fe7bded18e546e43 (diff)
Update to add release builds. Should make a large number of prebuilts for people to look at. Also fixed minor issues.
Diffstat (limited to 'src')
-rw-r--r--src/dactyl_manuform.py14
-rw-r--r--src/generate_configuration.py17
-rw-r--r--src/helpers_blender.py133
-rw-r--r--src/model_builder.py179
-rw-r--r--src/run_config.json23
5 files changed, 242 insertions, 124 deletions
diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py
index 527d43b..bb164b5 100644
--- a/src/dactyl_manuform.py
+++ b/src/dactyl_manuform.py
@@ -141,13 +141,13 @@ teensy_holder_height = 6 + teensy_width
-wire_post_height = 7
-wire_post_overhang = 3.5
-wire_post_diameter = 2.6
-
-screw_insert_height = 3.8
-screw_insert_bottom_radius = 5.31 / 2
-screw_insert_top_radius = 5.1 / 2
+# wire_post_height = 7
+# wire_post_overhang = 3.5
+# wire_post_diameter = 2.6
+#
+# screw_insert_height = 3.8
+# screw_insert_bottom_radius = 5.31 / 2
+# screw_insert_top_radius = 5.1 / 2
# save_path = path.join("..", "things", save_dir)
diff --git a/src/generate_configuration.py b/src/generate_configuration.py
index e661e84..e2d71b0 100644
--- a/src/generate_configuration.py
+++ b/src/generate_configuration.py
@@ -18,7 +18,7 @@ shape_config = {
'save_dir': '.',
'config_name': "DM",
- 'show_caps': True,
+ 'show_caps': False,
'nrows': 5, #5, # key rows
'ncols': 6, #6, # key columns
@@ -105,8 +105,8 @@ shape_config = {
# '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.
# 'HS_NOTCH' = hot swap underside with notch. Does not generate properly. Hot swap step needs to be modified.
- 'plate_style': 'HS_NUB',
- # 'plate_style': 'HS_NOTCH',
+ # 'plate_style': 'NUB',
+ 'plate_style': 'NOTCH',
'hole_keyswitch_height': 14.0,
'hole_keyswitch_width': 14.0,
@@ -144,7 +144,7 @@ shape_config = {
# 'CLIP' = Features to set the OLED in a frame a snap a bezel down to hold it in place.
'oled_mount_type': 'CLIP',
- 'oled_center_row': 1.5, # if not None, this will override the oled_mount_location_xyz and oled_mount_rotation_xyz settings
+ 'oled_center_row': 1.25, # if not None, this will override the oled_mount_location_xyz and oled_mount_rotation_xyz settings
'oled_translation_offset': (0, 0, 4), # Z offset tweaks are expected depending on curvature and OLED mount choice.
'oled_rotation_offset': (0, 0, 0),
@@ -228,6 +228,15 @@ shape_config = {
'post_adj': 0,
'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,
+
+ # Does anyone even use these? I think they just get in the way.
+ 'wire_post_height': 7,
+ 'wire_post_overhang': 3.5,
+ 'wire_post_diameter': 2.6,
+
###################################
## Controller Mount / Connectors ##
###################################
diff --git a/src/helpers_blender.py b/src/helpers_blender.py
new file mode 100644
index 0000000..470d5e8
--- /dev/null
+++ b/src/helpers_blender.py
@@ -0,0 +1,133 @@
+import solid as sl
+
+debug_trace = False
+
+def debugprint(info):
+ if debug_trace:
+ print(info)
+
+def box(width, height, depth):
+ return sl.cube([width, height, depth], center=True)
+
+
+def cylinder(radius, height, segments=100):
+ return sl.cylinder(r=radius, h=height, segments=segments, center=True)
+
+
+def sphere(radius):
+ return sl.sphere(radius)
+
+
+def cone(r1, r2, height):
+ return sl.cylinder(r1=r1, r2=r2, h=height) # , center=True)
+
+
+def rotate(shape, angle):
+ return sl.rotate(angle)(shape)
+
+
+def translate(shape, vector):
+ return sl.translate(tuple(vector))(shape)
+
+
+def mirror(shape, plane=None):
+ debugprint('mirror()')
+ planes = {
+ 'XY': [0, 0, 1],
+ 'YX': [0, 0, -1],
+ 'XZ': [0, 1, 0],
+ 'ZX': [0, -1, 0],
+ 'YZ': [1, 0, 0],
+ 'ZY': [-1, 0, 0],
+ }
+ return sl.mirror(planes[plane])(shape)
+
+
+def union(shapes):
+ debugprint('union()')
+ shape = None
+ for item in shapes:
+ if shape is None:
+ shape = item
+ else:
+ shape += item
+ return shape
+
+
+def add(shapes):
+ debugprint('union()')
+ shape = None
+ for item in shapes:
+ if shape is None:
+ shape = item
+ else:
+ shape += item
+ return shape
+
+
+def difference(shape, shapes):
+ debugprint('difference()')
+ for item in shapes:
+ shape -= item
+ return shape
+
+
+def intersect(shape1, shape2):
+ return sl.intersect()(shape1, shape2)
+
+
+def hull_from_points(points):
+ return sl.hull()(*points)
+
+
+def hull_from_shapes(shapes, points=None):
+ hs = []
+ if points is not None:
+ hs.extend(points)
+ if shapes is not None:
+ hs.extend(shapes)
+ return sl.hull()(*hs)
+
+
+def tess_hull(shapes, sl_tol=.5, sl_angTol=1):
+ return sl.hull()(*shapes)
+
+
+def triangle_hulls(shapes):
+ debugprint('triangle_hulls()')
+ hulls = []
+ for i in range(len(shapes) - 2):
+ hulls.append(hull_from_shapes(shapes[i: (i + 3)]))
+
+ return union(hulls)
+
+
+def polyline(point_list):
+ return sl.polygon(point_list)
+
+
+# def project_to_plate():
+# square = cq.Workplane('XY').rect(1000, 1000)
+# for wire in square.wires().objects:
+# plane = cq.Workplane('XY').add(cq.Face.makeFromWires(wire))
+
+def extrude_poly(outer_poly, inner_polys=None, height=1):
+ if inner_polys is not None:
+ return sl.linear_extrude(height=height, twist=0, convexity=0, center=True)(outer_poly, *inner_polys)
+ else:
+ return sl.linear_extrude(height=height, twist=0, convexity=0, center=True)(outer_poly)
+
+
+def import_file(fname):
+ print("IMPORTING FROM {}".format(fname))
+ return sl.import_(fname + ".stl")
+
+
+def export_file(shape, fname):
+ print("EXPORTING TO {}".format(fname))
+ sl.scad_render_to_file(shape, fname + ".scad")
+
+
+def export_dxf(shape, fname):
+ print("NO DXF EXPORT FOR SOLID".format(fname))
+ pass \ No newline at end of file
diff --git a/src/model_builder.py b/src/model_builder.py
index ef4824c..d8a9fac 100644
--- a/src/model_builder.py
+++ b/src/model_builder.py
@@ -8,127 +8,96 @@ ENGINE = 'solid'
base = shape_config
-configurations = [
+config_options = [
{
- 'config_name': '4x5_OLED_CtrlTray',
- 'save_dir': '4x5_OLED_CtrlTray',
- 'nrows': 4, # key rows
- 'ncols': 5, # key columns
- 'oled_mount_type': 'CLIP',
- 'controller_mount_type': 'EXTERNAL',
+ 'name': '{}x{}', 'vars': ['nrows', 'ncols'],
+ 'vals':[(4, 5), (5, 6)],
+ # 'vals': [(4, 5), (4, 6), (5, 6), (6, 6)],
},
{
- 'config_name': '4x6_OLED_CtrlTray',
- 'save_dir': '4x6_OLED_CtrlTray',
- 'nrows': 4, # key rows
- 'ncols': 6, # key columns
- 'oled_mount_type': 'CLIP',
- 'controller_mount_type': 'EXTERNAL',
+ 'name': '{}PLT', 'vars': ['plate_style'],
+ 'vals': ['NOTCH', 'HS_NOTCH'],
+ # 'vals': ['NUB', 'NOTCH', 'HS_NUB', 'HS_NOTCH'],
},
{
- 'config_name': '5x6_OLED_CtrlTray',
- 'save_dir': '5x6_OLED_CtrlTray',
- 'nrows': 5, # key rows
- 'ncols': 6, # key columns
- 'oled_mount_type': 'CLIP',
- 'controller_mount_type': 'EXTERNAL',
+ 'name': '{}TMB', 'vars': ['thumb_style'],
+ 'vals': ['DEFAULT', 'MINIDOX'],
+ 'val_names': ['DEF', 'MDOX']
+ # 'vals': ['DEFAULT', 'MINI', 'CARBONFET', 'MINIDOX'],
+ # 'val_names': ['DEF', 'MINI', 'CF', 'MDOX']
},
{
- 'config_name': '6x6_OLED_CtrlTray',
- 'save_dir': '6x6_OLED_CtrlTray',
- 'nrows': 6, # key rows
- 'ncols': 6, # key columns
- 'oled_mount_type': 'CLIP',
- 'controller_mount_type': 'EXTERNAL',
+ 'name': '{}', 'vars': ['oled_mount_type'],
+ 'vals': ['CLIP', 'NONE'],
+ 'val_names': ['OLED', 'NOLED']
},
{
- 'config_name': '4x5_CtrlTray',
- 'save_dir': '4x5_CtrlTray',
- 'nrows': 4, # key rows
- 'ncols': 5, # key columns
- 'oled_mount_type': None,
- 'controller_mount_type': 'EXTERNAL',
+ 'name': '{}CTRL', 'vars': ['controller_mount_type'],
+ 'vals': ['EXTERNAL', 'RJ9_USB_WALL'],
+ 'val_names': ['EXT', 'DEF'],
},
- {
- 'config_name': '4x6_CtrlTray',
- 'save_dir': '4x6_CtrlTray',
- 'nrows': 4, # key rows
- 'ncols': 6, # key columns
- 'oled_mount_type': None,
- 'controller_mount_type': 'EXTERNAL',
- },
- {
- 'config_name': '5x6_CtrlTray',
- 'save_dir': '5x6_CtrlTray',
- 'nrows': 5, # key rows
- 'ncols': 6, # key columns
- 'oled_mount_type': None,
- 'controller_mount_type': 'EXTERNAL',
- },
- {
- 'config_name': '6x6_CtrlTray',
- 'save_dir': '6x6_CtrlTray',
- 'nrows': 6, # key rows
- 'ncols': 6, # key columns
- 'oled_mount_type': None,
- 'controller_mount_type': 'EXTERNAL',
- },
- {
- 'config_name': '4x5_Basic',
- 'save_dir': '4x5_Basic',
- 'nrows': 4, # key rows
- 'ncols': 5, # key columns
- 'oled_mount_type': None,
- 'controller_mount_type': 'RJ9_USB_WALL',
- },
- {
- 'config_name': '4x6_Basic',
- 'save_dir': '4x6_Basic',
- 'nrows': 4, # key rows
- 'ncols': 6, # key columns
- 'oled_mount_type': None,
- 'controller_mount_type': 'RJ9_USB_WALL',
- },
- {
- 'config_name': '5x6_Basic',
- 'save_dir': '5x6_Basic',
- 'nrows': 5, # key rows
- 'ncols': 6, # key columns
- 'oled_mount_type': None,
- 'controller_mount_type': 'RJ9_USB_WALL',
- },
- {
- 'config_name': '6x6_Basic',
- 'save_dir': '6x6_Basic',
- 'nrows': 6, # key rows
- 'ncols': 6, # key columns
- 'oled_mount_type': None,
- 'controller_mount_type': 'RJ9_USB_WALL',
- }
]
+def create_config(config_options):
+ configurations = [{
+ 'config_name': 'DM',
+ 'save_dir': 'DM',
+ }]
+ config_options = copy.deepcopy(config_options)
+ for opt in config_options:
+ new_configurations = []
+ for config in configurations:
+ # config['vals'] = []
+ for i_vals, vals in enumerate(opt['vals']):
+ temp_opt = copy.deepcopy(opt)
+ new_config = copy.deepcopy(config)
+ if len(temp_opt['vars']) == 1:
+ vals=[vals]
+ if 'val_names' in temp_opt:
+ temp_opt['val_names'][i_vals] = [temp_opt['val_names'][i_vals]]
+ for i_val, val in enumerate(vals):
+ new_config[opt['vars'][i_val]] = val
+
+
+ if 'val_names' in temp_opt:
+ n_input = temp_opt['val_names'][i_vals]
+ else:
+ n_input = vals
+
+ new_config['config_name'] += "_" + temp_opt['name'].format(*n_input)
+ new_config['save_dir'] = new_config['config_name']
+ new_configurations.append(new_config)
+ configurations = new_configurations
+
+ return configurations
-# ENGINES = ['solid', 'cadquery']
-ENGINES = ['cadquery']
-init = True
-for config in configurations:
- shape_config = copy.deepcopy(base)
- for item in config:
- shape_config[item] = config[item]
- for engine in ENGINES:
- shape_config['ENGINE'] = engine
- with open('run_config.json', mode='w') as fid:
- json.dump(shape_config, fid, indent=4)
+def build_release(base, configurations, engines=('solid', 'cadquery')):
+ init = True
+ for config in configurations:
+ shape_config = copy.deepcopy(base)
+ for item in config:
+ shape_config[item] = config[item]
+
+ for engine in engines:
+ shape_config['ENGINE'] = engine
+ with open('run_config.json', mode='w') as fid:
+ json.dump(shape_config, fid, indent=4)
+
+ if init:
+ import dactyl_manuform as dactyl_manuform
+ dactyl_manuform.run()
+ init = False
+ else:
+ importlib.reload(dactyl_manuform)
+ dactyl_manuform.run()
- if init:
- import dactyl_manuform as dactyl_manuform
- dactyl_manuform.run()
- init = False
- else:
- importlib.reload(dactyl_manuform)
- dactyl_manuform.run()
+if __name__ == '__main__':
+ configurations = create_config(config_options)
+ ENGINES = ['solid', 'cadquery']
+ # ENGINES = ['solid']
+ build_release(base, configurations, ENGINES)
diff --git a/src/run_config.json b/src/run_config.json
index 7a22860..627b536 100644
--- a/src/run_config.json
+++ b/src/run_config.json
@@ -1,10 +1,10 @@
{
"ENGINE": "solid",
- "save_dir": ".",
- "config_name": "DM",
- "show_caps": true,
- "nrows": 5,
- "ncols": 6,
+ "save_dir": "DM_4x5_NOTCHPLT_DEFTMB_NOLED_EXTCTRL",
+ "config_name": "DM_4x5_NOTCHPLT_DEFTMB_NOLED_EXTCTRL",
+ "show_caps": false,
+ "nrows": 4,
+ "ncols": 5,
"alpha": 0.26179916666666664,
"beta": 0.08726638888888888,
"centercol": 3,
@@ -21,6 +21,7 @@
"keyboard_z_offset": 11,
"thumb_style": "DEFAULT",
"default_1U_cluster": true,
+ "minidox_Usize": 1.6,
"thumb_plate_tr_rotation": 0.0,
"thumb_plate_tl_rotation": 0.0,
"thumb_plate_mr_rotation": 0.0,
@@ -80,7 +81,7 @@
"undercut_keyswitch_width": 14.0,
"notch_width": 5.0,
"sa_profile_key_height": 12.7,
- "sa_length": 18.25,
+ "sa_length": 18.5,
"sa_double_length": 37.5,
"plate_thickness": 5.1,
"plate_rim": 2.0,
@@ -89,8 +90,8 @@
"undercut_transition": 0.2,
"plate_file": null,
"plate_offset": 0.0,
- "oled_mount_type": "CLIP",
- "oled_center_row": 1.5,
+ "oled_mount_type": "NONE",
+ "oled_center_row": 1.25,
"oled_translation_offset": [
0,
0,
@@ -194,6 +195,12 @@
"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,
+ "wire_post_height": 7,
+ "wire_post_overhang": 3.5,
+ "wire_post_diameter": 2.6,
"controller_mount_type": "EXTERNAL",
"external_holder_height": 12.5,
"external_holder_width": 28.75,