Source code for boxes.generators.wallconsole

#!/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
#   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 <>.

from boxes.walledges import _WallMountedBox

[docs]class WallConsole(_WallMountedBox): """Outset and angled plate to mount stuff to""" def __init__(self) -> None: super().__init__() self.buildArgParser(sx=100, h=100, outside=True) self.argparser.add_argument( "--top_depth", action="store", type=float, default=50, help="depth at the top") self.argparser.add_argument( "--bottom_depth", action="store", type=float, default=35, help="depth at the bottom") def backHoles(self): posx = -0.5 * self.thickness for x in[:-1]: posx += x + self.thickness self.wallHolesAt(posx, 0, self.h, 90) def frontHoles(self): posx = -0.5 * self.thickness for x in[:-1]: posx += x + self.thickness self.fingerHolesAt(posx, 0, self.front, 90) def render(self): self.generateWallEdges() if self.outside: = self.adjustSize( self.h = self.adjustSize(self.h) x = sum( + self.thickness * (len( - 1) h = self.h td = self.top_depth bd = self.bottom_depth self.front = (h**2 + (td-bd)**2)**0.5 self.rectangularWall(x, h, "eCec", callback=[self.backHoles], move="up") self.rectangularWall(x, self.front, "eFeF", callback=[self.frontHoles], move="up") for i in range(len( self.trapezoidWall(h, td, bd, "befe", move="up")