Skip to content

Commit

Permalink
add animation gifs for new rack-mount systems, also update rbuild and…
Browse files Browse the repository at this point in the history
… the main readme to reflect these changes
  • Loading branch information
jazwa committed Sep 1, 2023
1 parent be3020c commit 529123e
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
!/stl/micro/
!/stl/nano/

/assembly-guide/gifs/tmp
**/tmp/

.DS_Store
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions rack-mount/enclosed-box/README.md
Original file line number Diff line number Diff line change
@@ -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.
Binary file added rack-mount/enclosed-box/animate.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions rack-mount/patch-panel/README.md
Original file line number Diff line number Diff line change
@@ -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.
Binary file added rack-mount/patch-panel/animate.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions rack-mount/tray/README.md
Original file line number Diff line number Diff line change
@@ -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.
Binary file added rack-mount/tray/animate.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion rack-mount/tray/animate.scad
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
62 changes: 35 additions & 27 deletions rbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -49,6 +47,11 @@ class BuildSizeConfig:
('attachXYPlates.scad', 16)
]

MOUNT_ANIMATIONS = [
('enclosed-box', 32),
('tray', 32),
('patch-panel', 32)
]

def main():
if not assertOpenscadExists():
Expand Down Expand Up @@ -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()
Expand All @@ -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 != "":
Expand All @@ -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)
Expand All @@ -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}")
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 529123e

Please sign in to comment.