44 lines
		
	
	
		
			995 B
		
	
	
	
		
			OpenSCAD
		
	
	
	
	
	
		
		
			
		
	
	
			44 lines
		
	
	
		
			995 B
		
	
	
	
		
			OpenSCAD
		
	
	
	
	
	
|  | pump(4000, 10000, 1500); | ||
|  | 
 | ||
|  | module pump(width=30, height=70, radius=10) | ||
|  | { | ||
|  |     base(); | ||
|  |      | ||
|  |     piston(); | ||
|  | 
 | ||
|  |     module base() { | ||
|  |         difference() { | ||
|  |             cube(width, center=true); | ||
|  |             translate([0,0, -width/2]) | ||
|  |                 cylinder(h=width, r=radius); | ||
|  |         } | ||
|  |     } | ||
|  |      | ||
|  |     module piston() { | ||
|  |              | ||
|  |         function percent(base, p) = | ||
|  |             p /100 * base; | ||
|  |          | ||
|  |         function hand_z() = | ||
|  |             percent(width/2, 99) + | ||
|  |             height - (height - width); | ||
|  |          | ||
|  |         function hand_height() = | ||
|  |             width * 1.5; | ||
|  |          | ||
|  |         // Pump part
 | ||
|  |         translate([0, 0, percent(width/2, 99)])  | ||
|  |             cylinder( | ||
|  |                 h=height-width, | ||
|  |                 r=percent(radius, 98) | ||
|  |             ); | ||
|  |          | ||
|  |         // Hand part
 | ||
|  |         translate([-hand_height()/2, 0, hand_z()]) | ||
|  |             rotate([0, 90, 0]) | ||
|  |                 cylinder( | ||
|  |                     h=hand_height(), | ||
|  |                     r=percent(radius, 30) | ||
|  |                 ); | ||
|  |     } | ||
|  | } |