From 5e33d057fc5644705ec894cea5db4148c8ccee79 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Wed, 15 Feb 2017 19:33:10 +0100 Subject: [PATCH] UBox: Limit radius to possible values and merge flex if radii touch --- boxes/generators/ubox.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/boxes/generators/ubox.py b/boxes/generators/ubox.py index 55f4d72..d5f56d0 100644 --- a/boxes/generators/ubox.py +++ b/boxes/generators/ubox.py @@ -75,9 +75,12 @@ class UBox(_TopEdge, _ChestLid): for nr, flex in enumerate("XE"): self.edges["F"](y-r) - self.edges[flex](cl, h=th) - self.edges["F"](x-2*r) - self.edges[flex](cl, h=th) + if x-2*r > 0.1 * self.thickness: + self.edges[flex](cl, h=th) + self.edges["F"](x-2*r) + self.edges[flex](cl, h=th) + else: + self.edges[flex](2*cl+x-2*r, h=th) self.edges["F"](y-r) self.edgeCorner("F", e[nr]) e[nr](h) @@ -88,6 +91,8 @@ class UBox(_TopEdge, _ChestLid): def render(self): x, y, h, r = self.x, self.y, self.h, self.radius + self.radius = r = min(r, x/2.0, y) + self.open() t1, t2, t3, t4 = self.topEdges(self.top_edge)