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 *
|
2022-01-23 16:20:22 +01:00
|
|
|
from .drillstand import DrillStand
|
2022-06-22 22:50:57 +02:00
|
|
|
from boxes.walledges import _WallMountedBox
|
2019-07-12 00:43:06 +02:00
|
|
|
|
2022-06-22 22:50:57 +02:00
|
|
|
class WallDrillBox(DrillStand, _WallMountedBox):
|
2019-07-12 00:43:06 +02:00
|
|
|
"""Box for drills with each compartment with a different height"""
|
2022-07-28 22:39:10 +02:00
|
|
|
ui_group = "WallMounted"
|
2019-07-12 00:43:06 +02:00
|
|
|
|
|
|
|
def __init__(self):
|
2022-06-22 22:50:57 +02:00
|
|
|
_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):
|
2022-02-20 21:18:28 +01:00
|
|
|
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
|
|
|
|
|
2022-01-23 16:20:22 +01:00
|
|
|
bottom_angle = math.atan(self.extra_height / x) # radians
|
|
|
|
|
2022-01-23 16:39:40 +01:00
|
|
|
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")
|
2022-01-23 16:39:40 +01:00
|
|
|
self.xOutsideWall(sh[-1], "hCec", move="up")
|
2019-07-12 00:43:06 +02:00
|
|
|
|
2022-01-23 16:39:40 +01: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")
|
2019-08-10 23:00:32 +02:00
|
|
|
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")
|