// NEMA 17 sheet-metal L mount (2 mm steel) // Z up, part rests on Z=0. Base in XY (X = width, Y = depth, front at Y=0), // upright rises at the back (outer face at Y = base_depth). // Dimensions are OUTSIDE (mold-line) sizes: base 50x40, upright 50x50. /* [Mode] */ mode = "folded"; // [folded, flat, flat3d] /* [Sheet] */ thickness = 2; // [0.5:0.1:6] bend_radius = 2; // inside bend radius [0.5:0.1:10] k_factor = 0.44; // [0.2:0.01:0.5] /* [Size] */ width = 50; // [30:1:100] base_depth = 40; // outside depth of base [20:1:100] upright_height = 50; // outside height of upright [30:1:100] /* [Motor face (NEMA 17)] */ bore_d = 22.5; // [10:0.1:30] screw_d = 3.4; // [2:0.1:6] screw_pitch = 31; // [20:0.1:50] motor_center_z = 25; // height of bore centre from Z=0 (face centre) [15:0.5:60] /* [Base slots] */ slot_w = 5.5; // [3:0.1:10] slot_len = 12; // overall slot length incl. round ends [6:0.5:30] slot_spacing = 30; // X distance between slot centres [10:1:90] slot_center_y = 18; // slot centre from front edge [6:0.5:40] /* [Hidden] */ $fn = 96; T = thickness; R = bend_radius; bend_ang = 90; BA = PI/2 * (R + k_factor*T); // bend allowance, 90 deg base_flat = base_depth - (R + T); // straight base length up_flat = upright_height - (R + T); // straight upright length flat_len = base_flat + BA + up_flat; echo(BA=BA, base_flat=base_flat, up_flat=up_flat, flat_len=flat_len, flat_w=width); module slot2d(l, w) { hull() for (s = [-1, 1]) translate([0, s*(l - w)/2]) circle(d = w); } module face_holes2d() { // centred on (0,0) circle(d = bore_d); for (sx = [-1, 1], sy = [-1, 1]) translate([sx, sy]*screw_pitch/2) circle(d = screw_d); } module base_holes2d() { for (sx = [-1, 1]) translate([width/2 + sx*slot_spacing/2, slot_center_y]) slot2d(slot_len, slot_w); } // ---------- folded ---------- module folded() { // base difference() { cube([width, base_flat, T]); translate([0, 0, -1]) linear_extrude(T + 2) base_holes2d(); } // bend: axis along X at (y = base_flat, z = R + T) translate([0, base_flat, R + T]) multmatrix([[0,0,1,0],[0,1,0,0],[-1,0,0,0],[0,0,0,1]]) rotate_extrude(angle = bend_ang, $fn = 128) translate([R, 0]) square([T, width]); // upright difference() { translate([0, base_flat + R, R + T]) cube([width, T, up_flat]); translate([width/2, base_flat + R - 1, motor_center_z]) rotate([-90, 0, 0]) linear_extrude(T + 2) face_holes2d(); } } // ---------- flat pattern (2D, XY) ---------- // Y = 0 at base front edge, upright free edge at Y = flat_len. module flat2d() { difference() { square([width, flat_len]); base_holes2d(); translate([width/2, base_flat + BA + (motor_center_z - (R + T))]) face_holes2d(); } } if (mode == "folded") folded(); else if (mode == "flat") flat2d(); else linear_extrude(T) flat2d();