Welcome! Log In Create A New Profile

Advanced

How to make any object holow with OpenSCAD?

Posted by fsamir 
How to make any object holow with OpenSCAD?
February 08, 2013 01:58AM
Hi everyone,

I am trying to design an Y pipe with OpenScad and I am wondering if there is an easy way to make any object holow.

My design is basically 3 cylinders forming an Y and I would like to make it holow and open at the tips.
I tried something like this without much success:
difference() {
  yTube();
  scale(v=[0.8, 0.8, 1.1]) yTube();
}

The more verbose version, which is also not finished is below:


use 
wall_t = 2.5;

pump_r = 25;
ext_r = pump_r + wall_t;
int_r = pump_r;

connector_h=30;


left_arm_lenght= 40;
right_arm_lenght= 40;

free_fit = 0.2;
angle_left = 45;
angle_right = -90;
a_bit = 0.1;

junction_z = connector_h + ext_r/2;


main();

module main(){	
	difference(){
		external();	
		 % internal();		


	}
}


module internal() {
//	union(){
		//vertical tube
		translate(v=[0,0,connector_h/2])	
		cylinder(r=int_r, h=connector_h * 1.5, center=true);
	
		//left arm
		translate(v=[0,0, junction_z]) rotate([angle_left, 0, 0]) 	
		cylinder(r=int_r, h=left_arm_lenght*1.2, center=true);
	
		//right arm
		translate(v=[0,0, junction_z])	rotate([angle_right, 0, 0]) 	
		cylinder(r=int_r, h=right_arm_lenght*1.2, center=true);
	
		//junction
//		translate(v=[0,0, junction_z])	rotate([0, 90, 0]) 	
//		cylinder(r=int_r, h=ext_r * 1.9, center=true);
//	}
}
module external(){
	union(){
		translate(v=[0,0,connector_h/2])	tube(connector_h, ext_r, wall_t, true);				
	
		//left arm
		translate(v=[0,0, junction_z]) rotate([angle_left, 0, 0]) 	
		tube(left_arm_lenght, ext_r, wall_t, false);		
	
		//right arm
		translate(v=[0,0, junction_z])	rotate([angle_right, 0, 0]) 	
		tube(right_arm_lenght, ext_r, wall_t, false);				
	
		//junction
		translate(v=[0,0, junction_z])	rotate([0, 90, 0]) 	
		cylinder(r=ext_r, h=ext_r * 2, center=true);
	}
}

module external_tubes() {
	//horizontal
	//translate(v=[0,0, connector_h + ext_r]) rotate([90, 0, 0]) 	cylinder(r=ext_r, h=arms_l, center=true);			
	//vertical
	translate(v=[0,0, connector_h/2])  cylinder(r=ext_r, h=connector_h, center=true);		
	
	//y		
	translate(v=[0,-10, connector_h + ext_r]) rotate([angle_left, 0, 0]) 	
	cylinder(r=ext_r, h=left_arm_lenght, center=true);			
}

Edited 2 time(s). Last edit at 02/08/2013 02:00AM by fsamir.


Cheers,
Franklin Dattein
Re: How to make any object holow with OpenSCAD?
February 09, 2013 01:10AM
try something like this (subtracting the hollow part from a solid model):

difference()
{
	for(i=[0:2])
	rotate([0,120*i,0])
	cylinder(r=50,h=70);

	for(i=[0:2])
	rotate([0,120*i,0])
	translate([0,0,-1])
	cylinder(r=40,h=72);
}
Sorry, only registered users may post in this forum.

Click here to login