From 8b172cbddd94e0759f36f87907c71f58b5dfb445 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Thu, 21 Jun 2018 23:59:16 +0200 Subject: [PATCH] Add 10" rack box derived from 19" rack box --- boxes/generators/rack10box.py | 24 ++++++++++++++++++++++++ boxes/generators/rack19box.py | 11 +++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 boxes/generators/rack10box.py diff --git a/boxes/generators/rack10box.py b/boxes/generators/rack10box.py new file mode 100644 index 0000000..e38d212 --- /dev/null +++ b/boxes/generators/rack10box.py @@ -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 . + +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) diff --git a/boxes/generators/rack19box.py b/boxes/generators/rack19box.py index e88c6aa..01091db 100644 --- a/boxes/generators/rack19box.py +++ b/boxes/generators/rack19box.py @@ -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)