// potPH modular pot, units mm
$fn=48;
part="base"; shape="round";
w=76.2; wall=2.4;
base_h=25.4; top_h=38.1; plug_h=6; floor=2.8;
socket=w-2*wall; plug=socket-0.8; throat=plug-4.4;
module prism(d,h) { if(shape=="round") cylinder(d=d,h=h); else linear_extrude(height=h) square([d,d],center=true); }
module base() { difference(){ prism(w,base_h); translate([0,0,floor]) prism(socket,base_h-floor+0.1);
 for(x=[-2:2]) for(y=[-2:2]) let(px=x*(w/7),py=y*(w/7))
 if(shape=="square" ? (abs(px)<socket/2-5 && abs(py)<socket/2-5) : (px*px+py*py < pow(socket/2-5,2)))
 translate([px,py,-0.1]) cylinder(d=5.5,h=floor+0.2,$fn=16);
 } }
module extender(){difference(){union(){prism(plug,plug_h);translate([0,0,plug_h]) prism(w,top_h-plug_h);}
 translate([0,0,-0.1]) prism(throat,plug_h+2.1);
 translate([0,0,plug_h+2]) prism(socket,top_h-plug_h-1.9);
}}
if(part=="base") base(); if(part=="extender") extender();
