2022-01-07 11:05:16 +01:00
|
|
|
#!/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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
from boxes import *
|
2023-04-06 21:06:28 +02:00
|
|
|
from boxes.lids import LidSettings
|
2022-01-07 11:05:16 +01:00
|
|
|
|
|
|
|
class ABox(Boxes):
|
|
|
|
"""A simple Box"""
|
|
|
|
|
|
|
|
description = "This box is kept simple on purpose. If you need more features have a look at the UniversalBox."
|
|
|
|
|
|
|
|
ui_group = "Box"
|
|
|
|
|
2023-01-08 19:41:02 +01:00
|
|
|
def __init__(self) -> None:
|
2022-01-07 11:05:16 +01:00
|
|
|
Boxes.__init__(self)
|
|
|
|
self.addSettingsArgs(edges.FingerJointSettings)
|
2023-04-06 21:06:28 +02:00
|
|
|
self.addSettingsArgs(LidSettings)
|
2022-01-07 11:05:16 +01:00
|
|
|
self.buildArgParser("x", "y", "h", "outside", "bottom_edge")
|
|
|
|
|
|
|
|
def render(self):
|
|
|
|
x, y, h = self.x, self.y, self.h
|
|
|
|
t = self.thickness
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
|
|
|
if self.outside:
|
|
|
|
self.x = x = self.adjustSize(x, sideedge, sideedge)
|
|
|
|
self.y = y = self.adjustSize(y)
|
|
|
|
self.h = h = self.adjustSize(h, b, t1)
|
|
|
|
|
|
|
|
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")
|
2023-04-06 21:06:28 +02:00
|
|
|
self.lid(x, y)
|
2022-01-07 11:05:16 +01:00
|
|
|
|
|
|
|
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")
|
|
|
|
|
|
|
|
|