Skip to content

Commit

Permalink
Add generator for Z-Beam or U-Beam
Browse files Browse the repository at this point in the history
Can be a Z-Beam or a U-Beam depending on the orientation of the
pieces. With the --flanged_ubeam option, a 4th piece is added for a flange.
  • Loading branch information
jasondunsmore authored and florianfesti committed Dec 15, 2024
1 parent 30bee5a commit 819fecb
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 0 deletions.
65 changes: 65 additions & 0 deletions boxes/generators/zbeam.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 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 <http://www.gnu.org/licenses/>.

from boxes import *


class ZBeam(Boxes):
"""Z-Beam (or U-Beam): three pieces joined at right angles"""
description = """
With the "flanged_ubeam" option, there is a fourth piece the length of "y".
![U-Beam with flange](static/samples/ZBeam-flanged-ubeam.jpg)
"""

ui_group = "Part"

def __init__(self) -> None:
Boxes.__init__(self)
self.argparser.add_argument(
"--top_edge", action="store", type=ArgparseEdgeType("Ffe"),
choices=list("Ffe"), default="e", help="edge type for top edge")
self.argparser.add_argument(
"--bottom_edge", action="store", type=ArgparseEdgeType("Ffe"),
choices=list("Ffe"), default="e", help="edge type for bottom edge")
self.buildArgParser("x", "y")
self.argparser.add_argument(
"--z", action="store", type=float, default=100.0,
help="inner depth in mm")
self.argparser.add_argument(
"--flanged_ubeam", action="store", type=boolarg, default=False,
help="Add a fourth piece to make a U-Beam with a flange")
self.buildArgParser("h", "outside")
self.addSettingsArgs(edges.FingerJointSettings)

def render(self):
x, y, z, h = self.x, self.y, self.z, self.h
t = self.thickness

if self.outside:
x = self.adjustSize(x, False)
y = self.adjustSize(y, False)
z = self.adjustSize(z, False)

self.rectangularWall(
x, h, self.bottom_edge + "F" + self.top_edge + "e", move="right")
self.rectangularWall(
y, h, self.bottom_edge + "f" + self.top_edge + "f", move="right")
if self.flanged_ubeam:
self.rectangularWall(
z, h, self.bottom_edge + "F" + self.top_edge + "F", move="right")
self.rectangularWall(
y + self.thickness, h, self.bottom_edge + "e" + self.top_edge + "f")
else:
self.rectangularWall(z, h, self.bottom_edge + "e" + self.top_edge + "F")
46 changes: 46 additions & 0 deletions examples/ZBeam.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/samples/ZBeam-flanged-ubeam-thumb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/samples/ZBeam-flanged-ubeam.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/samples/ZBeam-thumb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/samples/ZBeam.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions static/samples/samples.sha256
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,5 @@ fec237bd76c18f1cad18a888f57299e5ff5033ab8032e7a26ea0b1259a42d150 ../static/samp
ca53e3c8b9ba8d46ca2d6fdff24865514dde27380b409fef82f0b87ac0bada2d ../static/samples/HobbyCase.jpg
47910e8cf07e0339437d441b0fe270b05973317462495a7bb122bbcb779b135c ../static/samples/WallHopper.jpg
478769d7f422d0e47d50c7c1476b72a269f9acd03042d2d16dc0c00fa80941f6 ../static/samples/WallStackableBin.jpg
fe3b0c23e7fb2fa4b2ede51a312794ff1a689e99af9feec7752b8ed87962f3a7 ../static/samples/ZBeam.jpg
f8b2daab68479c4bdd59ac1da1d2cb31ab567f96bfef111fb1687d65b8233108 ../static/samples/ZBeam-flanged-ubeam.jpg

0 comments on commit 819fecb

Please sign in to comment.