Merge branch 'square_blower' of https://github.com/martinbudden/NopSCADlib into martinbudden-square_blower

This commit is contained in:
Chris Palmer 2020-11-17 16:41:34 +00:00
commit 3f359f6839
2 changed files with 125 additions and 42 deletions

View File

@ -22,6 +22,7 @@
//
include <../utils/core/core.scad>
use <../utils/rounded_cylinder.scad>
use <screw.scad>
function blower_length(type) = type[2]; //! Length of enclosing rectangle
function blower_width(type) = type[3]; //! Width of enclosing rectangle
@ -41,6 +42,76 @@ function blower_lug(type) = type[16]; //! Height of the lugs
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) - blower_wall(type)) / 2;
module square_inset_corners(remove_center = false)
difference() {
//overall outside
translate([0, eps, 0]) // eps y value required or difference fails, bug in OpenSCAD?
square([width, width], center = false);
if (remove_center) {
// cut out the inside, leaving the corners
translate([corner_inset + wall, 0])
square([width - 2 * (wall + corner_inset), width - wall], 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
for (x = [0, width], y = [0, width])
translate([x , y])
circle(r = corner_inset);
}
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 +141,61 @@ module blower(type) { //! Draw specified blower
vitamin(str("blower(", type[0], "): ", type[1]));
is_square = blower_lug(type) == 0; // it's a square blower if there are no lugs
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);
}
}

View File

@ -16,10 +16,16 @@
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
// l w d b s h a s s
// e i e o c u x c c
// n d p r r b i r r
// g t t e e s e w
// t h h w d w w
// h h s
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 =["R4010", "Square radial 4010", 40, 40,9.5, 27, M2_cap_screw, 16, [24, 20 ], 2.4, [[2,2,1.5],[38,2,1.5],[2,38,1.5],[38,38,1.5]], 28, 9.5, 1.5, 1.5, 1.3, 0];
blowers = [PE4020, RB5015];
blowers = [BL40x10, PE4020, RB5015];
use <blower.scad>