From ae9b343b40a95c05859f362ed5c1298ba7a73004 Mon Sep 17 00:00:00 2001 From: kellervater Date: Sat, 26 Apr 2025 20:46:40 +0200 Subject: [PATCH] feat(flexmount): single mounting bridge --- models/flexmount/flexmount.scad | 118 +++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 34 deletions(-) diff --git a/models/flexmount/flexmount.scad b/models/flexmount/flexmount.scad index 7cc71f5..9971a6c 100644 --- a/models/flexmount/flexmount.scad +++ b/models/flexmount/flexmount.scad @@ -9,9 +9,10 @@ fit_to_rack=true; /* [Device Measurements] */ // Width of the device in mm. Will determine how far apart the actual mounts are in width. -device_width=100; // TODO test for zero cube +device_width=100 +; // TODO test for zero cube // Depth of the device in mm. Will determine how far apart the actual mounts are in depth. -device_depth=99.0; +device_depth=99; // Height of the device in mm. Will determine how far apart the actual mounts are in height. device_height=25.5; @@ -27,40 +28,54 @@ TOLERANCE=0.2; // mm BASE_STRENGTH=2; // mm // Chamfer size. This is a sane default. CHAMFER=1; // mm +// Lock Pin side length +LOCK_PIN_SIDE=4; // mm +// lock pin edge distance +LOCK_PIN_EDGE_DISTANCE=5.5; // mm // diff_width resembles the gap between the device and the mount. This gap will be filled with a cuboid -width_diff=( device_width + TOLERANCE ) % BASE_UNIT / 2; -echo("Diff Width: ", width_diff); -mount_anchor_left=device_width/2 + width_diff; -echo("mount_anchor_left: ", mount_anchor_left); +modulo_width=(BASE_UNIT - ( device_width + TOLERANCE ) % BASE_UNIT); +WIDTH_DIFF = modulo_width==15 ? 0 : modulo_width; +echo("Diff Width: ", WIDTH_DIFF); mount_gap_filler_start=(device_width+TOLERANCE)/2; echo("mount_gap_filler_start: ", mount_gap_filler_start); -echo("mount_gap_filler_width: ", mount_anchor_left-mount_gap_filler_start); -echo("effective mount distance: ", device_width+width_diff*2); +echo("effective mount distance: ", device_width+WIDTH_DIFF+TOLERANCE); + +// diff_depth resembles the /* Code */ // creates a bracket around the device with TOLERANCE as additional space and BASE_STRENGTH as the strength of the bracket module bracket(width,depth,height) { // Bracket - difference() { + outer_width=width+BASE_STRENGTH*2; + outer_depth=depth+BASE_STRENGTH*2; + outer_height=height+BASE_STRENGTH; + intersection(){ + difference() { // Outer cuboid( - size=[width+BASE_STRENGTH,depth+BASE_STRENGTH,height+BASE_STRENGTH], + size=[outer_width,outer_depth,outer_height], anchor=BOTTOM, chamfer=CHAMFER, edges=[TOP,FRONT,BACK,LEFT,RIGHT], except=[BOTTOM] ); // Top Skeleton cuboid( - size=[width-BASE_STRENGTH*2,depth-BASE_STRENGTH*2,height+BASE_STRENGTH], + size=[width-BASE_STRENGTH*2,depth-BASE_STRENGTH*2,outer_height], anchor=BOTTOM, chamfer=-CHAMFER, edges=[TOP] ); // Bottom Recess cuboid( - size=[width+BASE_STRENGTH,depth+BASE_STRENGTH,height-BASE_STRENGTH], + size=[outer_width,outer_depth,height-BASE_STRENGTH], anchor=BOTTOM - ); - + ); + } + translate([0,0,outer_height]) + cuboid( + size=[outer_width,outer_depth,BASE_STRENGTH*2], + anchor=TOP, + chamfer=CHAMFER, edges=[BOTTOM] + ); } } @@ -74,13 +89,14 @@ module device(width,depth,height) { ); } -module mount_rail(width,depth) { +module mount_rail(width,depth,chamfer=CHAMFER) { difference(){ height=BASE_UNIT+TOLERANCE/2; // outer cuboid( size=[width,depth,height], - anchor=TOP+LEFT + anchor=TOP+LEFT, + chamfer=chamfer, edges=[FRONT,BACK], except=[TOP,LEFT] ); // support recess cuboid( @@ -94,32 +110,66 @@ module mount_rail(width,depth) { // Mount module mount(){ depth=BASE_UNIT+BASE_STRENGTH*2+TOLERANCE; + gap_filler_width=WIDTH_DIFF/2; union(){ + translate([mount_gap_filler_start,0,0]) - // Gap Filler - union(){ - cuboid( - size=[width_diff,depth,device_height+BASE_STRENGTH], - anchor=BOTTOM+LEFT - ); - mount_rail(width_diff,depth); - } - - translate([mount_gap_filler_start+width_diff,0,0]) // Mount + + // Mirror the mount to create a symmetric mount + + + union(){ + + + top_width=BASE_STRENGTH; + bottom_width=BASE_UNIT+top_width+gap_filler_width; + // Bridge + difference(){ + cuboid_width = bottom_width-BASE_STRENGTH*2; + cuboid_chamfer = device_height < cuboid_width ? device_height : cuboid_width; + prismoid( + size1 = [bottom_width, depth], // Bottom face: width 30, depth 60 + size2 = [top_width, depth], // Top face: becomes a line segment (width 0) + shift = [(-bottom_width+top_width)/2, 0], // Shift top edge center to X=+15 (aligns with right edge of base) + chamfer=CHAMFER, + h = device_height, // Height + //chamfer=CHAMFER/2, + anchor = BOTTOM+LEFT // Anchor bottom left + ); + translate([BASE_STRENGTH,0,BASE_STRENGTH]) + cuboid( + size=[cuboid_width,BASE_UNIT,device_height], + anchor=BOTTOM+LEFT, + chamfer=cuboid_chamfer, edges=[LEFT], except=[TOP,RIGHT,FRONT,BACK] + ); + } + + // Depth enforcement + depth_enforcement_x = BASE_STRENGTH-TOLERANCE/2; prismoid( - size1 = [BASE_UNIT, depth], // Bottom face: width 30, depth 60 - size2 = [0, depth], // Top face: becomes a line segment (width 0) - shift = [-BASE_UNIT/2, 0], // Shift top edge center to X=+15 (aligns with right edge of base) - h = device_height+BASE_STRENGTH, // Height - anchor = BOTTOM+LEFT // Anchor bottom left + size1 = [depth_enforcement_x, depth], + size2 = [depth_enforcement_x, depth+BASE_UNIT], + h = device_height, + chamfer=[CHAMFER,0,0,CHAMFER], + anchor = BOTTOM+LEFT ); - // Mount Rail - mount_rail(BASE_UNIT,depth); - } + + // Mount Rail with holes + difference(){ + mount_rail(bottom_width,depth); + // holes + translate([bottom_width-LOCK_PIN_EDGE_DISTANCE,0,-LOCK_PIN_EDGE_DISTANCE]) + cuboid( + size=[LOCK_PIN_SIDE,depth,LOCK_PIN_SIDE], + anchor=TOP+RIGHT + ); + } + } + } }