$fn = 64; // --- PARAMETERS --- shield_width = 120; shield_height = 150; shield_thickness = 5; rim_width = 6; rim_height = 3; cross_width = 16; cross_height = 90; cross_thickness = 3; cross_y_offset = 10; spool_diameter = 40; spool_depth = 25; flange_width = 60; flange_height = 100; flange_thickness = 5; // Z-height calculations for stacking z_flange = 0; z_core = flange_thickness; z_shield = flange_thickness + spool_depth; z_details = z_shield + shield_thickness; // --- MAIN ASSEMBLY --- union() { // 1. Back Flange with Keyholes (Wall Mount) difference() { translate([0, 0, z_flange]) linear_extrude(flange_thickness) rounded_rect(flange_width, flange_height, 8); translate([0, 30, z_flange]) keyhole_cutout(); translate([0, -30, z_flange]) keyhole_cutout(); } // 2. Spool Core (Cable Holder Stand-off) translate([0, 0, z_core]) cylinder(d=spool_diameter, h=spool_depth); // 3. Shield Base translate([0, 0, z_shield]) linear_extrude(shield_thickness) shield_2d(shield_width, shield_height); // 4. Shield Details (Rim & Cross) translate([0, 0, z_details]) { // Raised Rim linear_extrude(rim_height) difference() { shield_2d(shield_width, shield_height); offset(r=-rim_width) shield_2d(shield_width, shield_height); } // Central Cross translate([0, cross_y_offset, 0]) linear_extrude(cross_thickness) { square([cross_width, cross_height], center=true); square([cross_height, cross_width], center=true); } } } // --- MODULES --- // Generates the classic curved heater shield 2D profile module shield_2d(w, h) { cx = w/4 - (h*h)/w; cy = h/2; r = sqrt(cx*cx + h*h); intersection() { // Flat top boundary translate([-w, -h]) square([w*2, h + h/2]); // Curved right side translate([cx, cy]) circle(r=r); // Curved left side translate([-cx, cy]) circle(r=r); } } // Generates a 2D rectangle with rounded corners module rounded_rect(w, h, r) { hull() { translate([-w/2 + r, h/2 - r]) circle(r=r); translate([w/2 - r, h/2 - r]) circle(r=r); translate([-w/2 + r, -h/2 + r]) circle(r=r); translate([w/2 - r, -h/2 + r]) circle(r=r); } } // Generates the negative space for a wall-mounting keyhole slot module keyhole_cutout() { // Narrow slot for the screw shaft translate([0, 0, -1]) linear_extrude(flange_thickness + 2) { circle(d=8); translate([-2.5, 0]) square([5, 12]); translate([0, 12]) circle(d=5); } // Wider recess for the screw head to slide into translate([0, 0, 2.5]) linear_extrude(flange_thickness + spool_depth) { circle(d=14); translate([-4.5, 0]) square([9, 12]); translate([0, 12]) circle(d=9); } }