-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgridfinity_sv03_max_baseplate.scad
222 lines (184 loc) · 6.36 KB
/
gridfinity_sv03_max_baseplate.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
include <libs/gridfinity/gridfinity-rebuilt-utility.scad>
include <libs/gridfinity/standard.scad>
/* [Setup Parameters] */
$fa = 8;
$fs = 0.25;
// module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true, only_corners=false) {
module sv03Base (gridx=3, gridy=3, offCenter=true) {
translate([
offCenter ? (gridx * l_grid) / 2 : 0,
offCenter ? (gridy * l_grid) / 2 : 0,
0
]) {
render (30) {
gridfinityBase(gridx, gridy, l_grid, 0, 0, 0);
}
}
}
module sv03Baseplate(gridx=3, gridy=3, plate=0, holes=2, fit=[0,0], fitDirection=[0,0], offCenter=true) {
/* [General Settings] */
// number of bases along x-axis
// gridx = 3;
// number of bases along y-axis
// gridy = 3;
/* [Screw Together Settings - Defaults work for M3 and 4-40] */
// screw diameter
d_screw = 3.35;
// screw head diameter
d_screw_head = 5;
// screw spacing distance
screw_spacing = .5;
// number of screws per grid block
n_screws = 1; // [1:3]
/* [Fit to Drawer] */
// minimum length of baseplate along x (leave zero to ignore, will automatically fill area if gridx is zero)
distancex = fit[0];
// minimum length of baseplate along y (leave zero to ignore, will automatically fill area if gridy is zero)
distancey = fit[1];
// where to align extra space along x
fitx = fitDirection[0]; // [-1:0.1:1]
// where to align extra space along y
fity = fitDirection[1]; // [-1:0.1:1]
/* [Styles] */
// baseplate styles
style_plate = plate; // [0: thin, 1:weighted, 2:skeletonized, 3: screw together, 4: screw together minimal]
// enable magnet hole
enable_magnet = true;
// hole styles
style_hole = holes; // [0:none, 1:contersink, 2:counterbore]
// ===== IMPLEMENTATION ===== //
render(30) {
translate([
offCenter ? (gridx * l_grid) / 2 : 0,
offCenter ? (gridy * l_grid) / 2 : 0,
0
]) {
color("tomato")
gridfinityBaseplate(gridx, gridy, l_grid, distancex, distancey, style_plate, enable_magnet, style_hole, fitx, fity);
}
}
}
// ===== CONSTRUCTION ===== //
module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fity) {
assert(gridx > 0 || dix > 0, "Must have positive x grid amount!");
assert(gridy > 0 || diy > 0, "Must have positive y grid amount!");
// whether screw together or not
st = (sp == 3 || sp == 4);
gx = gridx == 0 ? floor(dix/length) : gridx;
gy = gridy == 0 ? floor(diy/length) : gridy;
dx = max(gx*length-0.5, dix);
dy = max(gy*length-0.5, diy);
off = calculate_off(sp, sm, sh, st);
offsetx = dix < dx ? 0 : (gx*length-0.5-dix)/2*fitx*-1;
offsety = diy < dy ? 0 : (gy*length-0.5-diy)/2*fity*-1;
difference() {
translate([offsetx,offsety,h_base])
mirror([0,0,1])
rounded_rectangle(dx, dy, h_base+off, r_base);
gridfinityBase(gx, gy, length, 1, 1, 0, 0.5, false);
translate([offsetx,offsety,h_base-0.6])
rounded_rectangle(dx*2, dy*2, h_base*2, r_base);
pattern_linear(gx, gy, length) {
render(convexity = 6) {
if (sp == 1)
translate([0,0,-off])
cutter_weight();
else if (sp == 2 || sp == 3)
linear_extrude(10*(h_base+off), center = true)
profile_skeleton();
else if (sp == 4)
translate([0,0,-5*(h_base+off)])
rounded_square(length-2*r_c2-2*r_c1, 10*(h_base+off), r_fo3);
hole_pattern(){
if (sm) block_base_hole(1);
translate([0,0,-off])
if (sh == 1) cutter_countersink();
else if (sh == 2) cutter_counterbore();
}
}
}
if (sp == 3 || sp ==4) cutter_screw_together(gx, gy, off);
}
}
function calculate_off(sp, sm, sh, st) =
st
? 6.75
:sp==0
?0
: sp==1
?bp_h_bot
:h_skel + (sm
?h_hole
: 0)+(sh==0
? d_screw
: sh==1
?d_cs
:h_cb);
module cutter_weight() {
union() {
linear_extrude(bp_cut_depth*2,center=true)
square(bp_cut_size, center=true);
pattern_circular(4)
translate([0,10,0])
linear_extrude(bp_rcut_depth*2,center=true)
union() {
square([bp_rcut_width, bp_rcut_length], center=true);
translate([0,bp_rcut_length/2,0])
circle(d=bp_rcut_width);
}
}
}
module hole_pattern(){
pattern_circular(4)
translate([l_grid/2-d_hole_from_side, l_grid/2-d_hole_from_side, 0]) {
render();
children();
}
}
module cutter_countersink(){
cylinder(r = r_hole1+d_clear, h = 100*h_base, center = true);
translate([0,0,d_cs])
mirror([0,0,1])
hull() {
cylinder(h = d_cs+10, r=r_hole1+d_clear);
translate([0,0,d_cs])
cylinder(h=d_cs+10, r=r_hole1+d_clear+d_cs);
}
}
module cutter_counterbore(){
cylinder(h=100*h_base, r=r_hole1+d_clear, center=true);
difference() {
cylinder(h = 2*(h_cb+0.2), r=r_cb, center=true);
copy_mirror([0,1,0])
translate([-1.5*r_cb,r_hole1+d_clear+0.1,h_cb-h_slit])
cube([r_cb*3,r_cb*3, 10]);
}
}
module profile_skeleton() {
l = l_grid-2*r_c2-2*r_c1;
minkowski() {
difference() {
square([l-2*r_skel+2*d_clear,l-2*r_skel+2*d_clear], center = true);
pattern_circular(4)
translate([l_grid/2-d_hole_from_side,l_grid/2-d_hole_from_side,0])
minkowski() {
square([l,l]);
circle(r_hole2+r_skel+2);
}
}
circle(r_skel);
}
}
module cutter_screw_together(gx, gy, off) {
screw(gx, gy);
rotate([0,0,90])
screw(gy, gx);
module screw(a, b) {
copy_mirror([1,0,0])
translate([a*l_grid/2, 0, -off/2])
pattern_linear(1, b, 1, l_grid)
pattern_linear(1, n_screws, 1, d_screw_head + screw_spacing)
rotate([0,90,0])
cylinder(h=l_grid/2, d=d_screw, center = true);
}
}