mirror of
https://github.com/kennetek/gridfinity-rebuilt-openscad.git
synced 2024-12-22 06:43:25 +00:00
Baseplate - Add support for crush ribs and chamfering the magnet holes
* Updated tests
This commit is contained in:
parent
6f4e3b590e
commit
e34a25d640
3 changed files with 52 additions and 12 deletions
|
@ -50,22 +50,29 @@ fity = 0; // [-1:0.1:1]
|
||||||
// baseplate styles
|
// baseplate styles
|
||||||
style_plate = 0; // [0: thin, 1:weighted, 2:skeletonized, 3: screw together, 4: screw together minimal]
|
style_plate = 0; // [0: thin, 1:weighted, 2:skeletonized, 3: screw together, 4: screw together minimal]
|
||||||
|
|
||||||
// enable magnet hole
|
|
||||||
enable_magnet = true;
|
|
||||||
|
|
||||||
// hole styles
|
// hole styles
|
||||||
style_hole = 2; // [0:none, 1:countersink, 2:counterbore]
|
style_hole = 2; // [0:none, 1:countersink, 2:counterbore]
|
||||||
|
|
||||||
|
/* [Magnet Hole] */
|
||||||
|
// Baseplate will have holes for 6mm Diameter x 2mm high magnets.
|
||||||
|
enable_magnet = true;
|
||||||
|
// Magnet holes will have crush ribs to hold the magnet.
|
||||||
|
crush_ribs = true;
|
||||||
|
// Magnet holes will have a chamfer to ease insertion.
|
||||||
|
chamfer_holes = true;
|
||||||
|
|
||||||
|
hole_options = bundle_hole_options(refined_hole=false, magnet_hole=enable_magnet, screw_hole=false, crush_ribs=crush_ribs, chamfer=chamfer_holes, supportless=false);
|
||||||
|
|
||||||
// ===== IMPLEMENTATION ===== //
|
// ===== IMPLEMENTATION ===== //
|
||||||
|
|
||||||
color("tomato")
|
color("tomato")
|
||||||
gridfinityBaseplate(gridx, gridy, l_grid, distancex, distancey, style_plate, enable_magnet, style_hole, fitx, fity);
|
gridfinityBaseplate(gridx, gridy, l_grid, distancex, distancey, style_plate, hole_options, style_hole, fitx, fity);
|
||||||
|
|
||||||
|
|
||||||
// ===== CONSTRUCTION ===== //
|
// ===== CONSTRUCTION ===== //
|
||||||
|
|
||||||
module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fity) {
|
module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, hole_options, sh, fitx, fity) {
|
||||||
|
|
||||||
assert(gridx > 0 || dix > 0, "Must have positive x grid amount!");
|
assert(gridx > 0 || dix > 0, "Must have positive x grid amount!");
|
||||||
assert(gridy > 0 || diy > 0, "Must have positive y grid amount!");
|
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
|
||||||
dx = max(gx*length-bp_xy_clearance, dix);
|
dx = max(gx*length-bp_xy_clearance, dix);
|
||||||
dy = max(gy*length-bp_xy_clearance, diy);
|
dy = max(gy*length-bp_xy_clearance, diy);
|
||||||
|
|
||||||
off = calculate_offset(sp, sm, sh);
|
off = calculate_offset(sp, hole_options[1], sh);
|
||||||
|
|
||||||
offsetx = dix < dx ? 0 : (gx*length-bp_xy_clearance-dix)/2*fitx*-1;
|
offsetx = dix < dx ? 0 : (gx*length-bp_xy_clearance-dix)/2*fitx*-1;
|
||||||
offsety = diy < dy ? 0 : (gy*length-bp_xy_clearance-diy)/2*fity*-1;
|
offsety = diy < dy ? 0 : (gy*length-bp_xy_clearance-diy)/2*fity*-1;
|
||||||
|
@ -105,10 +112,8 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fit
|
||||||
|
|
||||||
|
|
||||||
hole_pattern(){
|
hole_pattern(){
|
||||||
if (sm) {
|
|
||||||
mirror([0, 0, 1])
|
mirror([0, 0, 1])
|
||||||
block_base_hole(bundle_hole_options(magnet_hole=true));
|
block_base_hole(hole_options);
|
||||||
}
|
|
||||||
|
|
||||||
translate([0,0,-off-TOLLERANCE])
|
translate([0,0,-off-TOLLERANCE])
|
||||||
if (sh == 1) cutter_countersink();
|
if (sh == 1) cutter_countersink();
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
"d_screw_head": "5",
|
"d_screw_head": "5",
|
||||||
"distancex": "0",
|
"distancex": "0",
|
||||||
"distancey": "0",
|
"distancey": "0",
|
||||||
|
"chamfer_holes": "true",
|
||||||
|
"crush_ribs": "true",
|
||||||
"enable_magnet": "true",
|
"enable_magnet": "true",
|
||||||
"fitx": "0",
|
"fitx": "0",
|
||||||
"fity": "0",
|
"fity": "0",
|
||||||
|
|
|
@ -38,13 +38,42 @@ class TestBasePlateHoles(unittest.TestCase):
|
||||||
self.scad_runner.camera_arguments = self.scad_runner.camera_arguments.with_rotation(CameraRotations.AngledTop)
|
self.scad_runner.camera_arguments = self.scad_runner.camera_arguments.with_rotation(CameraRotations.AngledTop)
|
||||||
self.scad_runner.create_image([], Path('no_holes_top.png'))
|
self.scad_runner.create_image([], Path('no_holes_top.png'))
|
||||||
|
|
||||||
def test_only_magnet_holes(self):
|
def test_plain_magnet_holes(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["enable_magnet"] = True
|
vars["enable_magnet"] = True
|
||||||
vars["style_hole"] = 0
|
vars["style_hole"] = 0
|
||||||
self.scad_runner.create_image([], Path('only_magnet_holes_bottom.png'))
|
vars["chamfer_holes"] = False
|
||||||
|
vars["crush_ribs"] = False
|
||||||
|
self.scad_runner.create_image([], Path('magnet_holes_bottom.png'))
|
||||||
self.scad_runner.camera_arguments = self.scad_runner.camera_arguments.with_rotation(CameraRotations.AngledTop)
|
self.scad_runner.camera_arguments = self.scad_runner.camera_arguments.with_rotation(CameraRotations.AngledTop)
|
||||||
self.scad_runner.create_image([], Path('only_magnet_holes_top.png'))
|
self.scad_runner.create_image([], Path('plain_magnet_holes_top.png'))
|
||||||
|
|
||||||
|
def test_chamfered_magnet_holes(self):
|
||||||
|
vars = self.scad_runner.parameters
|
||||||
|
vars["enable_magnet"] = True
|
||||||
|
vars["style_hole"] = 0
|
||||||
|
vars["chamfer_holes"] = True
|
||||||
|
vars["crush_ribs"] = False
|
||||||
|
self.scad_runner.camera_arguments = self.scad_runner.camera_arguments.with_rotation(CameraRotations.AngledTop)
|
||||||
|
self.scad_runner.create_image([], Path('chamfered_magnet_holes.png'))
|
||||||
|
|
||||||
|
def test_ribbed_magnet_holes(self):
|
||||||
|
vars = self.scad_runner.parameters
|
||||||
|
vars["enable_magnet"] = True
|
||||||
|
vars["style_hole"] = 0
|
||||||
|
vars["chamfer_holes"] = False
|
||||||
|
vars["crush_ribs"] = True
|
||||||
|
self.scad_runner.camera_arguments = self.scad_runner.camera_arguments.with_rotation(CameraRotations.AngledTop)
|
||||||
|
self.scad_runner.create_image([], Path('ribbed_magnet_holes.png'))
|
||||||
|
|
||||||
|
def test_chamfered_and_ribbed_magnet_holes(self):
|
||||||
|
vars = self.scad_runner.parameters
|
||||||
|
vars["enable_magnet"] = True
|
||||||
|
vars["style_hole"] = 0
|
||||||
|
vars["chamfer_holes"] = True
|
||||||
|
vars["crush_ribs"] = True
|
||||||
|
self.scad_runner.camera_arguments = self.scad_runner.camera_arguments.with_rotation(CameraRotations.AngledTop)
|
||||||
|
self.scad_runner.create_image([], Path('chamfered_and_ribbed_magnet_holes.png'))
|
||||||
|
|
||||||
def test_only_countersunk_screw_holes(self):
|
def test_only_countersunk_screw_holes(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
|
@ -65,6 +94,8 @@ class TestBasePlateHoles(unittest.TestCase):
|
||||||
def test_magnet_and_countersunk_screw_holes(self):
|
def test_magnet_and_countersunk_screw_holes(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["enable_magnet"] = True
|
vars["enable_magnet"] = True
|
||||||
|
vars["chamfer_holes"] = False
|
||||||
|
vars["crush_ribs"] = False
|
||||||
vars["style_hole"] = 1
|
vars["style_hole"] = 1
|
||||||
self.scad_runner.create_image([], Path('magnet_and_countersunk_screw_holes_bottom.png'))
|
self.scad_runner.create_image([], Path('magnet_and_countersunk_screw_holes_bottom.png'))
|
||||||
self.scad_runner.camera_arguments = self.scad_runner.camera_arguments.with_rotation(CameraRotations.AngledTop)
|
self.scad_runner.camera_arguments = self.scad_runner.camera_arguments.with_rotation(CameraRotations.AngledTop)
|
||||||
|
@ -73,6 +104,8 @@ class TestBasePlateHoles(unittest.TestCase):
|
||||||
def test_magnet_and_counterbored_screw_holes(self):
|
def test_magnet_and_counterbored_screw_holes(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["enable_magnet"] = True
|
vars["enable_magnet"] = True
|
||||||
|
vars["chamfer_holes"] = False
|
||||||
|
vars["crush_ribs"] = False
|
||||||
vars["style_hole"] = 2
|
vars["style_hole"] = 2
|
||||||
self.scad_runner.create_image([], Path('magnet_and_counterbored_screw_holes_bottom.png'))
|
self.scad_runner.create_image([], Path('magnet_and_counterbored_screw_holes_bottom.png'))
|
||||||
self.scad_runner.camera_arguments = self.scad_runner.camera_arguments.with_rotation(CameraRotations.AngledTop)
|
self.scad_runner.camera_arguments = self.scad_runner.camera_arguments.with_rotation(CameraRotations.AngledTop)
|
||||||
|
|
Loading…
Reference in a new issue