diff --git a/10InchRackGenerator.scad b/10InchRackGenerator.scad index f0bee05..d2b1c1b 100644 --- a/10InchRackGenerator.scad +++ b/10InchRackGenerator.scad @@ -6,6 +6,7 @@ rack_height = 1.0; // [0.5:0.5:5] component_width = 110.0; component_depth = 122.0; component_height = 28.30; +component_offset = 0; // [-100:0.1:100] // ======================================== /* [Keystones] */ @@ -108,7 +109,7 @@ module switch_mount(switch_width, switch_height, switch_depth) { // Create the main body as a separate module module main_body() { - side_margin = (rack_width - chassis_width) / 2; + side_margin = ((rack_width - chassis_width) / 2) + component_offset; chassis_height = min(switch_height + (2 * case_thickness), height); union() { // Front panel @@ -129,7 +130,7 @@ module switch_mount(switch_width, switch_height, switch_depth) { lip_depth = 0.60; // Main cutout minus lip (centered) translate([ - (rack_width - (cutout_w - 2*lip_thickness)) / 2, + (rack_width - (cutout_w - 2*lip_thickness)) / 2 + component_offset, (height - (cutout_h - 2*lip_thickness)) / 2, -tolerance ]) { @@ -137,7 +138,7 @@ module switch_mount(switch_width, switch_height, switch_depth) { } // Switch cutout above the lip (centered) translate([ - (rack_width - cutout_w) / 2, + ((rack_width - cutout_w) / 2) + component_offset, (height - cutout_h) / 2, lip_depth ]) { @@ -148,7 +149,7 @@ module switch_mount(switch_width, switch_height, switch_depth) { z_start = front_plate_hole ? -tolerance : front_plate_thickness; z_depth = front_plate_hole ? chassis_depth_main + 2*tolerance : chassis_depth_main - front_plate_thickness + tolerance; translate([ - (rack_width - cutout_w) / 2, + ((rack_width - cutout_w) / 2) + component_offset, (height - cutout_h) / 2, z_start ]) { @@ -205,8 +206,8 @@ module switch_mount(switch_width, switch_height, switch_depth) { // Power wire cutouts: configurable diameter holes at top and bottom rack hole positions module power_wire_cutouts() { hole_spacing_x = switch_width; // match rack holes - hole_left_x = (rack_width - hole_spacing_x) / 2 - (wire_diameter /5); - hole_right_x = (rack_width + hole_spacing_x) / 2 + (wire_diameter /5); + hole_left_x = (rack_width - hole_spacing_x) / 2 - (wire_diameter /5) + component_offset; + hole_right_x = (rack_width + hole_spacing_x) / 2 + (wire_diameter /5) + component_offset; // Midplane of switch opening mid_y = (height - switch_height) / 2 + switch_height / 2; for (side_x = [hole_left_x, hole_right_x]) { @@ -223,14 +224,14 @@ module switch_mount(switch_width, switch_height, switch_depth) { // Zip tie holes zip_z = switch_depth + solid_z_offset; for (i = [0:zip_tie_hole_count-1]) { - x_pos = (rack_width - switch_width)/2 + (switch_width/(zip_tie_hole_count+1)) * (i+1); + x_pos = (rack_width - switch_width)/2 + component_offset + (switch_width/(zip_tie_hole_count+1)) * (i+1); translate([x_pos, 0, zip_z]) { cube([zip_tie_hole_width, height, zip_tie_hole_length]); } } // Zip tie indents (top and bottom) - x_pos = (rack_width - switch_width)/2; + x_pos = ((rack_width - switch_width)/2) + component_offset; chassis_height = min(switch_height + (2 * case_thickness), height); // Bottom indent translate([x_pos, (height - chassis_height)/2, zip_z]) { @@ -252,7 +253,7 @@ module switch_mount(switch_width, switch_height, switch_depth) { // Chassis dimensions used by both hole sections chassis_height = min(switch_height + (2 * case_thickness), height); chassis_width = min(switch_width + (2 * case_thickness), (rack_width == 152.4) ? 120.65 : 221.5); - side_margin = (rack_width - chassis_width) / 2; + side_margin = ((rack_width - chassis_width) / 2) + component_offset; // TOP/BOTTOM FACE HOLES (Y-axis, penetrating top and bottom chassis walls) // Calculate available space for holes within switch dimensions @@ -268,7 +269,7 @@ module switch_mount(switch_width, switch_height, switch_depth) { actual_grid_depth = (z_rows - 1) * spacing_z; // Center the grid within the switch cutout area - cutout_center_x = rack_width / 2; + cutout_center_x = (rack_width / 2) + component_offset; cutout_center_z = front_plate_thickness + switch_depth / 2; x_start = cutout_center_x - actual_grid_width / 2;