You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
8.9 KiB
O���SCAD

/*
Simple screwed pipe generator
By the DoomMeister
V1.0
//Released under the terms of the GNU GPL v3.0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
**
WARNING - No warrenty is given regarding the fitness of these parts to convey pressurised
media if they are fabricated by any means. The user takes all risk in terms of saftey, testing, and material choice.
**
This file will generate a range of Socket Type Pipe fittings either with threads or without, this
means that the resulting part could be a functional pipe fitting or used as a pattern for casting.
Dimensions are generally to BS 1387 heavy.
*/
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
use<fitting_end.scad>;
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//test area - comment out to use as module
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
pipe(size=0.5,length=100,threads=true);
/*
translate([40,0,0])color("orange")
_pipe(pod=21.7,pt=3.2,od= 0.825,core=0.734,tpi=14,length=200,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=100);
translate([100,0,0])color("indigo") pipe(size=2,qual=25);
*/
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//outer module - calls standard sizes
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
module pipe(size=0.5,type="std",threads=true,length=100,qual=50){
if(size==0.25){
if(threads){
_pipe(core=0.451,od=0.518,tpi=19,pod=13.9,pt=2.9,length=200,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=0.451,od=0.518,tpi=19,pod=13.9,pt=2.9,length=200,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==0.375){
if(threads){
_pipe(core=0.589,od=0.656,tpi=19,pod=17.4,pt=2.9,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=0.589,od=0.656,tpi=19,pod=17.4,pt=2.9,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==0.5){
if(threads){
_pipe(core=0.734,od=0.825,tpi=14,pod=21.70,pt=3.2,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=0.734,od=0.825,tpi=14,pod=21.70,pt=3.2,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==0.75){
if(threads){
_pipe(core=0.95,od=1.041,tpi=14,pod=27.20,pt=3.2,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=0.95,od=1.041,tpi=14,pod=27.20,pt=3.2,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==1){
if(threads){
_pipe(core=1.193,od=1.309,tpi=11,pod=34.2,pt=4,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=1.193,od=1.309,tpi=11,pod=34.2,pt=4,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==1.25){
if(threads){
_pipe(core=1.534,od=1.65,tpi=11,pod=42.9,pt=4,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=1.534,od=1.65,tpi=11,pod=42.9,pt=4,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==1.5){
if(threads){
_pipe(core=1.766,od=1.882,tpi=11,pod=48.8,pt=4,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=1.766,od=1.882,tpi=11,pod=48.8,pt=4,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==2){
if(threads){
_pipe(core=2.231,od=2.347,tpi=11,pod=60.80,pt=4.5,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=2.231,od=2.347,tpi=11,pod=60.80,pt=4.5,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==2.5){
if(threads){
_pipe(core=2.8436,od=2.960,tpi=11,pod=76.6,pt=4.5,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=2.8436,od=2.960,tpi=11,pod=76.6,pt=4.5,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==3){
if(threads){
_pipe(core=3.3436,od=3.46,tpi=11,pod=89.5,pt=5,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=3.3436,od=3.46,tpi=11,pod=89.5,pt=5,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==4){
if(threads){
_pipe(core=4.3336,od=4.45,tpi=11,pod=114.90,pt=5.4,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=4.3336,od=4.45,tpi=11,pod=114.90,pt=5.4,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==5){
if(threads){
_pipe(core=5.3336,od=5.45,tpi=11,pod=140.6,pt=5.4,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=5.3336,od=5.45,tpi=11,pod=140.6,pt=5.4,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
if(size==6){
if(threads){
_pipe(core=6.3336,od=6.45,tpi=11,pod=166.10,pt=5.4,length=length,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,qual=qual);
}
if(!threads){
_pipe(core=6.3336,od=6.45,tpi=11,pod=166.10,pt=5.4,length=length,thread_1=false,thread_2=false,no_threads_1=9,no_threads_2=9,qual=qual);
}
}
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//inner module - draws pipe
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
module _pipe(pod=34.20,pt=4,length=150,thread_1=true,thread_2=true,no_threads_1=9,no_threads_2=9,od= 1.309,core=1.193,tpi=11,qual=20){
union(){
if(thread_1){
fitting_end(core=core,od=od,tpi=tpi,pod=pod,pt=pt,l=length/2,no_threads=no_threads_1,threads=true,male=true,qual=qual);
}
if(!thread_1){
fitting_end(core=core,od=od,tpi=tpi,pod=pod,pt=pt,l=length/2,no_threads=no_threads_1,threads=false,male=true,qual=qual);
}
if(thread_2){
translate([0,0,length])
rotate([180,0,0])
fitting_end(core=core,od=od,tpi=tpi,pod=pod,pt=pt,l=length/2,no_threads=no_threads_2,threads=true,male=true,qual=qual);
}
if(!thread_2){
translate([0,0,length])
rotate([180,0,0])
fitting_end(core=core,od=od,tpi=tpi,pod=pod,pt=pt,l=length/2,no_threads=no_threads_2,threads=false,male=true,qual=qual);
}
//add the actual pipe
if(thread_1){
if (thread_2){
translate([0,0,no_threads_1*(25.4/tpi)])
difference(){
cylinder(h=length-(no_threads_1*(25.4/tpi)+no_threads_2*(25.4/tpi)),r1=pod/2,r2=pod/2,$fn=qual);
cylinder(h=length-(no_threads_1*(25.4/tpi)+no_threads_2*(25.4/tpi)),r1=(pod-pt)/2,r2=(pod-pt)/2,$fn=qual);
}
}
if (!thread_2){
translate([0,0,no_threads_1*(25.4/tpi)])
difference(){
cylinder(h=length-(no_threads_1*(25.4/tpi)),r1=pod/2,r2=pod/2,$fn=qual);
cylinder(h=length-(no_threads_1*(25.4/tpi)),r1=(pod-pt)/2,r2=(pod-pt)/2,$fn=qual);
}
}
}
if(!thread_1){
if (thread_2){
difference(){
cylinder(h=length-(no_threads_2*(25.4/tpi)),r1=pod/2,r2=pod/2,$fn=qual);
cylinder(h=length- (no_threads_2*(25.4/tpi)),r1=(pod-pt)/2,r2=(pod-pt)/2,$fn=qual);
}
}
if (!thread_2){
difference(){
cylinder(h=length,r1=pod/2,r2=pod/2,$fn=qual);
cylinder(h=length,r1=(pod-pt)/2,r2=(pod-pt)/2,$fn=qual);
}
}
}
}
}
1 year ago
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>