summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dactyl_manuform.py37
-rw-r--r--src/generate_configuration.py7
-rw-r--r--src/helpers_cadquery.py7
-rw-r--r--src/helpers_solid.py1
4 files changed, 30 insertions, 22 deletions
diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py
index af54e68..69098e6 100644
--- a/src/dactyl_manuform.py
+++ b/src/dactyl_manuform.py
@@ -38,6 +38,11 @@ except Exception:
# ENGINE = 'cadquery'
print('Setting Current Engine = {}'.format(ENGINE))
+if save_dir in ['', None, '.']:
+ save_path = os.path.join(r"..", "things")
+else:
+ save_path = os.path.join(r"..", "things", save_dir)
+
###############################################
# END EXTREMELY UGLY BOOTSTRAP
###############################################
@@ -136,9 +141,9 @@ screw_insert_bottom_radius = 5.31 / 2
screw_insert_top_radius = 5.1 / 2
-spath = path.join("..", "things", save_dir)
-if not path.isdir(spath):
- os.mkdir(spath)
+# save_path = path.join("..", "things", save_dir)
+if not path.isdir(save_path):
+ os.mkdir(save_path)
def column_offset(column: int) -> list:
@@ -2634,40 +2639,40 @@ def baseplate():
def run():
mod_r = model_side(side="right")
- export_file(shape=mod_r, fname=path.join(r"..", "things", save_dir, config_name + r"_right"))
+ export_file(shape=mod_r, fname=path.join(save_path, config_name + r"_right"))
if symmetry == "asymmetric":
mod_l = model_side(side="left")
- export_file(shape=mod_l, fname=path.join(r"..", "things", save_dir, config_name + r"_left"))
+ export_file(shape=mod_l, fname=path.join(save_path, config_name + r"_left"))
else:
- export_file(shape=mirror(mod_r, 'YZ'), fname=path.join(r"..", "things", save_dir, config_name + r"_left"))
+ export_file(shape=mirror(mod_r, 'YZ'), fname=path.join(save_path, config_name + r"_left"))
base = baseplate()
- 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"))
+ export_file(shape=base, fname=path.join(save_path, config_name + r"_right_plate"))
+ export_dxf(shape=base, fname=path.join(save_path, 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"))
+ export_file(shape=lbase, fname=path.join(save_path, config_name + r"_left_plate"))
+ export_dxf(shape=lbase, fname=path.join(save_path, 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"))
+ export_file(shape=oled_undercut_mount_frame()[1], fname=path.join(save_path, config_name + r"_oled_undercut_test"))
if oled_mount_type == 'SLIDING':
- export_file(shape=oled_sliding_mount_frame()[1], fname=path.join(r"..", "things", save_dir, config_name + r"_oled_sliding_test"))
+ export_file(shape=oled_sliding_mount_frame()[1], fname=path.join(save_path, config_name + r"_oled_sliding_test"))
if oled_mount_type == 'CLIP':
oled_mount_location_xyz = (0.0, 0.0, -oled_mount_depth / 2)
oled_mount_rotation_xyz = (0.0, 0.0, 0.0)
- export_file(shape=oled_clip(), fname=path.join(r"..", "things", save_dir, config_name + r"_oled_clip"))
+ export_file(shape=oled_clip(), fname=path.join(save_path, config_name + r"_oled_clip"))
export_file(shape=oled_clip_mount_frame()[1],
- fname=path.join(r"..", "things", save_dir, config_name + r"_oled_clip_test"))
+ fname=path.join(save_path, config_name + r"_oled_clip_test"))
export_file(shape=union((oled_clip_mount_frame()[1], oled_clip())),
- fname=path.join(r"..", "things", save_dir, config_name + r"_oled_clip_assy_test"))
+ fname=path.join(save_path, config_name + r"_oled_clip_assy_test"))
# base = baseplate()
-# export_file(shape=base, fname=path.join(r"..", "things", save_dir, config_name + r"_plate"))
+# export_file(shape=base, fname=path.join(save_path, config_name + r"_plate"))
if __name__ == '__main__':
run() \ No newline at end of file
diff --git a/src/generate_configuration.py b/src/generate_configuration.py
index 6904352..b8f86ad 100644
--- a/src/generate_configuration.py
+++ b/src/generate_configuration.py
@@ -29,7 +29,7 @@ shape_config = {
'centerrow_offset': 3, # rows from max, controls front_back tilt
'tenting_angle': pi / 12.0, # or, change this for more precise tenting control
- # symmetry states if it is a symmetric or asymmetric build. If asymmetric it doubles the generation time.
+ # symmetry states if it is a symmetric or asymmetric bui. If asymmetric it doubles the generation time.
'symmetry': "symmetric", # "asymmetric" or "symmetric"
'column_style_gt5': "orthographic",
@@ -280,6 +280,7 @@ shape_config = {
####################################
def save_config():
+ print("Saving Configuration")
with open('run_config.json', mode='w') as fid:
json.dump(shape_config, fid, indent=4)
@@ -297,5 +298,5 @@ def update_config(fname, fname_out=None):
if __name__ == '__main__':
save_config()
- from dactyl_manuform import *
- run() \ No newline at end of file
+ # from dactyl_manuform import *
+ # run() \ No newline at end of file
diff --git a/src/helpers_cadquery.py b/src/helpers_cadquery.py
index 78069d6..44553e6 100644
--- a/src/helpers_cadquery.py
+++ b/src/helpers_cadquery.py
@@ -176,14 +176,15 @@ def extrude_poly(outer_poly, inner_polys=None, height=1): # vector=(0,0,1)):
cq.Solid.extrudeLinear(outerWire=outer_wires, innerWires=inner_wires, vecNormal=cq.Vector(0, 0, height)))
-def import_file(filename):
+def import_file(fname):
+ print("IMPORTING FROM {}".format(fname))
return cq.Workplane('XY').add(cq.importers.importShape(
cq.exporters.ExportTypes.STEP,
- filename + ".step"))
+ fname + ".step"))
def export_file(shape, fname):
- print("IMPORTING FROM {}".format(fname))
+ print("EXPORTING TO {}".format(fname))
cq.exporters.export(w=shape, fname=fname + ".step",
exportType='STEP')
diff --git a/src/helpers_solid.py b/src/helpers_solid.py
index c98743c..470d5e8 100644
--- a/src/helpers_solid.py
+++ b/src/helpers_solid.py
@@ -129,4 +129,5 @@ def export_file(shape, fname):
def export_dxf(shape, fname):
+ print("NO DXF EXPORT FOR SOLID".format(fname))
pass \ No newline at end of file