summaryrefslogtreecommitdiff
path: root/src/model_builder.py
diff options
context:
space:
mode:
authorjoshreve <j.a.shreve@gmail.com>2021-07-03 13:01:28 -0400
committerjoshreve <j.a.shreve@gmail.com>2021-07-03 13:01:28 -0400
commit1866c114f144b6fc828716b00782ec8d516c3e41 (patch)
treeca73212b7e93b7f81ffc777ad5095c4418025db4 /src/model_builder.py
parent4c634cc70cb1c97b5b332011548c32f6bb21f3d2 (diff)
Large change to things directory with pregenerated files in multiple configurations. Implemented prebuild generator to automatically create pregenerated files.
Diffstat (limited to 'src/model_builder.py')
-rw-r--r--src/model_builder.py134
1 files changed, 134 insertions, 0 deletions
diff --git a/src/model_builder.py b/src/model_builder.py
new file mode 100644
index 0000000..0a6a6a8
--- /dev/null
+++ b/src/model_builder.py
@@ -0,0 +1,134 @@
+import os
+import copy
+import importlib
+from src.generate_configuration import *
+
+ENGINE = 'solid'
+# ENGINE = 'cadquery'
+
+base = shape_config
+
+configurations = [
+ {
+ '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',
+ },
+ {
+ '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',
+ },
+ {
+ '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',
+ },
+ {
+ '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',
+ },
+ {
+ 'config_name': '4x5_CtrlTray',
+ 'save_dir': '4x5_CtrlTray',
+ 'nrows': 4, # key rows
+ 'ncols': 5, # key columns
+ 'oled_mount_type': None,
+ 'controller_mount_type': 'EXTERNAL',
+ },
+ {
+ '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': 'CLIP',
+ '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': 'EXTERNAL',
+ },
+ {
+ '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',
+ }
+]
+
+init = True
+
+for config in configurations:
+ shape_config = copy.deepcopy(base)
+ for item in config:
+ shape_config[item] = config[item]
+
+
+ with open('run_config.json', mode='w') as fid:
+ json.dump(shape_config, fid, indent=4)
+
+ for ENGINE in ['solid', 'cadquery']:
+ if ENGINE == 'solid':
+ if init:
+ import src.dactyl_manuform as dactyl_manuform
+ else:
+ importlib.reload(dactyl_manuform)
+
+ if ENGINE == 'cadquery':
+ if init:
+ import src.dactyl_manuform_cadquery as dactyl_manuform_cadquery
+ else:
+ importlib.reload(dactyl_manuform_cadquery)
+
+ init = False