-
Notifications
You must be signed in to change notification settings - Fork 171
/
Copy pathjoiners.scad
179 lines (138 loc) · 4.1 KB
/
joiners.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
include <config.scad>
use <GDMUtils.scad>
module half_joiner_clear(h=20, w=10, a=30, clearance=0)
{
dmnd_height = h*1.0;
dmnd_width = dmnd_height*tan(a);
guide_size = w/3;
guide_width = 2*(dmnd_height/2-guide_size)*tan(a);
difference() {
// Diamonds.
scale([w+clearance, dmnd_width/2, dmnd_height/2]) {
xrot(45) cube(size=[1,sqrt(2),sqrt(2)], center=true);
}
// Blunt point of tab.
grid_of(ya=[-(guide_width/2+2), (guide_width/2+2)]) {
cube(size=[(w+clearance)*1.05, 4, h*0.99], center=true);
}
}
}
//half_joiner_clear();
module half_joiner(h=20, w=10, l=10, a=30, screwsize=undef, guides=true, slop=printer_slop)
{
dmnd_height = h*1.0;
dmnd_width = dmnd_height*tan(a);
guide_size = w/3;
guide_width = 2*(dmnd_height/2-guide_size)*tan(a);
difference() {
union() {
// Make base.
difference() {
// Solid backing base.
translate([0,-l/2,0])
cube(size=[w, l, h], center=true);
// Clear diamond for tab
grid_of(xa=[-(w*2/3), (w*2/3)]) {
half_joiner_clear(h=h+0.01, w=w, clearance=slop*2, a=a);
}
}
difference() {
// Make tab
scale([w/3-slop*2, dmnd_width/2, dmnd_height/2]) xrot(45)
cube(size=[1,sqrt(2),sqrt(2)], center=true);
// Blunt point of tab.
translate([0,guide_width/2+2,0])
cube(size=[w*0.99,4,guide_size*2], center=true);
}
// Guide ridges.
if (guides == true) {
xspread(w/3-slop*2) {
// Guide ridge.
fwd(0.05/2) {
scale([0.75, 1, 2]) yrot(45)
cube(size=[guide_size/sqrt(2), guide_width+0.05, guide_size/sqrt(2)], center=true);
}
// Snap ridge.
scale([0.25, 0.5, 1]) zrot(45)
cube(size=[guide_size/sqrt(2), guide_size/sqrt(2), dmnd_width], center=true);
}
}
}
// Make screwholes, if needed.
if (screwsize != undef) {
yrot(90) cylinder(r=screwsize*1.1/2, h=w+1, center=true, $fn=12);
}
}
}
//half_joiner(screwsize=3);
module half_joiner2(h=20, w=10, l=10, a=30, screwsize=undef, guides=true)
{
difference() {
union () {
translate([0,-l/2,0])
cube(size=[w, l, h], center=true);
half_joiner_clear(h=h, w=w, a=a);
}
// Subtract mated half_joiner.
zrot(180) half_joiner(h=h+0.05, w=w+0.05, l=l+0.05, a=a, screwsize=undef, guides=guides, slop=0.0);
// Make screwholes, if needed.
if (screwsize != undef) {
yrot(90) cylinder(r=screwsize*1.1/2, h=w+1, center=true, $fn=12);
}
}
}
//half_joiner2(screwsize=3);
module joiner(h=40, w=10, l=10, a=30, screwsize=undef, guides=true, slop=printer_slop)
{
union() {
translate([0,0,h/4])
half_joiner(h=h/2, w=w, l=l, a=a, screwsize=screwsize, guides=guides, slop=slop);
translate([0,0,-h/4])
half_joiner2(h=h/2, w=w, l=l, a=a, screwsize=screwsize, guides=guides);
}
}
//joiner(screwsize=3);
module joiner_clear(h=40, w=10, a=30, clearance=0)
{
grid_of(za=[-h/4,h/4]) {
half_joiner_clear(h=h/2.0, w=w, a=a, clearance=clearance);
}
}
//joiner_clear();
module joiner_pair(spacing=100, h=40, w=10, l=10, a=30, screwsize=undef, guides=true)
{
yrot_copies([0,180]) {
translate([spacing/2, 0, 0]) {
joiner(h=h, w=w, l=l, a=a, screwsize=screwsize, guides=guides);
}
}
}
//joiner_pair(spacing=100, h=40, w=10, l=10, a=30, screwsize=3, guides=true);
module joiner_pair_clear(spacing=100, h=40, w=10, a=30, clearance=0)
{
yrot_copies([0,180]) {
translate([spacing/2, 0, 0]) {
joiner_clear(h=h, w=w, a=a, clearance=clearance);
}
}
}
//joiner_pair_clear(spacing=100, h=40, w=10, a=30);
module joiner_quad(xspacing=100, yspacing=50, h=40, w=10, l=10, a=30, screwsize=undef, guides=true)
{
zrot_copies([0,180]) {
translate([0, yspacing/2, 0]) {
joiner_pair(spacing=xspacing, h=h, w=w, l=l, a=a, screwsize=screwsize, guides=guides);
}
}
}
//joiner_quad(xspacing=100, yspacing=50, h=40, w=10, l=10, a=30, screwsize=3, guides=true);
module joiner_quad_clear(xspacing=100, yspacing=50, h=40, w=10, a=30, clearance=0)
{
zrot_copies([0,180]) {
translate([0, yspacing/2, 0]) {
joiner_pair_clear(spacing=xspacing, h=h, w=w, a=a, clearance=clearance);
}
}
}
//joiner_quad_clear(xspacing=100, yspacing=50, h=40, w=10, a=30);
// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap