From ebeb258d60adb0c36ee70117b69d417d8d49e0e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20P=C3=B6tz?= <33324812+kellervater@users.noreply.github.com> Date: Sun, 27 Apr 2025 12:42:26 +0200 Subject: [PATCH] feat(rackmount_ears): asymetry slider (#13) Added "insane" asymetry slider to create differently sized rackmount ears. --- models/rackmount_ears/rackmount_ears.scad | 81 ++++++++++++----------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/models/rackmount_ears/rackmount_ears.scad b/models/rackmount_ears/rackmount_ears.scad index 98ef365..28e39bc 100644 --- a/models/rackmount_ears/rackmount_ears.scad +++ b/models/rackmount_ears/rackmount_ears.scad @@ -1,13 +1,26 @@ // import BOSL2 include +/* [Hidden] */ $fn=100; +CAGE_BOLT_DIAMETER=6.5; +RACK_BORE_DISTANCE_VERTICAL=15.875; +RACK_BORE_DISTANCE_TOP_BOTTOM=6.35; +RACK_MOUNT_SURFACE_WIDTH=15.875; +RACK_BORE_DISTANCE_HORIZONTAL=RACK_MOUNT_SURFACE_WIDTH/2; +RACK_HEIGHT_UNIT=44.5; // mm + +RACK_WIDTH_10_INCH_INNER=222.25; // mm +RACK_WIDTH_10_INCH_OUTER=254; // mm +RACK_WIDTH_19_INCH=482.6; // mm /* [Base] */ // automatically chooses the tightest fit for the rackmount ears based on the device width. If true, rack_size will be ignored. autosize=true; // rack size in inches. If autosize is true, this value will be ignored. Only 10 and 19 inch racks are supported. rack_size=10; // [10:10 inch,19:19 inch] +// Asymetry Slider. If autosize is true, this value will be ignored. CAUTION: there's no sanity check for this slider! +asymetry=100; // [-150:0.1:150] // Width of the device in mm. Will determine the width of the rackmount ears depending on rack_size. device_width=201; @@ -38,44 +51,18 @@ device_bore_rows=2; // If true, the device will be aligned to the center of the rackmount ear. Otherwise it will be aligned to the bottom of the rackmount ear. center_device_bore_alignment=false; - -/* [CONSTANTS (shouldn't need to be changed)] */ -CAGE_BOLT_DIAMETER=6.5; +/* [Derived] */ CHAMFER=min(strength/3,0.5); -RACK_BORE_DISTANCE_VERTICAL=15.875; -RACK_BORE_DISTANCE_TOP_BOTTOM=6.35; -RACK_MOUNT_SURFACE_WIDTH=15.875; -RACK_BORE_DISTANCE_HORIZONTAL=RACK_MOUNT_SURFACE_WIDTH/2; RACK_BORE_WIDTH=RACK_MOUNT_SURFACE_WIDTH-2*max(strength,2); -RACK_HEIGHT_UNIT=44.5; // mm RACK_HEIGHT_UNIT_COUNT=max(1,ceil(device_height/RACK_HEIGHT_UNIT)); RACK_HEIGHT=RACK_HEIGHT_UNIT_COUNT*RACK_HEIGHT_UNIT; // actual height calculated by height unit size x number of units RACK_BORE_COUNT=RACK_HEIGHT_UNIT_COUNT*3; // 3 holes for each units -RACK_WIDTH_10_INCH_INNER=222.25; // mm -RACK_WIDTH_10_INCH_OUTER=254; // mm -RACK_WIDTH_19_INCH=482.6; // mm - -// Base assertions -module validate_params() { - valid_rack_sizes=[10,19]; - if(autosize == false){ - assert(rack_size == 10 || rack_size == 19, "Invalid rack_size. Only 10 and 19 inch racks are supported. Choose a valid one or set autosize to true."); - } -} - -validate_params(); // Debug echo("Height: ", RACK_HEIGHT); echo("Rack Bore Count: ", RACK_BORE_COUNT); -// Calculate the width of the ear -function get_ear_width(device_width) = - device_width > RACK_WIDTH_10_INCH_INNER || autosize == false && rack_size == 19 ? - (RACK_WIDTH_19_INCH - device_width) / 2 : - (RACK_WIDTH_10_INCH_OUTER - device_width) / 2 -; -rack_ear_width = get_ear_width(device_width); + function get_bore_depth(device_bore_margin_horizontal,device_bore_columns) = (device_bore_columns - 1) * device_bore_margin_horizontal @@ -92,7 +79,7 @@ device_screw_alignment = [strength,depth/2,device_screw_alignment_vertical]; module base_ear(width,strength,height) { union() { // Front face - cuboid([rack_ear_width,strength,height],anchor=LEFT+BOTTOM+FRONT,chamfer=CHAMFER); + cuboid([width,strength,height],anchor=LEFT+BOTTOM+FRONT,chamfer=CHAMFER); // Side face cuboid([strength,depth,height],anchor=LEFT+BOTTOM+FRONT,chamfer=CHAMFER); } @@ -110,15 +97,33 @@ module screws_countersunk(length, diameter_head, length_head, diameter_shaft) { // Assemble the rackmount ear -difference() { +module rackmount_ear(asym=0){ + ear_width_19_inch=(RACK_WIDTH_19_INCH - device_width) / 2 + asym; + ear_width_10_inch=(RACK_WIDTH_10_INCH_OUTER - device_width) / 2 + asym; + // Calculate the width of the ear + rack_ear_width = device_width > RACK_WIDTH_10_INCH_INNER || autosize == false && rack_size == 19 ? + ear_width_19_inch: + ear_width_10_inch + ; difference() { - // Create the base of the ear - base_ear(device_width,strength,RACK_HEIGHT); - // Create the holes for the device screws - screws_countersunk(length=strength,diameter_head=device_bore_hole_head_diameter,length_head=device_bore_hole_head_length,diameter_shaft=device_bore_hole_diameter); + difference() { + // Create the base of the ear + base_ear(rack_ear_width,strength,RACK_HEIGHT); + // Create the holes for the device screws + screws_countersunk(length=strength,diameter_head=device_bore_hole_head_diameter,length_head=device_bore_hole_head_length,diameter_shaft=device_bore_hole_diameter); + } + // Create the holes for the rackmount screws + zcopies(spacing=RACK_HEIGHT_UNIT,n=RACK_HEIGHT_UNIT_COUNT,sp=[0,0,0]) + zcopies(spacing=RACK_BORE_DISTANCE_VERTICAL,n=3,sp=[rack_ear_width-RACK_BORE_DISTANCE_HORIZONTAL,0,RACK_BORE_DISTANCE_TOP_BOTTOM]) + cuboid([RACK_BORE_WIDTH,strength+1,CAGE_BOLT_DIAMETER], rounding=CAGE_BOLT_DIAMETER/2, edges=[TOP+LEFT,TOP+RIGHT,BOTTOM+LEFT,BOTTOM+RIGHT], anchor=FRONT); } - // Create the holes for the rackmount screws - zcopies(spacing=RACK_HEIGHT_UNIT,n=RACK_HEIGHT_UNIT_COUNT,sp=[0,0,0]) - zcopies(spacing=RACK_BORE_DISTANCE_VERTICAL,n=3,sp=[rack_ear_width-RACK_BORE_DISTANCE_HORIZONTAL,0,RACK_BORE_DISTANCE_TOP_BOTTOM]) - cuboid([RACK_BORE_WIDTH,strength+1,CAGE_BOLT_DIAMETER], rounding=CAGE_BOLT_DIAMETER/2, edges=[TOP+LEFT,TOP+RIGHT,BOTTOM+LEFT,BOTTOM+RIGHT], anchor=FRONT); +} + +// Place the ears +rackmount_ear(asymetry); + +x_mirror_plane = [1,0,0]; +translate([-device_width,0,0]) +mirror(x_mirror_plane){ + rackmount_ear(-asymetry); }