11include < gridfinity- rebuilt- utility.scad>
22include < 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
5051style_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
5655style_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
6269color ("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
136146module cutter_weight() {
137147 union () {
@@ -156,23 +166,19 @@ module hole_pattern(){
156166}
157167
158168module 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
169173module 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);
0 commit comments