From eeccc3c8c73000775c138c0dc7ff2c662d43228a Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Fri, 9 Jul 2021 15:33:49 -0400 Subject: Fixed imports. Resolved issues with IDE root directories to allow scripts to operate independently. --- src/dactyl_manuform.py | 8 ++++---- src/generate_configuration.py | 12 ++++++++++++ src/model_builder.py | 4 ++-- src/run_config.json | 12 ++++++------ 4 files changed, 24 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 1265d5b..f7e0dac 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -19,11 +19,11 @@ debug_exports = False # if __name__=='__main__': # -from src.generate_configuration import * +from generate_configuration import * save_config() ## IMPORT DEFAULT CONFIG IN CASE NEW PARAMETERS EXIST -import src.generate_configuration as cfg +import generate_configuration as cfg for item in cfg.shape_config: locals()[item] = cfg.shape_config[item] @@ -118,9 +118,9 @@ def column_offset(column: int) -> list: #################################################### if ENGINE == 'cadquery': - from src.helpers_cadquery import * + from helpers_cadquery import * else: - from src.helpers_solid import * + from helpers_solid import * #################################################### # END HELPER FUNCTIONS diff --git a/src/generate_configuration.py b/src/generate_configuration.py index e5dd966..18dbee6 100644 --- a/src/generate_configuration.py +++ b/src/generate_configuration.py @@ -266,5 +266,17 @@ def save_config(): with open('run_config.json', mode='w') as fid: json.dump(shape_config, fid, indent=4) +def update_config(fname, fname_out=None): + if fname_out is None: + fname_out == "updated_config.json" + # Open existing config, update with any new parameters, and save to updated_config.json + with open(fname, mode='r') as fid: + last_shape_config = json.load(fid) + shape_config.update(last_shape_config) + + with open(fname_out, mode='w') as fid: + json.dump(shape_config, fid, indent=4) + + if __name__ == '__main__': save_config() diff --git a/src/model_builder.py b/src/model_builder.py index f181655..fd611ba 100644 --- a/src/model_builder.py +++ b/src/model_builder.py @@ -1,7 +1,7 @@ import os import copy import importlib -from src.generate_configuration import * +from generate_configuration import * ENGINE = 'solid' # ENGINE = 'cadquery' @@ -119,7 +119,7 @@ for config in configurations: json.dump(shape_config, fid, indent=4) if init: - import src.dactyl_manuform as dactyl_manuform + import dactyl_manuform as dactyl_manuform else: importlib.reload(dactyl_manuform) diff --git a/src/run_config.json b/src/run_config.json index f87eaa1..4085d2a 100644 --- a/src/run_config.json +++ b/src/run_config.json @@ -1,8 +1,8 @@ { - "save_dir": "6x6_Basic", - "config_name": "6x6_Basic", + "save_dir": ".", + "config_name": "DM", "show_caps": false, - "nrows": 6, + "nrows": 5, "ncols": 6, "alpha": 0.26179916666666664, "beta": 0.08726638888888888, @@ -77,7 +77,7 @@ "undercut_transition": 0.2, "plate_file": null, "plate_offset": 0.0, - "oled_mount_type": null, + "oled_mount_type": "CLIP", "oled_configurations": { "UNDERCUT": { "oled_mount_width": 15.0, @@ -165,7 +165,7 @@ "post_size": 0.1, "post_adj": 0, "screws_offset": "INSIDE", - "controller_mount_type": "RJ9_USB_WALL", + "controller_mount_type": "EXTERNAL", "external_holder_height": 12.5, "external_holder_width": 28.75, "external_holder_xoffset": -5.0, @@ -175,7 +175,7 @@ "base_rim_thickness": 5.0, "screw_cbore_diameter": 4.0, "screw_cbore_depth": 2.0, - "plate_holes": true, + "plate_holes": false, "plate_holes_xy_offset": [ 0.0, 0.0 -- cgit v1.2.3