Skip to content

Commit 3f2c6e2

Browse files
Merge pull request #179 from EmperorArthur/update_holes
Add Multiple Options for Hole Configuration
2 parents 36345f3 + 43b0b35 commit 3f2c6e2

39 files changed

+1102
-152
lines changed

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11

22
ignore/
3-
gridfinity-rebuilt.json
4-
gridfinity-rebuilt-bins.json
53
stl/
64
batch/
75
site/
8-
*.json
6+
/*.json
7+
8+
# From https://github.com/github/gitignore/blob/main/Python.gitignore
9+
# Byte-compiled / optimized / DLL files
10+
__pycache__/
11+
*.py[cod]
12+
*$py.class

generic-helpers.scad

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
function clp(x,a,b) = min(max(x,a),b);
77

8+
function is_even(number) = (number%2)==0;
9+
810
module rounded_rectangle(length, width, height, rad) {
911
linear_extrude(height)
1012
offset(rad)

gridfinity-rebuilt-baseplate.scad

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include <gridfinity-rebuilt-utility.scad>
22
include <standard.scad>
3+
use <gridfinity-rebuilt-holes.scad>
34

45
// ===== INFORMATION ===== //
56
/*
@@ -49,23 +50,29 @@ fity = 0; // [-1:0.1:1]
4950
// baseplate styles
5051
style_plate = 0; // [0: thin, 1:weighted, 2:skeletonized, 3: screw together, 4: screw together minimal]
5152

52-
// enable magnet hole
53-
enable_magnet = true;
5453

5554
// hole styles
5655
style_hole = 2; // [0:none, 1:countersink, 2:counterbore]
5756

57+
/* [Magnet Hole] */
58+
// Baseplate will have holes for 6mm Diameter x 2mm high magnets.
59+
enable_magnet = true;
60+
// Magnet holes will have crush ribs to hold the magnet.
61+
crush_ribs = true;
62+
// Magnet holes will have a chamfer to ease insertion.
63+
chamfer_holes = true;
64+
65+
hole_options = bundle_hole_options(refined_hole=false, magnet_hole=enable_magnet, screw_hole=false, crush_ribs=crush_ribs, chamfer=chamfer_holes, supportless=false);
5866

5967
// ===== IMPLEMENTATION ===== //
60-
screw_together = (style_plate == 3 || style_plate == 4);
6168

6269
color("tomato")
63-
gridfinityBaseplate(gridx, gridy, l_grid, distancex, distancey, style_plate, enable_magnet, style_hole, fitx, fity);
70+
gridfinityBaseplate(gridx, gridy, l_grid, distancex, distancey, style_plate, hole_options, style_hole, fitx, fity);
6471

6572

6673
// ===== CONSTRUCTION ===== //
6774

68-
module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fity) {
75+
module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, hole_options, sh, fitx, fity) {
6976

7077
assert(gridx > 0 || dix > 0, "Must have positive x grid amount!");
7178
assert(gridy > 0 || diy > 0, "Must have positive y grid amount!");
@@ -75,7 +82,7 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fit
7582
dx = max(gx*length-bp_xy_clearance, dix);
7683
dy = max(gy*length-bp_xy_clearance, diy);
7784

78-
off = calculate_off(sp, sm, sh);
85+
off = calculate_offset(sp, hole_options[1], sh);
7986

8087
offsetx = dix < dx ? 0 : (gx*length-bp_xy_clearance-dix)/2*fitx*-1;
8188
offsety = diy < dy ? 0 : (gy*length-bp_xy_clearance-diy)/2*fity*-1;
@@ -85,7 +92,7 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fit
8592
mirror([0,0,1])
8693
rounded_rectangle(dx, dy, h_base+off, r_base);
8794

88-
gridfinityBase(gx, gy, length, 1, 1, 0, 0.5, false);
95+
gridfinityBase(gx, gy, length, 1, 1, bundle_hole_options(), 0.5, false);
8996

9097
translate([offsetx,offsety,h_base-0.6])
9198
rounded_rectangle(dx*2, dy*2, h_base*2, r_base);
@@ -105,33 +112,36 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fit
105112

106113

107114
hole_pattern(){
108-
if (sm) block_base_hole(1);
115+
mirror([0, 0, 1])
116+
block_base_hole(hole_options);
109117

110-
translate([0,0,-off])
118+
translate([0,0,-off-TOLLERANCE])
111119
if (sh == 1) cutter_countersink();
112120
else if (sh == 2) cutter_counterbore();
113121
}
114122
}
115123
}
116-
if (sp == 3 || sp ==4) cutter_screw_together(gx, gy, off);
124+
screw_together = sp == 3 || sp == 4;
125+
if (screw_together) cutter_screw_together(gx, gy, off);
117126
}
118127

119128
}
120129

121-
function calculate_off(sp, sm, sh) =
122-
screw_together
123-
? 6.75
124-
:sp==0
125-
?0
126-
: sp==1
127-
?bp_h_bot
128-
:h_skel + (sm
129-
?h_hole
130-
: 0)+(sh==0
131-
? d_screw
132-
: sh==1
133-
?d_cs
134-
:h_cb);
130+
function calculate_offset(style_plate, enable_magnet, style_hole) =
131+
assert(style_plate >=0 && style_plate <=4)
132+
let (screw_together = style_plate == 3 || style_plate == 4)
133+
screw_together ? 6.75 :
134+
style_plate==0 ? 0 :
135+
style_plate==1 ? bp_h_bot :
136+
calculate_offset_skeletonized(enable_magnet, style_hole);
137+
138+
function calculate_offset_skeletonized(enable_magnet, style_hole) =
139+
h_skel + (enable_magnet ? MAGNET_HOLE_DEPTH : 0) +
140+
(
141+
style_hole==0 ? d_screw :
142+
style_hole==1 ? BASEPLATE_SCREW_COUNTERSINK_ADDITIONAL_RADIUS : // Only works because countersink is at 45 degree angle!
143+
BASEPLATE_SCREW_COUNTERBORE_HEIGHT
144+
);
135145

