From 8610ca2a3c8e052e6822dbec09e66db86c07762a Mon Sep 17 00:00:00 2001 From: Joshua Shreve Date: Sat, 3 Jul 2021 15:55:16 -0400 Subject: Cadquery set to plate only in previous commit, fixed to create all geometry. Added features for screw mount positions. --- src/dactyl_manuform.py | 30 ++++++++++++++++++++++++++---- src/dactyl_manuform_cadquery.py | 39 ++++++++++++++++++++++++++++++--------- src/generate_configuration.py | 3 ++- src/run.py | 4 ++-- src/run_config.json | 11 ++++++----- 5 files changed, 66 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py index 4e58bd4..780c23a 100644 --- a/src/dactyl_manuform.py +++ b/src/dactyl_manuform.py @@ -1430,25 +1430,47 @@ def screw_insert(column, row, bottom_radius, top_radius, height): shift_up = (not (shift_right or shift_left)) and (row == 0) shift_down = (not (shift_right or shift_left)) and (row >= lastrow) + if screws_offset == 'INSIDE': + # print('Shift Inside') + shift_left_adjust = wall_base_x_thickness + shift_right_adjust = -wall_base_x_thickness/2 + shift_down_adjust = -wall_base_y_thickness/2 + shift_up_adjust = -wall_base_y_thickness/3 + + elif screws_offset == 'OUTSIDE': + print('Shift Outside') + shift_left_adjust = 0 + shift_right_adjust = wall_base_x_thickness/2 + shift_down_adjust = wall_base_y_thickness*2/3 + shift_up_adjust = wall_base_y_thickness*2/3 + + else: + # print('Shift Origin') + shift_left_adjust = 0 + shift_right_adjust = 0 + shift_down_adjust = 0 + shift_up_adjust = 0 + if shift_up: position = key_position( - list(np.array(wall_locate2(0, 1)) + np.array([0, (mount_height / 2), 0])), + list(np.array(wall_locate2(0, 1)) + np.array([0, (mount_height / 2) + shift_up_adjust, 0])), column, row, ) elif shift_down: position = key_position( - list(np.array(wall_locate2(0, -1)) - np.array([0, (mount_height / 2), 0])), + list(np.array(wall_locate2(0, -1)) - np.array([0, (mount_height / 2) + shift_down_adjust, 0])), column, row, ) elif shift_left: position = list( - np.array(left_key_position(row, 0)) + np.array(wall_locate3(-1, 0)) + np.array(left_key_position(row, 0)) + np.array(wall_locate3(-1, 0)) + np.array((shift_left_adjust,0,0)) ) else: position = key_position( - list(np.array(wall_locate2(1, 0)) + np.array([(mount_height / 2), 0, 0])), + list(np.array(wall_locate2(1, 0)) + np.array([(mount_height / 2), 0, 0]) + np.array((shift_right_adjust,0,0)) + ), column, row, ) diff --git a/src/dactyl_manuform_cadquery.py b/src/dactyl_manuform_cadquery.py index 95a1905..6514353 100644 --- a/src/dactyl_manuform_cadquery.py +++ b/src/dactyl_manuform_cadquery.py @@ -1646,29 +1646,52 @@ def screw_insert(column, row, bottom_radius, top_radius, height): shift_up = (not (shift_right or shift_left)) and (row == 0) shift_down = (not (shift_right or shift_left)) and (row >= lastrow) + if screws_offset == 'INSIDE': + # print('Shift Inside') + shift_left_adjust = wall_base_x_thickness + shift_right_adjust = -wall_base_x_thickness/2 + shift_down_adjust = -wall_base_y_thickness/2 + shift_up_adjust = -wall_base_y_thickness/3 + + elif screws_offset == 'OUTSIDE': + print('Shift Outside') + shift_left_adjust = 0 + shift_right_adjust = wall_base_x_thickness/2 + shift_down_adjust = wall_base_y_thickness*2/3 + shift_up_adjust = wall_base_y_thickness*2/3 + + else: + # print('Shift Origin') + shift_left_adjust = 0 + shift_right_adjust = 0 + shift_down_adjust = 0 + shift_up_adjust = 0 + if shift_up: position = key_position( - list(np.array(wall_locate2(0, 1)) + np.array([0, (mount_height / 2), 0])), + list(np.array(wall_locate2(0, 1)) + np.array([0, (mount_height / 2) + shift_up_adjust, 0])), column, row, ) elif shift_down: position = key_position( - list(np.array(wall_locate2(0, -1)) - np.array([0, (mount_height / 2), 0])), + list(np.array(wall_locate2(0, -1)) - np.array([0, (mount_height / 2) + shift_down_adjust, 0])), column, row, ) elif shift_left: position = list( - np.array(left_key_position(row, 0)) + np.array(wall_locate3(-1, 0)) + np.array(left_key_position(row, 0)) + np.array(wall_locate3(-1, 0)) + np.array((shift_left_adjust,0,0)) ) else: position = key_position( - list(np.array(wall_locate2(1, 0)) + np.array([(mount_height / 2), 0, 0])), + list(np.array(wall_locate2(1, 0)) + np.array([(mount_height / 2), 0, 0]) + np.array((shift_right_adjust,0,0)) + ), column, row, ) + shape = screw_insert_shape(bottom_radius, top_radius, height) shape = shape.translate([position[0], position[1], height / 2]) @@ -1870,11 +1893,10 @@ def baseplate(): -base = baseplate() -cq.exporters.export(w=base, fname=path.join(r"..", "things", save_dir, config_name + r"_plate.step"), exportType='STEP') -cq.exporters.export(w=base, fname=path.join(r"..", "things", save_dir, config_name + r"_plate.dxf"), exportType='DXF') +# base = baseplate() +# cq.exporters.export(w=base, fname=path.join(r"..", "things", save_dir, config_name + r"_plate.step"), exportType='STEP') +# cq.exporters.export(w=base, fname=path.join(r"..", "things", save_dir, config_name + r"_plate.dxf"), exportType='DXF') -""" mod_r = model_side(side="right") cq.exporters.export(w=mod_r, fname=path.join(r"..", "things", save_dir, config_name + r"_right.step"), exportType='STEP') @@ -1905,4 +1927,3 @@ if oled_mount_type == 'CLIP': fname=path.join(r"..", "things", save_dir, config_name + r"_oled_clip_test.step"), exportType='STEP') cq.exporters.export(w=union((oled_clip_mount_frame()[1], oled_clip())), fname=path.join(r"..", "things", save_dir, config_name + r"_oled_clip_assy_test.step"), exportType='STEP') -""" \ No newline at end of file diff --git a/src/generate_configuration.py b/src/generate_configuration.py index 98ef12c..7c34942 100644 --- a/src/generate_configuration.py +++ b/src/generate_configuration.py @@ -182,6 +182,7 @@ shape_config = { 'post_size': 0.1, # post_adj': post_size / 2 'post_adj': 0, + 'screws_offset': 'INSIDE', #'OUTSIDE', 'INSIDE', 'ORIGINAL' ################################### ## Controller Mount / Connectors ## @@ -196,7 +197,7 @@ shape_config = { 'external_holder_height': 12.5, 'external_holder_width': 28.75, - 'external_holder_xoffset': -5.0, + 'external_holder_xoffset': -5.0, # Offset is from the top inner corner of the top inner key. diff --git a/src/run.py b/src/run.py index 2c61511..edf3d44 100644 --- a/src/run.py +++ b/src/run.py @@ -5,8 +5,8 @@ -ENGINE = 'solid' -# ENGINE = 'cadquery' +# ENGINE = 'solid' +ENGINE = 'cadquery' if ENGINE == 'solid': exec(open('dactyl_manuform.py').read()) diff --git a/src/run_config.json b/src/run_config.json index ae63aab..396dd70 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, @@ -71,7 +71,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, @@ -158,7 +158,8 @@ "web_thickness": 4.0, "post_size": 0.1, "post_adj": 0, - "controller_mount_type": "RJ9_USB_WALL", + "screws_offset": "INSIDE", + "controller_mount_type": "EXTERNAL", "external_holder_height": 12.5, "external_holder_width": 28.75, "external_holder_xoffset": -5.0, -- cgit v1.2.3