boxespy/boxes/generators/walldrillbox.py

55 lines
2.2 KiB
Python
Raw Normal View History

2019-07-12 00:43:06 +02:00
#!/usr/bin/env python3
# Copyright (C) 2013-2019 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 *
from .drillstand import DrillStand
from boxes.walledges import _WallMountedBox
2019-07-12 00:43:06 +02:00
class WallDrillBox(DrillStand, _WallMountedBox):
2019-07-12 00:43:06 +02:00
"""Box for drills with each compartment with a different height"""
ui_group = "WallMounted"
2019-07-12 00:43:06 +02:00
def __init__(self):
_WallMountedBox.__init__(self) # don't call DrillStand.__init__
2019-07-12 00:43:06 +02:00
2022-06-10 23:32:32 +02:00
self.addSettingsArgs(edges.StackableSettings, height=1.0, width=3)
2019-07-12 00:43:06 +02:00
self.buildArgParser(sx="25*6", sy="10:20:30", sh="25:40:60")
self.argparser.add_argument(
"--extra_height", action="store", type=float, default=15.0,
help="height difference left to right")
def render(self):
self.generateWallEdges()
2019-07-12 00:43:06 +02:00
t = self.thickness
sx, sy, sh = self.sx, self.sy, self.sh
self.x = x = sum(sx) + len(sx)*t - t
self.y = y = sum(sy) + len(sy)*t - t
bottom_angle = math.atan(self.extra_height / x) # radians
self.xOutsideWall(sh[0], "hFeF", move="up")
2019-07-12 00:43:06 +02:00
for i in range(1, len(sy)):
self.xWall(i, move="up")
self.xOutsideWall(sh[-1], "hCec", move="up")
2019-07-12 00:43:06 +02:00
self.rectangularWall(x/math.cos(bottom_angle)-t*math.tan(bottom_angle), y, "fefe", callback=[self.bottomCB], move="up")
2019-07-12 00:43:06 +02:00
2022-01-23 18:26:11 +01:00
self.sideWall(edges="eBf", foot_height=2*t, move="right")
for i in range(1, len(sx)):
2019-07-12 00:43:06 +02:00
self.yWall(i, move="right")
2022-01-23 18:26:11 +01:00
self.sideWall(self.extra_height, foot_height=2*t, edges="eBf", move="right")