Add 10" rack box derived from 19" rack box

This commit is contained in:
Sebastian Reichel 2018-06-21 23:59:16 +02:00 committed by Florian Festi
parent d75ea78196
commit 8b172cbddd
2 changed files with 33 additions and 2 deletions

View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# Copyright (C) 2018 Sebastian Reichel
#
# 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 boxes.generators.rack19box import Rack19Box
class Rack10Box(Rack19Box):
"""Closed box with screw on top for mounting in a 10" rack."""
def render(self):
self._render(type=10)

View File

@ -62,12 +62,16 @@ class Rack19Box(Boxes):
self.fingerHolesAt(self.y, self.h-1.5*t, self.triangle, 180)
def render(self):
def _render(self, type):
self.open()
t = self.thickness
self.h = h = self.height * 44.45 - 0.787 - t
x = self.x = 448.0 - 2*t
if type == 10:
self.x = 219.0 - 2*t
else:
self.x = 448.0 - 2*t
x = self.x
y = self.y = self.depth
d1, d2 =self.d1, self.d2
@ -90,3 +94,6 @@ class Rack19Box(Boxes):
callback=[None, lambda: self.hole(trh, trh, d=d1)])
self.close()
def render(self):
self._render(type=19)