diff --git a/boxes/generators/gridfinitybase.py b/boxes/generators/gridfinitybase.py new file mode 100644 index 0000000..85208fa --- /dev/null +++ b/boxes/generators/gridfinitybase.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +# Copyright (C) 2013-2014 Florian Festi +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from boxes import * + +class GridfinityBase(Boxes): + """A parameterized Gridfinity base""" + + description = """This is a configurable gridfinity base. This + design is based on + Zach Freedman's Gridfinity system""" + + ui_group = "Tray" + + def __init__(self): + Boxes.__init__(self) + self.addSettingsArgs(edges.FingerJointSettings, space=4, finger=4) + self.argparser.add_argument("--x", type=int, default=3, help="number of grids in X direction") + self.argparser.add_argument("--y", type=int, default=2, help="number of grids in Y direction") + self.argparser.add_argument("--h", type=float, default=7*3, help="height of sidewalls of the tray (mm)") + self.argparser.add_argument("--m", type=float, default=0.5, help="Extra margin around the gridfinity base to allow it to drop into the carrier (mm)") + self.argparser.add_argument( + "--bottom_edge", action="store", + type=ArgparseEdgeType("Fhse"), choices=list("Fhse"), + default='F', + help="edge type for bottom edge") + self.argparser.add_argument("--pitch", type=int, default=42, help="The Gridfinity pitch, in mm. Should always be 42.") + self.argparser.add_argument("--opening", type=int, default=38, help="The cutout for each grid opening. Typical is 38.") + + def generate_grid(self): + pitch = self.pitch + nx, ny = self.x, self.y + opening = self.opening + for col in range(nx): + for row in range(ny): + lx = col*pitch+pitch/2 + ly = row*pitch+pitch/2 + self.rectangularHole(lx, ly, opening, opening) + + def create_base_plate(self): + pitch = self.pitch + nx, ny = self.x, self.y + opening = self.opening + self.rectangularWall(nx*pitch, ny*pitch, move="up", callback=[self.generate_grid]) + return + + def create_tray(self): + pitch = self.pitch + nx, ny = self.x, self.y + margin = self.m + x, y, h = nx*pitch, ny*pitch, self.h + t = self.thickness + x += 2*margin + y += 2*margin + t1, t2, t3, t4 = "eeee" + b = self.edges.get(self.bottom_edge, self.edges["F"]) + sideedge = "F" # if self.vertical_edges == "finger joints" else "h" + + with self.saved_context(): + self.rectangularWall(x, h, [b, sideedge, t1, sideedge], + ignore_widths=[1, 6], move="up") + self.rectangularWall(x, h, [b, sideedge, t3, sideedge], + ignore_widths=[1, 6], move="up") + + if self.bottom_edge != "e": + self.rectangularWall(x, y, "ffff", move="up") + + self.rectangularWall(x, h, [b, sideedge, t3, sideedge], + ignore_widths=[1, 6], move="right only") + self.rectangularWall(y, h, [b, "f", t2, "f"], + ignore_widths=[1, 6], move="up") + self.rectangularWall(y, h, [b, "f", t4, "f"], + ignore_widths=[1, 6], move="up") + return + + def render(self): + self.create_base_plate() + self.create_tray() diff --git a/static/samples/GridfinityBase-thumb.jpg b/static/samples/GridfinityBase-thumb.jpg new file mode 100644 index 0000000..0b3eea3 Binary files /dev/null and b/static/samples/GridfinityBase-thumb.jpg differ diff --git a/static/samples/GridfinityBase.jpg b/static/samples/GridfinityBase.jpg new file mode 100644 index 0000000..032624e Binary files /dev/null and b/static/samples/GridfinityBase.jpg differ diff --git a/static/samples/samples.sha256 b/static/samples/samples.sha256 index 8aadaff..2b2ac32 100644 --- a/static/samples/samples.sha256 +++ b/static/samples/samples.sha256 @@ -103,3 +103,4 @@ c21b47963a9de686eec4bcdb04dc84a64fef1e943d9c276f6ecb7d619af22791 ../static/samp 3bdbb6dab2beea4dcdcf84941bf1f763bc9eb60ca9369965c4b003d5bb57f83b ../static/samples/HalfBox_AngleJig_usage.jpg 9a0c0bf1d3b74a1e09f278ad9f89d8b7e59261a870bb60ed547d45117594cf93 ../static/samples/HalfBox.jpg e1e5001ad1c59e0815a684f2eb2d25bb88113423ec6b582fb81f835c25947127 ../static/samples/HalfBox_Bookend_usage.jpg +2300383efee9aebb910fb8967edcee9689e1143031c5bca4d7d9a2c4109bd7f9 ../static/samples/GridfinityBase.jpg