136146
module cutter_weight() {
137147
union() {
@@ -156,23 +166,19 @@ module hole_pattern(){
156166
}
157167

158168
module cutter_countersink(){
159-
cylinder(r = r_hole1+d_clear, h = 100*h_base, center = true);
160-
translate([0,0,d_cs])
161-
mirror([0,0,1])
162-
hull() {
163-
cylinder(h = d_cs+10, r=r_hole1+d_clear);
164-
translate([0,0,d_cs])
165-
cylinder(h=d_cs+10, r=r_hole1+d_clear+d_cs);
166-
}
169+
screw_hole(SCREW_HOLE_RADIUS + d_clear, 2*h_base,
170+
false, BASEPLATE_SCREW_COUNTERSINK_ADDITIONAL_RADIUS);
167171
}
168172

169173
module cutter_counterbore(){
170-
cylinder(h=100*h_base, r=r_hole1+d_clear, center=true);
171-
difference() {
172-
cylinder(h = 2*(h_cb+0.2), r=r_cb, center=true);
173-
copy_mirror([0,1,0])
174-
translate([-1.5*r_cb,r_hole1+d_clear+0.1,h_cb-h_slit])
175-
cube([r_cb*3,r_cb*3, 10]);
174+
screw_radius = SCREW_HOLE_RADIUS + d_clear;
175+
counterbore_height = BASEPLATE_SCREW_COUNTERBORE_HEIGHT + 2*LAYER_HEIGHT;
176+
union(){
177+
cylinder(h=2*h_base, r=screw_radius);
178+
difference() {
179+
cylinder(h = counterbore_height, r=BASEPLATE_SCREW_COUNTERBORE_RADIUS);
180+
make_hole_printable(screw_radius, BASEPLATE_SCREW_COUNTERBORE_RADIUS, counterbore_height);
181+
}
176182
}
177183
}
178184

@@ -185,7 +191,7 @@ module profile_skeleton() {
185191
translate([l_grid/2-d_hole_from_side,l_grid/2-d_hole_from_side,0])
186192
minkowski() {
187193
square([l,l]);
188-
circle(r_hole2+r_skel+2);
194+
circle(MAGNET_HOLE_RADIUS+r_skel+2);
189195
}
190196
}
191197
circle(r_skel);

gridfinity-rebuilt-bins.scad

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,30 @@ style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
7272
style_lip = 0; //[0: Regular lip, 1:remove lip subtractively, 2: remove lip and retain height]
7373
// scoop weight percentage. 0 disables scoop, 1 is regular scoop. Any real number will scale the scoop.
7474
scoop = 1; //[0:0.1:1]
75-
// only cut magnet/screw holes at the corners of the bin to save uneccesary print time
76-
only_corners = false;
7775

7876
/* [Base] */
79-
style_hole = 4; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit, 4: Gridfinity Refined hole - no glue needed]
8077
// number of divisions per 1 unit of base along the X axis. (default 1, only use integers. 0 means automatically guess the right division)
8178
div_base_x = 0;
8279
// number of divisions per 1 unit of base along the Y axis. (default 1, only use integers. 0 means automatically guess the right division)
8380
div_base_y = 0;
8481

85-
82+
/* [Base Hole Options] */
83+
// only cut magnet/screw holes at the corners of the bin to save uneccesary print time
84+
only_corners = false;
85+
//Use gridfinity refined hole style. Not compatible with magnet_holes!
86+
refined_holes = true;
87+
// Base will have holes for 6mm Diameter x 2mm high magnets.
88+
magnet_holes = false;
89+
// Base will have holes for M3 screws.
90+
screw_holes = false;
91+
// Magnet holes will have crush ribs to hold the magnet.
92+
crush_ribs = true;
93+
// Magnet/Screw holes will have a chamfer to ease insertion.
94+
chamfer_holes = true;
95+
// Magnet/Screw holes will be printed so supports are not needed.
96+
printable_hole_top = true;
97+
98+
hole_options = bundle_hole_options(refined_holes, magnet_holes, screw_holes, crush_ribs, chamfer_holes, printable_hole_top);
8699

87100
// ===== IMPLEMENTATION ===== //
88101

@@ -98,7 +111,7 @@ gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap
98111
cutCylinders(n_divx=cdivx, n_divy=cdivy, cylinder_diameter=cd, cylinder_height=ch, coutout_depth=c_depth, orientation=c_orientation, chamfer=c_chamfer);
99112
}
100113
}
101-
gridfinityBase(gridx, gridy, l_grid, div_base_x, div_base_y, style_hole, only_corners=only_corners);
114+
gridfinityBase(gridx, gridy, l_grid, div_base_x, div_base_y, hole_options, only_corners=only_corners);
102115
}
103116

104117

0 commit comments

Comments
 (0)