diff --git a/.gitignore b/.gitignore index 0f539c5..a00c0e3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,6 @@ !/stl/micro/ !/stl/nano/ -/assembly-guide/gifs/tmp +**/tmp/ .DS_Store \ No newline at end of file diff --git a/README.md b/README.md index d88d93e..01e4449 100644 --- a/README.md +++ b/README.md @@ -63,11 +63,11 @@ but beware of PLA's thermal limits. Higher infill is recommended for all parts. ## Trays, Boxes, etc -Some parametric rack mount items can be found in [rack-mount](./rack-mount). The following rack-mount systems +Some parametric rack mount systems can be found in [rack-mount](./rack-mount). The following rack-mount systems are currently supported: -- [Enclosed Box](./rack-mount/enclosed-box/entry.scad): For mounting box-shaped objects, without the need for any mounting holes on the box. -- [Tray](./rack-mount/tray/entry.scad): Simple tray mounted using only the front rails. Can be configured to have screw mounts at the bottom of the tray. -- [Patch Panel](./rack-mount/patch-panel/entry.scad): Linear patch panel array. Number of keystone slots can be configured. +- [Enclosed Box](./rack-mount/enclosed-box): For mounting box-shaped objects, without the need for any mounting holes on the box. +- [Tray](./rack-mount/tray): Simple tray mounted using only the front rails. Can be configured to have screw mounts at the bottom of the tray. +- [Patch Panel](./rack-mount/patch-panel): Linear patch panel array. Number of keystone slots can be configured. ## Configuring + Generating STLs diff --git a/rack-mount/enclosed-box/README.md b/rack-mount/enclosed-box/README.md new file mode 100644 index 0000000..f1ffb27 --- /dev/null +++ b/rack-mount/enclosed-box/README.md @@ -0,0 +1,12 @@ + + +# Enclosed Box Mounting System + +![demo](./animate.gif) + +Please see [entry.scad](./entry.scad) for config and building. Make sure the correct rack profile is configured in [rackFrame.scad](../../config/rackFrame.scad). + +- This system comprises three parts: two side rails, and a front plate. +- This system is useful for mounting heavier box-shaped things. It works by first sliding in the box inside the side rails (which secures `x`, `z`, and one half of the `y` axis), and then mounting the front plate along the main rails. +- Side rails will most likely require supports to print. +- For wider boxes (nearing the `maxUnitWidth` of the rack), you will have to set `recessSideRail` to true. This is so the side rails will not collide with the main rack rails. \ No newline at end of file diff --git a/rack-mount/enclosed-box/animate.gif b/rack-mount/enclosed-box/animate.gif new file mode 100644 index 0000000..06d8bde Binary files /dev/null and b/rack-mount/enclosed-box/animate.gif differ diff --git a/rack-mount/patch-panel/README.md b/rack-mount/patch-panel/README.md new file mode 100644 index 0000000..320402c --- /dev/null +++ b/rack-mount/patch-panel/README.md @@ -0,0 +1,9 @@ +# Patch Panel + + +![demo](./animate.gif) + +Please see [entry.scad](./entry.scad) for config and building. Make sure the correct rack profile is configured in [rackFrame.scad](../../config/rackFrame.scad). + +- Mount RJ-45 Keystone jacks with this part. +- Single part. Can be printed without supports. \ No newline at end of file diff --git a/rack-mount/patch-panel/animate.gif b/rack-mount/patch-panel/animate.gif new file mode 100644 index 0000000..643779f Binary files /dev/null and b/rack-mount/patch-panel/animate.gif differ diff --git a/rack-mount/tray/README.md b/rack-mount/tray/README.md new file mode 100644 index 0000000..02cc7d2 --- /dev/null +++ b/rack-mount/tray/README.md @@ -0,0 +1,9 @@ +# Tray Mounting System + +![demo](./animate.gif) + +Please see [entry.scad](./entry.scad) for config and building. Make sure the correct rack profile is configured in [rackFrame.scad](../../config/rackFrame.scad). + +- Mount on front rails. +- Single Part, can also be printed without supports. +- Includes support for custom bottom screws (`mountPoints` in config). This is useful for SBCs and mini PCs with bottom screws. \ No newline at end of file diff --git a/rack-mount/tray/animate.gif b/rack-mount/tray/animate.gif new file mode 100644 index 0000000..d62eecc Binary files /dev/null and b/rack-mount/tray/animate.gif differ diff --git a/rack-mount/tray/animate.scad b/rack-mount/tray/animate.scad index 293d597..3543411 100644 --- a/rack-mount/tray/animate.scad +++ b/rack-mount/tray/animate.scad @@ -16,5 +16,5 @@ module animateTraySystem(at=$t) { dx = abs(lerp(a=-40, b=40, t=at)); dy = abs(lerp(a=-30, b=30, t=at)); - traySystem(trayU=trayU, baseWidth=x+dx, baseDepth=y+dy, mountPoints=[]); + traySystem(trayU=trayU, baseWidth=x+dx, baseDepth=y+dy, mountPoints=[], backLipHeight=8); } \ No newline at end of file diff --git a/rbuild.py b/rbuild.py index caff9cb..0ef38db 100644 --- a/rbuild.py +++ b/rbuild.py @@ -20,11 +20,9 @@ class BuildSizeConfig: FILE_DIR = os.path.dirname(os.path.abspath(__file__)) RACK_BUILD_DIR = os.path.join(FILE_DIR, 'rack/print') -RACK_MOUNT_BUILD_DIR = os.path.join(FILE_DIR, 'rack-mount/print') BUILD_PARENT_DIR = os.path.join(FILE_DIR, 'stl') - +RACK_MOUNT_DIR = os.path.join(FILE_DIR, 'rack-mount') RACK_BUILD_TARGET_SUB_DIR = 'rack' -RACK_MOUNT_BUILD_TARGET_SUB_DIR = 'rack-mount' ASSEMBLY_GIF_DIR = os.path.join(FILE_DIR, 'rack/assembly') ASSEMBLY_GIF_BUILD_DIR = os.path.join(FILE_DIR, 'assembly-guide/gifs') @@ -49,6 +47,11 @@ ASSEMBLY_STEPS = [ ('attachXYPlates.scad', 16) ] +MOUNT_ANIMATIONS = [ + ('enclosed-box', 32), + ('tray', 32), + ('patch-panel', 32) +] def main(): if not assertOpenscadExists(): @@ -97,9 +100,9 @@ def main(): ) parser.add_argument( - '--build_assembly_gifs', + '--build_gifs', action='store_true', - help='Generate the GIFS for the assembly guide.' + help='Generate the GIFS for the assembly guide, as well as various rack-mount systems.' ) args = parser.parse_args() @@ -115,11 +118,12 @@ def run_build(args): build_gifs = args.build_assembly_gifs if (build_var is not None) == (build_gifs is True): - print("Please either provide the build (-b) variable, or the build-gifs option (--build-assembly-gifs)") + print("Please either provide the build (-b) variable, or the build-gifs option (--build-gifs)") return if build_gifs: build_assembly_gifs(config_var, dz, nightly) + build_rack_mount_gifs(config_var, nightly) return if target_var != "": @@ -128,38 +132,25 @@ def run_build(args): final_target_directory_name = config_var rackBuildDirFull = os.path.join(BUILD_PARENT_DIR, final_target_directory_name, RACK_BUILD_TARGET_SUB_DIR) - #rackMountBuildDirFull = os.path.join(BUILD_PARENT_DIR, final_target_directory_name, - # RACK_MOUNT_BUILD_TARGET_SUB_DIR) if not os.path.exists(rackBuildDirFull): os.makedirs(rackBuildDirFull) - #if not os.path.exists(rackMountBuildDirFull): - # os.makedirs(rackMountBuildDirFull) - if build_var == 'all': for dir_file in os.listdir(RACK_BUILD_DIR): build_single(RACK_BUILD_DIR, rackBuildDirFull, dir_file, config_var, dz, nightly) - #for dir_file in os.listdir(RACK_MOUNT_BUILD_DIR): - # build_single(RACK_MOUNT_BUILD_DIR, rackMountBuildDirFull, dir_file, config_var, dz, - # nightly) return filename_rack = find_rack(build_var) - #filename_rack_mount = find_rack_mount(build_var) - if not (filename_rack): #or filename_rack_mount): + if not (filename_rack): print('File:', build_var, 'not found!') return if filename_rack: build_single(RACK_BUILD_DIR, rackBuildDirFull, filename_rack, config_var, dz, nightly) - #if filename_rack_mount: - # build_single(RACK_MOUNT_BUILD_DIR, rackMountBuildDirFull, filename_rack_mount, config_var, dz, nightly) - - def build_single(build_dir, target_dir, filename, config, dz, nightly): print('Building:', filename, 'from', build_dir, 'to', target_dir) openscad_args = construct_openscad_args(build_dir, target_dir, filename, config, dz) @@ -169,18 +160,39 @@ def build_single(build_dir, target_dir, filename, config, dz, nightly): def build_assembly_gifs(config, dz, nightly): print('Building assembly-gifs. Source Dir:', ASSEMBLY_GIF_DIR, '| Target:', ASSEMBLY_GIF_BUILD_DIR) + if not os.path.exists(ASSEMBLY_GIF_TEMP_DIR): + os.makedirs(ASSEMBLY_GIF_TEMP_DIR) + for (fileName, numSteps) in ASSEMBLY_STEPS: print('Building GIF for', fileName) openscad_args = construct_openscad_animation_args( ASSEMBLY_GIF_DIR, ASSEMBLY_GIF_TEMP_DIR, fileName, config, dz, numSteps ) run_openscad(openscad_args, nightly) - build_gif_from_png(fileName) + build_gif_from_png(fileName, ASSEMBLY_GIF_TEMP_DIR, ASSEMBLY_GIF_BUILD_DIR) +def build_rack_mount_gifs(config, nightly): + print('Building GIFs for rack-mounts systems') + + for (system, numSteps) in MOUNT_ANIMATIONS: + print('Building GIF for', system) + system_dir = os.path.join(RACK_MOUNT_DIR, system) + temp_dir = os.path.join(system_dir, 'tmp') + + if not os.path.exists(temp_dir): + os.makedirs(temp_dir) + + openscad_args = construct_openscad_animation_args(system_dir, temp_dir, 'animate.scad', config, 10, numSteps) + run_openscad(openscad_args, nightly) + build_gif_from_png('animate', temp_dir, system_dir) + +def build_gif_from_png(fileName, source, target): + + if not os.path.exists(target): + os.makedirs(target) -def build_gif_from_png(fileName): try: - subprocess.run(["bash", BUILD_GIF_FROM_PNG_SCRIPT, fileName, ASSEMBLY_GIF_TEMP_DIR, ASSEMBLY_GIF_BUILD_DIR], + subprocess.run(["bash", BUILD_GIF_FROM_PNG_SCRIPT, fileName, source, target], check=True) except subprocess.CalledProcessError as e: print(f"Error calling shell script: {e}") @@ -224,10 +236,6 @@ def find_rack(filename): return find_scad_file(RACK_BUILD_DIR, filename) -#def find_rack_mount(filename): -# return find_scad_file(RACK_MOUNT_BUILD_DIR, filename) - - def find_scad_file(directory, filename): for dir_file in os.listdir(directory): dir_file_normalized = dir_file.lower()