powder-loader/powder-loader.scad

163 lines
3.9 KiB
OpenSCAD

overall_cylinder_diam = 41;
chamber_to_center = 6.96;
chamber_diam = 11.45;
bottom_height = 3;
top_height = 20;
opening_sep = 0.1;
border = 1;
funnel_size = 1;
part = 0;
part_sep = 0.5;
module _end_of_customizer() {}
assert(part >= 0 && part <= 2);
$fn = $preview?30:80;
module overall_cylinder() {
translate([0, 0, -20])
difference() {
cylinder(d = overall_cylinder_diam, h = 20);
for(i = [0:5]) {
rotate([0, 0, i/6*360])
translate([chamber_to_center + chamber_diam/2, 0, -1])
cylinder(d = chamber_diam, h = 22);
}
}
}
if($preview && part == 0)
color("#777")
overall_cylinder();
module bottom() {
difference() {
union() {
for(i = [0:5]) {
rotate([0, 0, i / 6 * 360])
bottom_part();
}
}
translate([0, 0, bottom_height])
connection(true);
}
}
center_to_bottom_opening_center = chamber_to_center + chamber_diam / 2;
bottom_opening_diam = center_to_bottom_opening_center * sin(360 / 12) - opening_sep;
module bottom_part() {
difference() {
union() {
rotate([0, 0, 360/12])
linear_extrude(bottom_height)
polygon([
[0, 0],
[overall_cylinder_diam / 2 * cos(360 / 12), overall_cylinder_diam / 2 * sin(360 / 12)],
[overall_cylinder_diam / 2 * cos(360 / 12), -overall_cylinder_diam / 2 * sin(360 / 12)],
]);
translate([center_to_bottom_opening_center, 0, -funnel_size])
cylinder(
d1 = bottom_opening_diam,
d2 = bottom_opening_diam + funnel_size,
h = funnel_size
);
}
translate([center_to_bottom_opening_center, 0, -1 - funnel_size])
cylinder(d = bottom_opening_diam, h = bottom_height + 2 + funnel_size);
rotate([0, 0, 360/6])
translate([center_to_bottom_opening_center, 0, -1 - funnel_size])
cylinder(d = bottom_opening_diam, h = bottom_height + 2 + funnel_size);
}
}
if(part == 0 || part == 1)
color("#dd08")
intersection() {
bottom();
translate([0, 0, -1])
cylinder(d = 12, h = 5);
}
module top() {
for(i = [0:5]) {
rotate([0, 0, i / 6 * 360])
top_part();
}
connection(false);
}
module top_part() {
difference() {
linear_extrude(top_height)
polygon([
[0, 0],
[overall_cylinder_diam / 2 * cos(360 / 12), overall_cylinder_diam / 2 * sin(360 / 12)],
[overall_cylinder_diam / 2 * cos(360 / 12), -overall_cylinder_diam / 2 * sin(360 / 12)],
]);
top_part_hollow();
}
}
module top_part_hollow() {
adjusted_radius = overall_cylinder_diam / 2 - border;
hull() {
translate([center_to_bottom_opening_center, 0, 0])
cylinder(d = bottom_opening_diam, h = 0.1);
translate([0, 0, top_height - 0.1 - border])
linear_extrude(0.1)
polygon([
[border, 0],
[adjusted_radius * cos(360 / 12), adjusted_radius * sin(360 / 12) - border / 2],
[adjusted_radius * cos(360 / 12), -adjusted_radius * sin(360 / 12) + border / 2],
]);
}
}
if(part == 0 || part == 2)
color("#4d48")
translate([0, 0, bottom_height + part_sep])
intersection() {
top();
translate([0, 0, -4])
cylinder(d = 12, h = 5);
}
module connection(hole) {
sep_hole = hole?part_sep:0;
sep_screw = hole?0:part_sep;
translate([0, 0, -1.5 - sep_screw * 2])
cylinder(d = 4 + sep_hole, h = 1.5 + sep_screw * 2);
translate([0, 0, -3 - sep_screw * 2])
cylinder(d1 = 8 + sep_hole, d2 = 4 + sep_hole, h = 1.5);
}
if($preview && part == 1)
color("#f008")
for(i = [0:5]) {
rotate([0, 0, i/6*360 + 360 / 12])
translate([center_to_bottom_opening_center, 0, 01])
cylinder(d = bottom_opening_diam, h = bottom_height + 2);
}