boxespy/boxes/generators/rectangularWall.py

72 lines
3.0 KiB
Python
Raw Normal View History

2018-12-27 17:13:47 +01:00
#!/usr/bin/env python3
# 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 <http://www.gnu.org/licenses/>.
from boxes import *
class RectangularWall(Boxes):
"""Simple wall"""
ui_group = "Part" # see ./__init__.py for names
2023-01-08 19:41:02 +01:00
def __init__(self) -> None:
2018-12-27 17:13:47 +01:00
Boxes.__init__(self)
self.addSettingsArgs(edges.CabinetHingeSettings)
self.addSettingsArgs(edges.ClickSettings)
self.addSettingsArgs(edges.DoveTailSettings)
self.addSettingsArgs(edges.FingerJointSettings)
self.addSettingsArgs(edges.GearSettings)
self.addSettingsArgs(edges.GripSettings)
self.addSettingsArgs(edges.HingeSettings)
self.addSettingsArgs(edges.ChestHingeSettings)
self.addSettingsArgs(edges.SlideOnLidSettings)
2018-12-27 17:13:47 +01:00
self.addSettingsArgs(edges.StackableSettings)
self.buildArgParser(x=100, h=100)
self.argparser.add_argument(
"--bottom_edge", action="store",
type=ArgparseEdgeType("cCdDeEfFghiIjJkKlLmMnNoOpPqQRsSšŠuUvV"), choices=list("cCdDeEfFghiIjJkKlLmMnNoOpPqQRsSšŠuUvV"),
2018-12-27 17:13:47 +01:00
default="e", help="edge type for bottom edge")
self.argparser.add_argument(
"--right_edge", action="store",
type=ArgparseEdgeType("cCdDeEfFghiIjJkKlLmMnNoOpPqQRsSšŠuUvV"), choices=list("cCdDeEfFghiIjJkKlLmMnNoOpPqQRsSšŠuUvV"),
2018-12-27 17:13:47 +01:00
default="e", help="edge type for right edge")
self.argparser.add_argument(
"--top_edge", action="store",
type=ArgparseEdgeType("cCdDeEfFghiIjJkKlLmMnNoOpPqQRsSšŠuUvV"), choices=list("cCdDeEfFghiIjJkKlLmMnNoOpPqQRsSšŠuUvV"),
2018-12-27 17:13:47 +01:00
default="e", help="edge type for top edge")
self.argparser.add_argument(
"--left_edge", action="store",
type=ArgparseEdgeType("cCdDeEfFghiIjJkKlLmMnNoOpPqQRsSšŠuUvV"), choices=list("cCdDeEfFghiIjJkKlLmMnNoOpPqQRsSšŠuUvV"),
2018-12-27 17:13:47 +01:00
default="e", help="edge type for left edge")
def cb(self, nr):
t = self.thickness
if self.edgetypes[nr] == "f":
self.fingerHolesAt(0, -2.5*t, self.h if nr % 2 else self.x, 0)
def render(self):
# adjust to the variables you want in the local scope
t = self.thickness
self.edgetypes = [self.bottom_edge, self.right_edge, self.top_edge, self.left_edge]
self.moveTo(3*t, 3*t)
self.rectangularWall(self.x, self.h, self.edgetypes, callback=self.cb)