diff --git a/boxes/generators/stackablebin.py b/boxes/generators/stackablebin.py new file mode 100644 index 00000000..319965ff --- /dev/null +++ b/boxes/generators/stackablebin.py @@ -0,0 +1,84 @@ +# Copyright (C) 2013-2016 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 StackableBinEdge(edges.BaseEdge): + char = "B" + + def __call__(self, length, **kw): + f = self.settings.front + a1 = math.degrees(math.atan(f/(1-f))) + a2 = 45 + a1 + self.corner(-a1) + + self.edges["e"](self.settings.h* (f**2+(1-f)**2)**0.5) + self.corner(a2) + self.edges["f"](self.settings.h*f*2**0.5) + + self.corner(-45) + + def margin(self) -> float: + return self.settings.h * self.settings.front + +class StackableBinSideEdge(StackableBinEdge): + char = 'b' + +class StackableBin(Boxes): + """Stackable bin base on bintray""" + + ui_group = "Shelf" + + def __init__(self) -> None: + Boxes.__init__(self) + self.addSettingsArgs(edges.StackableSettings, bottom_stabilizers=2.4) + self.addSettingsArgs(edges.FingerJointSettings, surroundingspaces=0.5) + self.buildArgParser("outside") + self.buildArgParser(x=70, h=50) + self.argparser.add_argument( + "--d", action="store", type=float, default=100, + help="bin (d)epth") + self.argparser.add_argument( + "--front", action="store", type=float, default=0.4, + help="fraction of bin height covered with slope") + + def render(self): + + self.front = min(self.front, 0.999) + + self.addPart(StackableBinEdge(self, self)) + self.addPart(StackableBinSideEdge(self, self)) + + angledsettings = copy.deepcopy(self.edges["f"].settings) + angledsettings.setValues(self.thickness, True, angle=45) + angledsettings.edgeObjects(self, chars="gGH") + + if self.outside: + self.x = self.adjustSize(self.x) + self.h = self.adjustSize(self.h, "s", "S") + self.d = self.adjustSize(self.d, "h", "b") + + + with self.saved_context(): + self.rectangularWall(self.x, self.d, "ffGf", label="bottom", move="up") + self.rectangularWall(self.x, self.h, "hfef", label="back", move="up ") + self.rectangularWall(self.x, self.h*self.front*2**0.5, "gFeF", label="retainer", move="up") + self.rectangularWall(self.x, 3, "EEEE", label="for label (optional)") + + self.rectangularWall(self.x, 3, "EEEE", label="movement", move="right only") + + self.rectangularWall(self.d, self.h, "shSb", label="left", move="up") + self.rectangularWall(self.d, self.h, "shSb", label="right", move="mirror up") diff --git a/examples/StackableBin.svg b/examples/StackableBin.svg new file mode 100644 index 00000000..2c980d00 --- /dev/null +++ b/examples/StackableBin.svg @@ -0,0 +1,76 @@ + + + +StackableBin + + +Shelf - StackableBin +boxes StackableBin +Stackable bin base on bintray + +Created with Boxes.py (https://boxes.hackerspace-bamberg.de/) +Command line: boxes StackableBin +Command line short: boxes StackableBin + + + + + 100.0mm, burn:0.10mm + + + bottom + + + + + + + + back + + + retainer + + + for label (optional) + + + + + + + + + + + + + + + left + + + + + + + + + + + + + + + + + right + + + + \ No newline at end of file diff --git a/static/samples/StackableBin-thumb.jpg b/static/samples/StackableBin-thumb.jpg new file mode 100644 index 00000000..45f06e7f Binary files /dev/null and b/static/samples/StackableBin-thumb.jpg differ diff --git a/static/samples/StackableBin.jpg b/static/samples/StackableBin.jpg new file mode 100644 index 00000000..06587307 Binary files /dev/null and b/static/samples/StackableBin.jpg differ diff --git a/static/samples/samples.sha256 b/static/samples/samples.sha256 index 2901cece..fa34ff2f 100644 --- a/static/samples/samples.sha256 +++ b/static/samples/samples.sha256 @@ -178,3 +178,4 @@ a0865738425d5d9966dc6975d7e73559bac3c307c9614e8b48bae4abdf3efb5b ../static/samp 9855c836088d93e508f1c1899ae62733111062f932c1d79ddcc827da2b73335c ../static/samples/SideHingeBox.jpg 77452cf4c547102ce115b2d1c47ba83b740efa5d7a50cb3b6c17f4e771edbd4e ../static/samples/PhotoFrame.jpg 007dd3f4934cdf1af0097813a22490b3d211e9053172098458d6615fa0e6d433 ../static/samples/GridfinityDrillBox.jpg +0db260a55a26e787a0bce3d4b740c755e4cccca13dd551c723de8645bf3352d8 ../static/samples/StackableBin.jpg