SCAD-Designs/Bottle Adapter/adapter.scad
2024-08-16 16:47:15 +02:00

68 lines
1.6 KiB
OpenSCAD

/*
module Adapter
parameters:
- height is the height of the Adapter (top to bottom)
- top_radius is the top radius
- bottom_radius is the bottom radius
*/
module Adapter(height, top_radius, bottom_radius) {
$fn = 128;
difference() {
cylinder(h = height, r1 = bottom_radius, r2 = top_radius);
translate([0,0,-0.5])
cylinder(h = height+1, r1 = bottom_radius*0.9, r2 = top_radius*.8);
}
}
/*
module PolyRing
parameters:
- height is the height of the Adapter (top to bottom)
- radius is the outer radius of the ring (inner radius is 80% of outer)
- sides is the number of sides at the ring
*/
module PolyRing(height, outer_radius, inner_radius, sides) {
$fn = sides;
difference() {
cylinder(h = height, r = outer_radius);
translate([0,0,-0.5])
cylinder(h = height+1, r = inner_radius);
}
}
/*
module BottleAdpater
parameters:
- radius is the radius defining the outer circle
- height is the height of the Adapter (top to bottom)
*/
module BottleAdapter(radius, height, adapter_radius) {
union() {
PolyRing(height/6, radius, radius*.6, 128);
translate([0, 0, height/6]) {
PolyRing(height/4, radius*0.95, radius*0.7, 8);
}
translate([0, 0, height*5/12]) {
PolyRing(height/8, radius*0.95, radius*0.7, 128);
}
translate([0, 0, height/2]) {
Adapter(height/2, adapter_radius, radius*.8);
}
}
}
BottleAdapter(32, 60, 40);
rotate([180, 0, 0])
BottleAdapter(32, 60, 32);