-rw-r--r-- | mixing.scad | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/mixing.scad b/mixing.scad new file mode 100644 index 0000000..ecbdfd8 --- a/dev/null +++ b/mixing.scad | |||
@@ -0,0 +1,56 @@ | |||
1 | s=2; /* shell thickness */ | ||
2 | defaultvolume=20*10*20; /* volume for testing */ | ||
3 | |||
4 | /* side of the cube, containing half the volume */ | ||
5 | function mixing_hvs(volume=defaultvolume) = pow(volume/2,1/3); | ||
6 | /* vessel dimensions */ | ||
7 | function mixing_size(volume=defaultvolume) = let(hvs = mixing_hvs(volume=volume)) [2*hvs+3*s,hvs+2*s,hvs+2*s]; | ||
8 | |||
9 | module mixing( | ||
10 | volume=defaultvolume,/* volume in cubic mm */ | ||
11 | what="altogethernow"/* vessel|splitter|altogethernow */ | ||
12 | ) { | ||
13 | g=1; /* guide diameter */ | ||
14 | hvs = mixing_hvs(volume=volume); | ||
15 | if(what=="vessel") { | ||
16 | sz = mixing_size(volume=volume); | ||
17 | translate([-sz[0]/2,-sz[1]/2,0]) difference() { | ||
18 | cube(size=sz); | ||
19 | translate([s,s,s]) | ||
20 | cube(size=[2*hvs+s,hvs,hvs+s+1]); | ||
21 | } | ||
22 | for(mx=[0,1]) mirror([mx,0,0]) { | ||
23 | // horizontal guide | ||
24 | translate([s/2+g/2,0,s]) rotate([90,0,0]) cylinder(d=g,h=hvs+s,center=true,$fn=12); | ||
25 | for(my=[0,1]) mirror([0,my,0]) { | ||
26 | // vertical guide + crowning sphere | ||
27 | translate([s/2+g/2,hvs/2,0]) { | ||
28 | cylinder(d=g,h=hvs+2*s-g/2,$fn=12); | ||
29 | translate([0,0,s+hvs+s-g/2]) sphere(d=g,$fn=12); | ||
30 | } | ||
31 | } | ||
32 | // level | ||
33 | translate([0,0,s+hvs]) { | ||
34 | translate([s/2+hvs,0,0]) rotate([90,0,0]) cylinder(d=g,h=hvs+s,center=true,$fn=12); | ||
35 | for(my=[0,1]) mirror([0,my,0]) { | ||
36 | translate([s/2+g/2,hvs/2,0]) rotate([0,90,0]) cylinder(d=g,h=hvs-g/2+s/2,$fn=12); | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | }else if(what=="splitter") { | ||
41 | hull() { | ||
42 | translate([-s/2,-hvs/2,0]) cube(size=[s,hvs,hvs+2*s]); | ||
43 | cd=hvs/2; | ||
44 | for(yz=[ [0,2*hvs], [-hvs/2+cd/2,hvs+2*s], [hvs/2-cd/2,hvs+2*s] ]) | ||
45 | translate([0,yz[0],yz[1]]) | ||
46 | rotate([0,90,0]) cylinder(d=cd,h=s,$fn=60,center=true); | ||
47 | } | ||
48 | translate([0,0,2*hvs]) sphere(d=2*s,$fn=30); | ||
49 | }else if(what=="altogethernow") { | ||
50 | mixing(volume=volume,what="vessel"); | ||
51 | translate([0,0,s]) mixing(volume=volume,what="splitter"); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | color("salmon",0.7) mixing(what="altogethernow"); | ||
56 | /* vim:set ai sw=1: */ | ||