mirror of
https://github.com/kennetek/gridfinity-rebuilt-openscad.git
synced 2024-12-22 06:43:25 +00:00
Make sure hole naming is consistent
Also fixes tests.
This commit is contained in:
parent
95219c6cb9
commit
cd56b0e421
4 changed files with 52 additions and 52 deletions
|
@ -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 cut magnet/screw holes at the corners of the bin to save uneccesary print time
|
||||||
only_corners = false;
|
only_corners = false;
|
||||||
//Use gridfinity refined hole style. Not compatible with magnet_holes!
|
//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.
|
// Base will have holes for 6mm Diameter x 2mm high magnets.
|
||||||
magnet_holes = false;
|
magnet_holes = false;
|
||||||
// Base will have holes for M3 screws.
|
// Base will have holes for M3 screws.
|
||||||
screw_holes = false;
|
screw_holes = false;
|
||||||
// Magnet holes will have crush ribs to hold the magnet.
|
// Magnet holes will have crush ribs to hold the magnet.
|
||||||
crush_ribs = true;
|
crush_ribs = true;
|
||||||
// Magnet holes will have a chamfer to ease insertion.
|
// Magnet/Screw holes will have a chamfer to ease insertion.
|
||||||
chamfer_magnet_holes = true;
|
chamfer_holes = true;
|
||||||
// Screw holes and magnet holes will be printed so supports are not needed.
|
// Magnet/Screw holes will be printed so supports are not needed.
|
||||||
printable_hole_top = true;
|
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 ===== //
|
// ===== IMPLEMENTATION ===== //
|
||||||
|
|
||||||
|
|
|
@ -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 magnet_hole Create a hole for a 6mm magnet.
|
||||||
* @param screw_hole Create a hole for a M3 screw.
|
* @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 crush_ribs If the magnet hole should have crush ribs for a press fit.
|
||||||
* @param chamfer Add a chamfer to the magnet hole.
|
* @param chamfer Add a chamfer to the magnet/screw hole.
|
||||||
* @param supportless If the magnet hole should be printed in such a way that the screw hole does not require supports.
|
* @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) =
|
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];
|
[refined_hole, magnet_hole, screw_hole, crush_ribs, chamfer, supportless];
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"cdivx": "0",
|
"cdivx": "0",
|
||||||
"cdivy": "0",
|
"cdivy": "0",
|
||||||
"ch": "1",
|
"ch": "1",
|
||||||
"chamfer_magnet_holes": "true",
|
"chamfer_holes": "true",
|
||||||
"crush_ribs": "true",
|
"crush_ribs": "true",
|
||||||
"div_base_x": "0",
|
"div_base_x": "0",
|
||||||
"div_base_y": "0",
|
"div_base_y": "0",
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
"magnet_holes": "false",
|
"magnet_holes": "false",
|
||||||
"only_corners": "false",
|
"only_corners": "false",
|
||||||
"printable_hole_top": "true",
|
"printable_hole_top": "true",
|
||||||
"refined_hole": "true",
|
"refined_holes": "true",
|
||||||
"scoop": "0",
|
"scoop": "0",
|
||||||
"screw_holes": "false",
|
"screw_holes": "false",
|
||||||
"style_lip": "0",
|
"style_lip": "0",
|
||||||
|
|
|
@ -32,109 +32,109 @@ class TestBinHoles(unittest.TestCase):
|
||||||
|
|
||||||
def test_no_holes(self):
|
def test_no_holes(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = False
|
vars["refined_holes"] = False
|
||||||
vars["magnet_hole"] = False
|
vars["magnet_holes"] = False
|
||||||
vars["screw_hole"] = False
|
vars["screw_holes"] = False
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('no_holes.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('no_holes.png'))
|
||||||
|
|
||||||
def test_refined_holes(self):
|
def test_refined_holes(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = True
|
vars["refined_holes"] = True
|
||||||
vars["magnet_hole"] = False
|
vars["magnet_holes"] = False
|
||||||
vars["screw_hole"] = False
|
vars["screw_holes"] = False
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('refined_holes.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('refined_holes.png'))
|
||||||
|
|
||||||
def test_refined_and_screw_holes(self):
|
def test_refined_and_screw_holes(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = True
|
vars["refined_holes"] = True
|
||||||
vars["magnet_hole"] = False
|
vars["magnet_holes"] = False
|
||||||
vars["screw_hole"] = True
|
vars["screw_holes"] = True
|
||||||
vars["printable_hole_top"] = False
|
vars["printable_hole_top"] = False
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('refined_and_screw_holes.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('refined_and_screw_holes.png'))
|
||||||
|
|
||||||
def test_screw_holes_plain(self):
|
def test_screw_holes_plain(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = False
|
vars["refined_holes"] = False
|
||||||
vars["magnet_hole"] = False
|
vars["magnet_holes"] = False
|
||||||
vars["screw_hole"] = True
|
vars["screw_holes"] = True
|
||||||
vars["printable_hole_top"] = False
|
vars["printable_hole_top"] = False
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('screw_holes_plain.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('screw_holes_plain.png'))
|
||||||
|
|
||||||
def test_screw_holes_printable(self):
|
def test_screw_holes_printable(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = False
|
vars["refined_holes"] = False
|
||||||
vars["magnet_hole"] = False
|
vars["magnet_holes"] = False
|
||||||
vars["screw_hole"] = True
|
vars["screw_holes"] = True
|
||||||
vars["printable_hole_top"] = True
|
vars["printable_hole_top"] = True
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('screw_holes_printable.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('screw_holes_printable.png'))
|
||||||
|
|
||||||
def test_magnet_holes_plain(self):
|
def test_magnet_holes_plain(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = False
|
vars["refined_holes"] = False
|
||||||
vars["magnet_hole"] = True
|
vars["magnet_holes"] = True
|
||||||
vars["screw_hole"] = False
|
vars["screw_holes"] = False
|
||||||
vars["crush_ribs"] = False
|
vars["crush_ribs"] = False
|
||||||
vars["chamfer_magnet_holes"] = False
|
vars["chamfer_holes"] = False
|
||||||
vars["printable_hole_top"] = False
|
vars["printable_hole_top"] = False
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_plain.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_plain.png'))
|
||||||
|
|
||||||
def test_magnet_holes_chamfered(self):
|
def test_magnet_holes_chamfered(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = False
|
vars["refined_holes"] = False
|
||||||
vars["magnet_hole"] = True
|
vars["magnet_holes"] = True
|
||||||
vars["screw_hole"] = False
|
vars["screw_holes"] = False
|
||||||
vars["crush_ribs"] = False
|
vars["crush_ribs"] = False
|
||||||
vars["chamfer_magnet_holes"] = True
|
vars["chamfer_holes"] = True
|
||||||
vars["printable_hole_top"] = False
|
vars["printable_hole_top"] = False
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_chamfered.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_chamfered.png'))
|
||||||
|
|
||||||
def test_magnet_holes_printable(self):
|
def test_magnet_holes_printable(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = False
|
vars["refined_holes"] = False
|
||||||
vars["magnet_hole"] = True
|
vars["magnet_holes"] = True
|
||||||
vars["screw_hole"] = False
|
vars["screw_holes"] = False
|
||||||
vars["crush_ribs"] = False
|
vars["crush_ribs"] = False
|
||||||
vars["chamfer_magnet_holes"] = False
|
vars["chamfer_holes"] = False
|
||||||
vars["printable_hole_top"] = True
|
vars["printable_hole_top"] = True
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_printable.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_printable.png'))
|
||||||
|
|
||||||
def test_magnet_holes_with_crush_ribs(self):
|
def test_magnet_holes_with_crush_ribs(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = False
|
vars["refined_holes"] = False
|
||||||
vars["magnet_hole"] = True
|
vars["magnet_holes"] = True
|
||||||
vars["screw_hole"] = False
|
vars["screw_holes"] = False
|
||||||
vars["crush_ribs"] = True
|
vars["crush_ribs"] = True
|
||||||
vars["chamfer_magnet_holes"] = False
|
vars["chamfer_holes"] = False
|
||||||
vars["printable_hole_top"] = False
|
vars["printable_hole_top"] = False
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_with_crush_ribs.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('magnet_holes_with_crush_ribs.png'))
|
||||||
|
|
||||||
def test_magnet_and_screw_holes_plain(self):
|
def test_magnet_and_screw_holes_plain(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = False
|
vars["refined_holes"] = False
|
||||||
vars["magnet_hole"] = True
|
vars["magnet_holes"] = True
|
||||||
vars["screw_hole"] = True
|
vars["screw_holes"] = True
|
||||||
vars["crush_ribs"] = False
|
vars["crush_ribs"] = False
|
||||||
vars["chamfer_magnet_holes"] = False
|
vars["chamfer_holes"] = False
|
||||||
vars["printable_hole_top"] = False
|
vars["printable_hole_top"] = False
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('magnet_and_screw_holes_plain.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('magnet_and_screw_holes_plain.png'))
|
||||||
|
|
||||||
def test_magnet_and_screw_holes_printable(self):
|
def test_magnet_and_screw_holes_printable(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = False
|
vars["refined_holes"] = False
|
||||||
vars["magnet_hole"] = True
|
vars["magnet_holes"] = True
|
||||||
vars["screw_hole"] = True
|
vars["screw_holes"] = True
|
||||||
vars["crush_ribs"] = False
|
vars["crush_ribs"] = False
|
||||||
vars["chamfer_magnet_holes"] = False
|
vars["chamfer_holes"] = False
|
||||||
vars["printable_hole_top"] = True
|
vars["printable_hole_top"] = True
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('magnet_and_screw_holes_printable.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('magnet_and_screw_holes_printable.png'))
|
||||||
|
|
||||||
def test_magnet_and_screw_holes_all(self):
|
def test_magnet_and_screw_holes_all(self):
|
||||||
vars = self.scad_runner.parameters
|
vars = self.scad_runner.parameters
|
||||||
vars["refined_hole"] = False
|
vars["refined_holes"] = False
|
||||||
vars["magnet_hole"] = True
|
vars["magnet_holes"] = True
|
||||||
vars["screw_hole"] = True
|
vars["screw_holes"] = True
|
||||||
vars["crush_ribs"] = True
|
vars["crush_ribs"] = True
|
||||||
vars["chamfer_magnet_holes"] = True
|
vars["chamfer_holes"] = True
|
||||||
vars["printable_hole_top"] = True
|
vars["printable_hole_top"] = True
|
||||||
self.scad_runner.create_image(self.camera_args, [], Path('magnet_and_screw_holes_all.png'))
|
self.scad_runner.create_image(self.camera_args, [], Path('magnet_and_screw_holes_all.png'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue