From 330374d3f0dfdf92122d05c8136f2f298ce0f013 Mon Sep 17 00:00:00 2001 From: mtintes Date: Sun, 25 May 2025 22:30:31 -0500 Subject: [PATCH 1/9] adds a lazy susan (arc shaped) container --- boxes/generators/lazysusan.py | 75 +++++++++++++++++++++++++++++++++++ examples/LazySusan.svg | 37 +++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 boxes/generators/lazysusan.py create mode 100644 examples/LazySusan.svg diff --git a/boxes/generators/lazysusan.py b/boxes/generators/lazysusan.py new file mode 100644 index 000000000..baed0312f --- /dev/null +++ b/boxes/generators/lazysusan.py @@ -0,0 +1,75 @@ +# 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 LazySusan(Boxes): + """Box for storing tipable things on a lazy susan""" + + ui_group = "FlexBox" + + def __init__(self) -> None: + Boxes.__init__(self) + + self.addSettingsArgs(edges.FingerJointSettings, finger=1.0,space=1.0) + self.addSettingsArgs(edges.FlexSettings) + + self.buildArgParser(h=50) + self.argparser.add_argument( + "--inside_radius", action="store", type=float, default=40, + help="inside radius of the lazy susan") + self.argparser.add_argument( + "--outside_radius", action="store", type=float, default=90, + help="outside radius of the lazy susan") + self.argparser.add_argument( + "--angle", action="store", type=float, default=90, + help="angle of the lazy susan") + + + def drawfloor(self, angle=None, inside_radius=None, outside_radius=None): + with self.saved_context(): + self.moveTo(inside_radius, 0) + self.moveArc(90) + self.polyline(0, (angle, inside_radius)) + + with self.saved_context(): + self.moveTo(outside_radius, 0) + self.moveArc(90) + self.polyline(0, (angle, outside_radius)) + self.polyline(0, 90) + self.edges["f"](outside_radius-inside_radius) + + with self.saved_context(): + self.moveTo(inside_radius, 0) + self.edges["f"](outside_radius-inside_radius) + + def render(self): + angle,inside_radius,outside_radius, h = self.angle, self.inside_radius, self.outside_radius, self.h + t = self.thickness + + # angle = 30 + + self.moveTo(-inside_radius, 5) + self.drawfloor(angle, inside_radius, outside_radius) + self.moveTo(outside_radius+5, 0) + # + outside_wall = angle * (math.pi / 180) * outside_radius + self.rectangularWall(outside_wall, h, "eFeF", move="right") + + inside_wall = angle * (math.pi / 180) * inside_radius + self.rectangularWall(inside_wall, h, "eFeF", move="right") + self.flangedWall(outside_radius-inside_radius,h, "FfFf", move="up" ) + self.flangedWall(outside_radius-inside_radius,h, "FfFf", move="right") diff --git a/examples/LazySusan.svg b/examples/LazySusan.svg new file mode 100644 index 000000000..f71b075d2 --- /dev/null +++ b/examples/LazySusan.svg @@ -0,0 +1,37 @@ + + + +LazySusan + + +FlexBox - LazySusan +boxes LazySusan +Box for storing tipable things on a lazy susan + +Created with Boxes.py (https://boxes.hackerspace-bamberg.de/) +Command line: boxes LazySusan +Command line short: boxes LazySusan + + + + + 100.0mm, burn:0.10mm + + + + + + + + + + + + + + \ No newline at end of file From ca8434ac47eb274f5cf7581a89fd76476aa93db8 Mon Sep 17 00:00:00 2001 From: mtintes Date: Mon, 26 May 2025 22:14:09 -0500 Subject: [PATCH 2/9] a little better --- boxes/generators/lazysusan.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/boxes/generators/lazysusan.py b/boxes/generators/lazysusan.py index baed0312f..20470c740 100644 --- a/boxes/generators/lazysusan.py +++ b/boxes/generators/lazysusan.py @@ -65,11 +65,21 @@ def render(self): self.moveTo(-inside_radius, 5) self.drawfloor(angle, inside_radius, outside_radius) self.moveTo(outside_radius+5, 0) - # + + #flex wall for outside outside_wall = angle * (math.pi / 180) * outside_radius self.rectangularWall(outside_wall, h, "eFeF", move="right") + # l = 2/3. * outside_radius-inside_radius + # r = l/2. - 0.5*t + # borders = [10, (outside_wall, outside_wall), 10,1] + # self.polygonWalls(borders, h, "f", "f") + #flex wall for inside inside_wall = angle * (math.pi / 180) * inside_radius self.rectangularWall(inside_wall, h, "eFeF", move="right") + + #solid endcap walls self.flangedWall(outside_radius-inside_radius,h, "FfFf", move="up" ) self.flangedWall(outside_radius-inside_radius,h, "FfFf", move="right") + + \ No newline at end of file From a97b16e61de653a7c722aac1dee561e40763522d Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Wed, 4 Jun 2025 19:43:39 +0200 Subject: [PATCH 3/9] LazySusan: Use .polygonWall --- boxes/generators/lazysusan.py | 68 +++++++++++++++++------------------ 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/boxes/generators/lazysusan.py b/boxes/generators/lazysusan.py index 20470c740..5dbde3c06 100644 --- a/boxes/generators/lazysusan.py +++ b/boxes/generators/lazysusan.py @@ -37,49 +37,45 @@ def __init__(self) -> None: self.argparser.add_argument( "--angle", action="store", type=float, default=90, help="angle of the lazy susan") + self.argparser.add_argument( + "--top", action="store", type=str, default="hole", + choices=["hole", "lid", "closed",], + help="style of the top and lid") + def holeCB(self): + angle, inside_radius, outside_radius, h = self.angle, self.inside_radius, self.outside_radius, self.h + t = self.thickness + s = 0.2 * inside_radius + d = t + poly = [s-d, (angle, outside_radius-s-d), s-d, 90, + outside_radius-inside_radius-2*d, 90, + s-d, (-angle, inside_radius-s+d), s-d, 90, + outside_radius-inside_radius-2*d, 90] + self.moveTo(d, d) + self.polyline(*poly) - def drawfloor(self, angle=None, inside_radius=None, outside_radius=None): - with self.saved_context(): - self.moveTo(inside_radius, 0) - self.moveArc(90) - self.polyline(0, (angle, inside_radius)) - - with self.saved_context(): - self.moveTo(outside_radius, 0) - self.moveArc(90) - self.polyline(0, (angle, outside_radius)) - self.polyline(0, 90) - self.edges["f"](outside_radius-inside_radius) - - with self.saved_context(): - self.moveTo(inside_radius, 0) - self.edges["f"](outside_radius-inside_radius) def render(self): - angle,inside_radius,outside_radius, h = self.angle, self.inside_radius, self.outside_radius, self.h + angle, inside_radius, outside_radius, h = self.angle, self.inside_radius, self.outside_radius, self.h t = self.thickness # angle = 30 - self.moveTo(-inside_radius, 5) - self.drawfloor(angle, inside_radius, outside_radius) - self.moveTo(outside_radius+5, 0) - - #flex wall for outside - outside_wall = angle * (math.pi / 180) * outside_radius - self.rectangularWall(outside_wall, h, "eFeF", move="right") - # l = 2/3. * outside_radius-inside_radius - # r = l/2. - 0.5*t - # borders = [10, (outside_wall, outside_wall), 10,1] - # self.polygonWalls(borders, h, "f", "f") - - #flex wall for inside - inside_wall = angle * (math.pi / 180) * inside_radius - self.rectangularWall(inside_wall, h, "eFeF", move="right") + s = 0.2 * inside_radius - #solid endcap walls - self.flangedWall(outside_radius-inside_radius,h, "FfFf", move="up" ) - self.flangedWall(outside_radius-inside_radius,h, "FfFf", move="right") + poly=[s, (angle, outside_radius-s), s, 90, + outside_radius-inside_radius, 90, + s, (-angle, inside_radius-s), s, 90, + outside_radius-inside_radius, 90] + with self.saved_context(): + self.polygonWall(poly, move="right") + if self.top == "closed": + self.polygonWall(poly, move="right") + else: + self.polygonWall(poly, callback=[self.holeCB], move="right") + if self.top == "lid": + self.polygonWall(poly, edge="E", move="right") - \ No newline at end of file + self.polygonWall(poly, move="up only") + self.moveTo(0, t) + self.polygonWalls(poly, self.h) From 9866fd0581104881fda77b1e1a0aa9f1887d3bdd Mon Sep 17 00:00:00 2001 From: mtintes Date: Fri, 13 Jun 2025 21:03:23 -0500 Subject: [PATCH 4/9] makes walls flex --- boxes/generators/lazysusan.py | 97 +++++++++++++++++++++++++++-------- examples/LazySusan.svg | 21 +++----- 2 files changed, 83 insertions(+), 35 deletions(-) diff --git a/boxes/generators/lazysusan.py b/boxes/generators/lazysusan.py index 5dbde3c06..7d23149fb 100644 --- a/boxes/generators/lazysusan.py +++ b/boxes/generators/lazysusan.py @@ -26,16 +26,16 @@ def __init__(self) -> None: self.addSettingsArgs(edges.FingerJointSettings, finger=1.0,space=1.0) self.addSettingsArgs(edges.FlexSettings) - - self.buildArgParser(h=50) + + self.buildArgParser(h=30) self.argparser.add_argument( "--inside_radius", action="store", type=float, default=40, help="inside radius of the lazy susan") self.argparser.add_argument( - "--outside_radius", action="store", type=float, default=90, + "--outside_radius", action="store", type=float, default=280, help="outside radius of the lazy susan") self.argparser.add_argument( - "--angle", action="store", type=float, default=90, + "--angle", action="store", type=float, default=50, help="angle of the lazy susan") self.argparser.add_argument( "--top", action="store", type=str, default="hole", @@ -54,28 +54,81 @@ def holeCB(self): self.moveTo(d, d) self.polyline(*poly) - + def drawfloor(self, angle=None, inside_radius=None, outside_radius=None): + with self.saved_context(): + self.moveTo(inside_radius, 0) + self.moveArc(90) + self.polyline(0, (angle, inside_radius)) + + with self.saved_context(): + self.moveTo(outside_radius, 0) + self.moveArc(90) + self.polyline(0, (angle, outside_radius)) + self.polyline(0, 90) + self.edges["f"](outside_radius-inside_radius) + + with self.saved_context(): + self.moveTo(inside_radius, 0) + self.edges["f"](outside_radius-inside_radius) + + def drawWall(self, length, height, edges): + """Draw a wall with the given width, height, edges and label.""" + with self.saved_context(): + self.moveTo(0, 0) + self.edges[edges[0]](length) + self.corner(90) + self.edges[edges[1]](height) + self.corner(90) + self.edges[edges[2]](length) + self.corner(90) + self.edges[edges[3]](height) + + def drawFlexWall(self, length, height): + """Draw a wall with the given width, height, edges and label.""" + with self.saved_context(): + self.moveTo(0, 0) + self.edges["X"](length, h=height) + self.corner(90) + self.edges["f"](height, h=length) + self.corner(90) + self.edges["e"](length, h=height) + self.corner(90) + self.edges["f"](height, h=length) + + + + def render(self): angle, inside_radius, outside_radius, h = self.angle, self.inside_radius, self.outside_radius, self.h t = self.thickness # angle = 30 - s = 0.2 * inside_radius + self.moveTo(0, 5) + self.drawfloor(angle, inside_radius, outside_radius) + self.moveTo(outside_radius+5, 0) + + # #flex wall for outside + outside_wall = angle * (math.pi / 180) * outside_radius + # self.rectangularWall(outside_wall, h, "eFeF", move="right",label="Outside Wall") + # # self.edges["X"](-outside_wall, h=h) + self.drawFlexWall(outside_wall, h) - poly=[s, (angle, outside_radius-s), s, 90, - outside_radius-inside_radius, 90, - s, (-angle, inside_radius-s), s, 90, - outside_radius-inside_radius, 90] - with self.saved_context(): - self.polygonWall(poly, move="right") - if self.top == "closed": - self.polygonWall(poly, move="right") - else: - self.polygonWall(poly, callback=[self.holeCB], move="right") - if self.top == "lid": - self.polygonWall(poly, edge="E", move="right") - - self.polygonWall(poly, move="up only") - self.moveTo(0, t) - self.polygonWalls(poly, self.h) + + #flex wall for inside + self.moveTo(outside_wall+10, 0) + inside_wall = angle * (math.pi / 180) * inside_radius + self.drawFlexWall(inside_wall, h) + # self.rectangularWall(inside_wall, h, "eFeF", move="right",label="Inside Wall") + + #solid endcap walls + self.moveTo(inside_wall+10,0) + self.drawWall(outside_radius-inside_radius, h, "FFeF") + + self.moveTo(outside_radius-inside_radius+10, 0) + # self.flangedWall(outside_radius-inside_radius,h, "Ffef", move="up",label="end cap" ) + self.drawWall(outside_radius-inside_radius, h, "FFeF") + # self.flangedWall(outside_radius-inside_radius,h, "Ffef", move="right",label="end cap") + + # # self.edges["X"](50, h=50) + diff --git a/examples/LazySusan.svg b/examples/LazySusan.svg index f71b075d2..23c9c63da 100644 --- a/examples/LazySusan.svg +++ b/examples/LazySusan.svg @@ -1,5 +1,5 @@ - +