Make sure hole naming is consistent

Also fixes tests.
This commit is contained in:
Arthur Moore 2024-04-30 07:30:53 -04:00
parent 95219c6cb9
commit cd56b0e421
4 changed files with 52 additions and 52 deletions

View file

@ -83,19 +83,19 @@ div_base_y = 0;
// only cut magnet/screw holes at the corners of the bin to save uneccesary print time
only_corners = false;
//Use gridfinity refined hole style. Not compatible with magnet_holes!
refined_hole = true;
refined_holes = true;
// Base will have holes for 6mm Diameter x 2mm high magnets.
magnet_holes = false;
// Base will have holes for M3 screws.
screw_holes = false;
// Magnet holes will have crush ribs to hold the magnet.
crush_ribs = true;
// Magnet holes will have a chamfer to ease insertion.
chamfer_magnet_holes = true;
// Screw holes and magnet holes will be printed so supports are not needed.
// Magnet/Screw holes will have a chamfer to ease insertion.
chamfer_holes = true;
// Magnet/Screw holes will be printed so supports are not needed.
printable_hole_top = true;
hole_options = bundle_hole_options(refined_hole, magnet_holes, screw_holes, crush_ribs, chamfer_magnet_holes, printable_hole_top);
hole_options = bundle_hole_options(refined_holes, magnet_holes, screw_holes, crush_ribs, chamfer_holes, printable_hole_top);
// ===== IMPLEMENTATION ===== //

View file

@ -217,8 +217,8 @@ module screw_hole(radius, height, supportless=false, chamfer_radius=0, chamfer_a
* @param magnet_hole Create a hole for a 6mm magnet.
* @param screw_hole Create a hole for a M3 screw.
* @param crush_ribs If the magnet hole should have crush ribs for a press fit.
* @param chamfer Add a chamfer to the magnet hole.
* @param supportless If the magnet hole should be printed in such a way that the screw hole does not require supports.
* @param chamfer Add a chamfer to the magnet/screw hole.
* @param supportless If the magnet/screw hole should be printed in such a way that the screw hole does not require supports.
*/
function bundle_hole_options(refined_hole=false, magnet_hole=false, screw_hole=false, crush_ribs=false, chamfer=false, supportless=false) =
[refined_hole, magnet_hole, screw_hole, crush_ribs, chamfer, supportless];

View file

@ -11,7 +11,7 @@
"cdivx": "0",
"cdivy": "0",
"ch": "1",
"chamfer_magnet_holes": "true",
"chamfer_holes": "true",
"crush_ribs": "true",
"div_base_x": "0",
"div_base_y": "0",
@ -26,7 +26,7 @@
"magnet_holes": "false",
"only_corners": "false",
"printable_hole_top": "true",
"refined_hole": "true",
"refined_holes": "true",
"scoop": "0",
"screw_holes": "false",
"style_lip": "0",

View file

@ -32,109 +32,109 @@ class TestBinHoles(unittest.TestCase):
def test_no_holes(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = False
vars["magnet_hole"] = False
vars["screw_hole"] = False
vars["refined_holes"] = False
vars["magnet_holes"] = False
vars["screw_holes"] = False
self.scad_runner.create_image(self.camera_args, [], Path('no_holes.png'))
def test_refined_holes(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = True
vars["magnet_hole"] = False
vars["screw_hole"] = False
vars["refined_holes"] = True
vars["magnet_holes"] = False
vars["screw_holes"] = False
self.scad_runner.create_image(self.camera_args, [], Path('refined_holes.png'))
def test_refined_and_screw_holes(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = True
vars["magnet_hole"] = False
vars["screw_hole"] = True
vars["refined_holes"] = True
vars["magnet_holes"] = False
vars["screw_holes"] = True
vars["printable_hole_top"] = False
self.scad_runner.create_image(self.camera_args, [], Path('refined_and_screw_holes.png'))
def test_screw_holes_plain(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = False
vars["magnet_hole"] = False
vars["screw_hole"] = True
vars["refined_holes"] = False
vars["magnet_holes"] = False
vars["screw_holes"] = True
vars["printable_hole_top"] = False
self.scad_runner.create_image(self.camera_args, [], Path('screw_holes_plain.png'))
def test_screw_holes_printable(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = False
vars["magnet_hole"] = False
vars["screw_hole"] = True
vars["refined_holes"] = False
vars["magnet_holes"] = False
vars["screw_holes"] = True
vars["printable_hole_top"] = True
self.scad_runner.create_image(self.camera_args, [], Path('screw_holes_printable.png'))
def test_magnet_holes_plain(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = False
vars["magnet_hole"] = True
vars["screw_hole"] = False
vars["refined_holes"] = False
vars["magnet_holes"] = True
vars["screw_holes"] = False
vars["crush_ribs"] = False
vars["chamfer_magnet_holes"] = False
vars["chamfer_holes"] = False
vars["printable_hole_top"] = False
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_plain.png'))
def test_magnet_holes_chamfered(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = False
vars["magnet_hole"] = True
vars["screw_hole"] = False
vars["refined_holes"] = False
vars["magnet_holes"] = True
vars["screw_holes"] = False
vars["crush_ribs"] = False
vars["chamfer_magnet_holes"] = True
vars["chamfer_holes"] = True
vars["printable_hole_top"] = False
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_chamfered.png'))
def test_magnet_holes_printable(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = False
vars["magnet_hole"] = True
vars["screw_hole"] = False
vars["refined_holes"] = False
vars["magnet_holes"] = True
vars["screw_holes"] = False
vars["crush_ribs"] = False
vars["chamfer_magnet_holes"] = False
vars["chamfer_holes"] = False
vars["printable_hole_top"] = True
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_printable.png'))
def test_magnet_holes_with_crush_ribs(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = False
vars["magnet_hole"] = True
vars["screw_hole"] = False
vars["refined_holes"] = False
vars["magnet_holes"] = True
vars["screw_holes"] = False
vars["crush_ribs"] = True
vars["chamfer_magnet_holes"] = False
vars["chamfer_holes"] = False
vars["printable_hole_top"] = False
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_with_crush_ribs.png'))
def test_magnet_and_screw_holes_plain(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = False
vars["magnet_hole"] = True
vars["screw_hole"] = True
vars["refined_holes"] = False
vars["magnet_holes"] = True
vars["screw_holes"] = True
vars["crush_ribs"] = False
vars["chamfer_magnet_holes"] = False
vars["chamfer_holes"] = False
vars["printable_hole_top"] = False
self.scad_runner.create_image(self.camera_args, [], Path('magnet_and_screw_holes_plain.png'))
def test_magnet_and_screw_holes_printable(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = False
vars["magnet_hole"] = True
vars["screw_hole"] = True
vars["refined_holes"] = False
vars["magnet_holes"] = True
vars["screw_holes"] = True
vars["crush_ribs"] = False
vars["chamfer_magnet_holes"] = False
vars["chamfer_holes"] = False
vars["printable_hole_top"] = True
self.scad_runner.create_image(self.camera_args, [], Path('magnet_and_screw_holes_printable.png'))
def test_magnet_and_screw_holes_all(self):
vars = self.scad_runner.parameters
vars["refined_hole"] = False
vars["magnet_hole"] = True
vars["screw_hole"] = True
vars["refined_holes"] = False
vars["magnet_holes"] = True
vars["screw_holes"] = True
vars["crush_ribs"] = True
vars["chamfer_magnet_holes"] = True
vars["chamfer_holes"] = True
vars["printable_hole_top"] = True
self.scad_runner.create_image(self.camera_args, [], Path('magnet_and_screw_holes_all.png'))