CommitLineData
7db674d2
CE
1/* OpenSCAD Joint Connectors v1.0 by MakerBlock */
2/* Published on October 31, 2012 */
3/* www.thingiverse.com/thing:33426 */
4/* Creative Commons - Attribution */
5
6// Settings
7 facets = 32;
8 tolerance = 0.3;
9 rotation_degrees = 20;
10
12
14 {
15 // Hypothetical build platform
16 % cube([100,100,0.1], center=true);
17 // A single end male connector, on its side
18 translate([0,0,0]) joint_male(male_joint_width=3, male_joint_thickness=3, male_joint_height=10, side=true);
19 // A single end male connector, upright
20 translate([-8,0,0]) joint_male(male_joint_width=3, male_joint_thickness=3, male_joint_height=10, side=false);
21 // A dual end male connector
22 translate([-16,0,0])
23 {
24 for (i=[0,1]) mirror([0,i,0])
25 translate([0,-10/2,0]) joint_male(male_joint_width=3, male_joint_thickness=3, male_joint_height=10, side=true);
26 }
27 // A female connector, with 0 degrees range of movement
28 translate([8,0,10/2])
29 {
30 difference()
31 {
32 cube([6,6,10], center=true);
33 translate([0,0,2]) joint_male_negative(male_joint_width=3, male_joint_thickness=3, male_joint_height=10);
34 }
35 }
36 // A female connector, with 180 degrees range of movement
37 translate([16,0,10/2])
38 {
39 difference()
40 {
41 cube([6,6,10], center=true);
42 translate([0,0,2])
43 joint_male_negative(male_joint_width=3, male_joint_thickness=3, forward_rom=90, backward_rom=90, male_joint_height=10);
44 }
45 }
46 // A female connector, with a range of movement of 30 degrees forward and 90 degrees backward, and a clearance edge of 3mm
47 translate([24,0,10/2])
48 {
49 difference()
50 {
51 cube([6,6,10], center=true);
52 translate([0,0,2])
53 joint_male_negative(male_joint_width=3, male_joint_thickness=3, forward_rom=30,
54 backward_rom=90, clearance_edge=3, male_joint_height=10);
55 }
56 }
57 }
58
59module joint_male(male_joint_width=4, male_joint_thickness=4, male_joint_height=8, fn=facets, side=false)
60 {
61 if (side==false)
62 { joint_male_vertical(male_joint_width, male_joint_thickness, male_joint_height, fn=facets); }
63 else if (side==true)
64 { joint_male_horizontal(male_joint_width, male_joint_thickness, male_joint_height, fn=facets); }
65 }
66
67module joint_female();
68 {
69
70 }
71
72module joint_male_negative(male_joint_width=4, male_joint_thickness=5, male_joint_height=8,
73 forward_rom=0, backward_rom=0, clearance_edge=0, fn=facets)
74 {
75 // Spherical axis/hinge bit
76 for (i=[0,1]) mirror([i,0,0])
77 translate([(male_joint_width/2-male_joint_thickness/8+tolerance), 0, 0]) rotate([0,90,0])
78 sphere(r=male_joint_thickness/4+tolerance, \$fn=fn/2);
79 // Rotated cutout
80 rotate([0,-90,0]) difference()
81 {
82 linear_extrude(height=male_joint_width+tolerance*2+clearance_edge*2, center=true)
83 {
84 // Forward rotation
85 hull()
86 {
87 circle(r=male_joint_thickness/2+tolerance, \$fn=fn);
88 for(i=[0:-forward_rom/rotation_degrees]) rotate([0,0,i*rotation_degrees])
89 translate([male_joint_height+(male_joint_thickness/2+tolerance)*2,0,0])
90 { square((male_joint_thickness/2+tolerance)*2, center=true); }
91 }
92 // Backward rotation
93 mirror([0,1,0]) hull()
94 {
95 circle(r=male_joint_thickness/2+tolerance, \$fn=fn);
96 for(j=[0:-backward_rom/rotation_degrees]) rotate([0,0,j*rotation_degrees])
97 translate([male_joint_height+(male_joint_thickness/2+tolerance)*2,0,0])
98 { square((male_joint_thickness/2+tolerance)*2, center=true); }
99 }
100 }
101 for(i=[0,1]) mirror([0,0,i])
102 translate([0,0,male_joint_width/2+tolerance])
103 cylinder(r=male_joint_thickness, h=male_joint_width+tolerance*2, \$fn=fn, center=false);
104 }
105 }
106
107module joint_male_vertical(male_joint_width=4, male_joint_thickness=5, male_joint_height=8, fn=facets)
108 {
109 difference()
110 {
111 joint_male_solid(male_joint_width, male_joint_thickness, male_joint_height, fn);
112 joint_male_cutout(male_joint_width, male_joint_thickness, male_joint_height, fn);
113 }
114 }
115
116module joint_male_horizontal(male_joint_width=4, male_joint_thickness=5, male_joint_height=8, fn=facets)
117 {
118 translate([0,male_joint_height/2,male_joint_thickness/2]) rotate([90,0,0])
119 joint_male_vertical(male_joint_width, male_joint_thickness, male_joint_height, fn);
120 }
121
122module joint_male_solid(male_joint_width=4, male_joint_thickness=5, male_joint_height=8, fn=facets)
123 {
124 difference()
125 {
126 union()
127 {
128 // Main joint
129 translate([0,0,(male_joint_height-male_joint_thickness/2)/2])
130 cube([male_joint_width, male_joint_thickness, male_joint_height-male_joint_thickness/2], center=true);
131 // Rounded edge of joint
132 translate([0,0,male_joint_height-male_joint_thickness/2]) rotate([0,90,0])
133 cylinder(r=male_joint_thickness/2, h=male_joint_width, center=true,\$fn=fn);
134 // Sphere/buds, on either side
135 for (i=[0,1])
136 {
137 mirror([i,0,0]) translate([(male_joint_width/2-male_joint_thickness/8+tolerance), 0, male_joint_height-male_joint_thickness/2])
138 sphere(r=male_joint_thickness/4, \$fn=fn/2);
139 }
140 }
141 // In some circumstances, the rounded edge can protrude below the build surface, this cuts that off
142 if (male_joint_thickness>male_joint_height)
143 {
144 translate([0,0,-male_joint_height*1.1/2])
145 cube([male_joint_width+male_joint_thickness/2, male_joint_thickness+1, male_joint_height*1.1], center=true);
146 }
147 }
148 }
149
150module joint_male_cutout(male_joint_width=4, male_joint_thickness=5, male_joint_height=8, fn=facets)
151 {
152 // Middle cutout - this is important so that the part will flex as it is inserted. We need to consider several uses
153
154 // Thin, but wide male connector
155 if (male_joint_height > male_joint_width*1.5 && male_joint_width > male_joint_thickness*1.5)
156 {
157 translate([0,0,male_joint_height*3/2-male_joint_width])
158 cube([male_joint_width/3, male_joint_thickness+1, male_joint_height], center=true);
159 }
160 // Thick, but narrow male connector
161 else if (male_joint_height-male_joint_thickness > male_joint_width && male_joint_width < male_joint_thickness)
162 {
163 translate([0,0,male_joint_height*3/2-male_joint_thickness])
164 cube([male_joint_width/4, male_joint_thickness+1, male_joint_height], center=true);
165 }
166 // Square footprint male connector
167 else if (male_joint_height-male_joint_thickness > male_joint_width && male_joint_width == male_joint_thickness)
168 {
169 translate([0,0,male_joint_height*3/2-male_joint_thickness*1.25])
170 cube([male_joint_width/4, male_joint_thickness+1, male_joint_height], center=true);
171 }
172 // Cases where the connector is really short
173 else
174 {
175 translate([0,0,male_joint_height/2+male_joint_height*0.25])
176 cube([male_joint_width/4, male_joint_thickness+1, male_joint_height], center=true);
177 }
178
179 }