diff --git a/libtest.png b/libtest.png index 7f74b33..cbfa088 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/readme.md b/readme.md index 82976c8..783b44c 100644 --- a/readme.md +++ b/readme.md @@ -296,11 +296,18 @@ Models of radial blowers. | ```blower_wall(type)``` | Side wall thickness | | ```blower_width(type)``` | Width of enclosing rectangle | +### Functions +| Function | Description | +|:--- |:--- | +| ```blower_casing_is_square(type)``` | True for square radial fans, false for spiral shape radial blowers | +| ```blower_exit_offset(type)``` | Offset of exit's centre from the edge | + ### Modules | Module | Description | |:--- |:--- | | ```blower(type)``` | Draw specified blower | | ```blower_hole_positions(type)``` | Translate children to screw hole positions | +| ```blower_square(type)``` | Draw a square blower | ![blowers](tests/png/blowers.png) @@ -309,8 +316,11 @@ Models of radial blowers. | ---:|:--- |:---| | 1 | ```blower(PE4020)``` | Blower Pengda Technology 4020 | | 1 | ```blower(RB5015)``` | Blower Runda RB5015 | +| 4 | ```screw(M2_cap_screw, 8)``` | Screw M2 cap x 8mm | | 3 | ```screw(M3_cap_screw, 20)``` | Screw M3 cap x 20mm | | 2 | ```screw(M4_cap_screw, 25)``` | Screw M4 cap x 25mm | +| 1 | ```blower(BL40x10)``` | Square radial 4010 | +| 4 | ```washer(M2_washer)``` | Washer M2 x 5mm x 0.3mm | | 3 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm | | 2 | ```washer(M4_washer)``` | Washer M4 x 9mm x 0.8mm | diff --git a/tests/png/blowers.png b/tests/png/blowers.png index 1dce171..985e653 100644 Binary files a/tests/png/blowers.png and b/tests/png/blowers.png differ diff --git a/vitamins/blower.scad b/vitamins/blower.scad index 09ef1f7..e0aeba8 100644 --- a/vitamins/blower.scad +++ b/vitamins/blower.scad @@ -22,6 +22,8 @@ // include <../utils/core/core.scad> use <../utils/rounded_cylinder.scad> +use <../utils/quadrant.scad> +use function blower_length(type) = type[2]; //! Length of enclosing rectangle function blower_width(type) = type[3]; //! Width of enclosing rectangle @@ -39,8 +41,87 @@ function blower_top(type) = type[14]; //! Thickness of the top function blower_wall(type) = type[15]; //! Side wall thickness function blower_lug(type) = type[16]; //! Height of the lugs +function blower_casing_is_square(type) = len(blower_screw_holes(type)) > 3; //! True for square radial fans, false for spiral shape radial blowers +function blower_exit_offset(type) = blower_casing_is_square(type) ? blower_length(type) / 2 : blower_exit(type) / 2; //! Offset of exit's centre from the edge + fan_colour = grey(20); +module blower_fan(type, casing_is_square) { + module squarish(s, n) { + polygon([ + for(i = [0 : n]) [i * s.x / n, s.y + (i % 2) * eps], + for(i = [0 : n]) [s.x - i * s.x / n, (i % 2) * eps], + ]); + } + + depth = blower_depth(type); + blade_ir = blower_hub(type) / 2 + 0.5; // slight gap between main part of blades and hub + blade_len = casing_is_square + ? (blower_bore(type) - 1) / 2 - blade_ir // fan constrained by bore hole + : blower_width(type) - blower_axis(type).x- blower_wall(type) - blade_ir; // fan extends to casing + blade_thickness = 0.75; + blade_count = 25; + + base_offset = 1; + translate([blower_axis(type).x, blower_axis(type).y, blower_base(type) + base_offset]) + linear_extrude(blower_hub_height(type) - 0.5 - blower_base(type) - base_offset, center = false, convexity = 4, twist = -30, slices = round(depth / 2)) + for(i = [0 : blade_count - 1]) + rotate((360 * i) / blade_count) + translate([blade_ir, -blade_thickness / 2]) + squarish([blade_len, blade_thickness], round(blade_len / 2)); +} + +module blower_square(type) { //! Draw a square blower + width = blower_width(type); + depth = blower_depth(type); + wall = blower_wall(type); + hole_pitch = (blower_screw_holes(type)[1].x - blower_screw_holes(type)[0].x) / 2; + corner_radius = width / 2 - hole_pitch; + corner_inset = (width - blower_exit(type)) / 2; + + module square_inset_corners(remove_center = false) + difference() { + //overall outside + square([width, width], center = false); + + if (remove_center) { + // cut out the inside, leaving the corners + translate([corner_inset + wall, -eps]) + square([width - 2 * (wall + corner_inset), width - wall + eps], center = false); + + translate([wall, corner_inset + wall]) + square([width - 2 * wall, width - 2 * (wall + corner_inset)], center = false); + } else { + // cut out the bore for the fan + translate(blower_axis(type)) + circle(d = blower_bore(type)); + } + // corner inset + translate([width / 2, width / 2]) + for(i = [0 : 3]) + rotate(i * 90) + translate([-width / 2 - eps, -width/ 2 - eps]) + quadrant(corner_inset, corner_inset - corner_radius); + } + + base_height = blower_base(type); + linear_extrude(base_height) + difference () { + rounded_square([width, width], corner_radius, center = false); + + blower_hole_positions(type) + circle(d = blower_screw_hole(type)); + } + + translate_z(base_height) + linear_extrude(depth - base_height) + square_inset_corners(remove_center = true); + + translate_z(depth - base_height) + linear_extrude(blower_top(type)) + square_inset_corners(); +} + module blower(type) { //! Draw specified blower length = blower_length(type); width = blower_width(type); @@ -70,55 +151,63 @@ module blower(type) { //! Draw specified blower vitamin(str("blower(", type[0], "): ", type[1])); + is_square = blower_casing_is_square(type); // Description starts with square! color(fan_colour) { - // screw lugs - linear_extrude(blower_lug(type), center = false) - for(hole = blower_screw_holes(type)) - difference() { - hull() { + if (is_square) { + blower_square(type); + } else { + // screw lugs + linear_extrude(blower_lug(type), center = false) + for(hole = blower_screw_holes(type)) + difference() { + hull() { + translate(hole) + circle(d = blower_screw_hole(type) + 2 * blower_wall(type)); + + translate(blower_axis(type)) + circle(d = blower_screw_hole(type) + 2 * blower_wall(type) + 7); + } translate(hole) - circle(d = blower_screw_hole(type) + 2 * blower_wall(type)); + circle(d = blower_screw_hole(type)); - translate(blower_axis(type)) - circle(d = blower_screw_hole(type) + 2 * blower_wall(type) + 7); - } - translate(hole) - circle(d = blower_screw_hole(type)); + shape(true); + } - shape(true); - } - // rotor - translate(concat(blower_axis(type), [blower_base(type) + 1])) - rounded_cylinder(r = blower_hub(type) / 2, h = blower_hub_height(type) - blower_base(type) - 1, r2 = 1); + *%square([length, width]); - *%square([length, width]); - - // base - linear_extrude(blower_base(type)) - difference() { - shape(); - - translate(concat(blower_axis(type), [blower_base(type)])) - circle(d = 2); - } - // sides - linear_extrude(depth) - difference() { - shape(); - - offset(-blower_wall(type)) - shape(true); - } - - // top - translate_z(depth -blower_top(type)) - linear_extrude(blower_top(type)) + // base + linear_extrude(blower_base(type)) difference() { shape(); translate(concat(blower_axis(type), [blower_base(type)])) - circle(d = blower_bore(type)); - } + circle(d = 2); + } + + // sides + linear_extrude(depth) + difference() { + shape(); + + offset(-blower_wall(type)) + shape(true); + } + + // top + translate_z(depth -blower_top(type)) + linear_extrude(blower_top(type)) + difference() { + shape(); + + translate(concat(blower_axis(type), [blower_base(type)])) + circle(d = blower_bore(type)); + } + } + // rotor + translate(concat(blower_axis(type), [blower_base(type) + 1])) + rounded_cylinder(r = blower_hub(type) / 2, h = blower_hub_height(type) - blower_base(type) - 1, r2 = 1); + + blower_fan(type, is_square); } } diff --git a/vitamins/blowers.scad b/vitamins/blowers.scad index 7a8b65f..4d652e5 100644 --- a/vitamins/blowers.scad +++ b/vitamins/blowers.scad @@ -16,10 +16,16 @@ // You should have received a copy of the GNU General Public License along with NopSCADlib. // If not, see . // +// l w d b s h a s s e h b t w l +// e i e o c u x c c x u a o a u +// n d p r r b i r r i b s p l g +// g t t e e s e e t e l +// t h h w d w w t +// h h s t t +RB5015 = ["RB5015", "Blower Runda RB5015", 51.3, 51, 15, 31.5, M4_cap_screw, 26, [27.3, 25.4], 4.5, [[4.3, 45.4], [47.3,7.4]], 20, 14, 1.5, 1.3, 1.2, 15]; +PE4020 = ["PE4020", "Blower Pengda Technology 4020", 40, 40, 20, 27.5, M3_cap_screw, 22, [21.5, 20 ], 3.2, [[37,3],[3,37],[37,37]], 29.3, 17, 1.7, 1.2, 1.3, 13]; +BL40x10 =["BL40x10","Square radial 4010", 40, 40,9.5, 27, M2_cap_screw, 16, [24, 20 ], 2.4, [[2,2],[38,2],[2,38],[38,38]], 30 , 9.5, 1.5, 1.5, 1.1, 1.5]; -RB5015 = ["RB5015", "Blower Runda RB5015", 51.3, 51, 15, 31.5, M4_cap_screw, 26, [27.3, 25.4], 4.5, [[4.3, 45.4], [47.3,7.4]], 20, 14, 1.5, 1.3, 1.2, 15]; -PE4020 = ["PE4020", "Blower Pengda Technology 4020", 40, 40, 20, 27.5, M3_cap_screw, 22, [21.5, 20 ], 3.2, [[37,3],[3,37],[37,37]], 29.3, 17, 1.7, 1.2, 1.3, 13]; - -blowers = [PE4020, RB5015]; +blowers = [BL40x10, PE4020, RB5015]; use