-
Notifications
You must be signed in to change notification settings - Fork 2
/
tube_connectors.scad
92 lines (77 loc) · 2.9 KB
/
tube_connectors.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Copyright 2010 Elmo Mäntynen
// Licensed as GPL 2 or later
include <MCAD/units.scad>
include <MCAD/materials.scad>
use <MCAD/shapes.scad>
use <MCAD/utilities.scad>
// Different kinds of tube connectors etc.
// dimensions for tubes as follows:
// connector(in=[ID, OD, contactlen], out=[ID, OD, contactlen])
// contactlen is the actual lenght of tube on connector
// placement is either "flat" or "corner"
//Usable for 3-6 out connectors
module star_connector(out_no=6, in, out, placement="corner", demo=false){
thickness = out[0];
translate([0, 0, thickness/2]) union(){
difference(){
union(){
symmetric_star_connector(no=out_no, tube=out, placement=placement, center=true, demo=demo);
translate([0, 0, thickness/2-0.1])
cylinder(r=in[0]/2, h=out[2]);
}
translate([0, 0, out[2]/2+0.3*thickness])
cylinder(r=0.6*in[0]/2, h=out[2]+thickness+0.1, center=true);
}
}
}
//Usable for 3-6 connectors
module symmetric_star_connector(no=3, tube, placement="corner", center=false, demo=false){
thickness = tube[0];
raise = center ? 0 : thickness/2;
placement = placement=="flat" ? 0 : 0.5;
translate([0, 0, raise]) union(){
difference(){
union(){
linear_extrude(height=thickness, center=true)
ngon(sides=no, radius=tube[2], center=true);
spin(no, angle=360, axis=[0, 0, 1]){
rotate([0, 90, placement*360/no]) union(){
translate([0, 0, tube[2]]) rotate([0, 0, 360/40])
cylinder(r=1.0125*tube[0]/2, h=tube[2]*2, center=true, $fn=20);
if (demo==true){
translate([0, 0, 5*mm+tube[2]]) color(BlackPaint)
tube2(OD=tube[1], ID=tube[0], height=7*cm);
}
}
}
}
spin(no, angle=360, axis=[0, 0, 1]){
rotate([0, 90, placement*360/no]) translate([0, 0, tube[2]])
cylinder(r=0.6*tube[0]/2, h=tube[2]*2+0.1, center=true);
}
}
}
}
// ---------------------
// Tests
tube1 = [10*mm, 12*mm, 20*mm];
tube2 = [10*mm, 12*mm, 20*mm];
module test_star_connector_1to6(){
star_connector(out_no=6, in=tube1, out=tube2, demo=true);
}
//test_star_connector_1to6();
module test_star_connector_1to3(){
difference(){
star_connector(out_no=3, in=tube1, out=tube2, demo=false);
translate([0, 0, 15]) cube(18, center=true);
}
}
//test_star_connector_1to3();
module test_symmetric_star_connector(){
difference(){
symmetric_star_connector(no=3, tube=tube1, demo=false);
translate([0, 0, 15]) cube(18, center=true);
}
}
//test_symmetric_star_connector();
//symmetric_star_connector(no=3, tube=tube1, placement="corner", demo=false);