diff --git a/boxes/generators/traylayout.py b/boxes/generators/traylayout.py index 1109979..5f18e9c 100755 --- a/boxes/generators/traylayout.py +++ b/boxes/generators/traylayout.py @@ -91,18 +91,26 @@ class Layout(Boxes): edge(length) def render(self): - self.open(1000, 600) self.hi = hi = self.hi or self.h - - self.edges["s"] = boxes.edges.Slot(self, self.hi/2.0) - self.edges["C"] = boxes.edges.CrossingFingerHoleEdge(self, self.hi) lx = len(self.x) ly = len(self.y) t = self.thickness t2 = self.thickness / 2.0 - + + hasfloor = False + + for line in self.floors: + for f in line: + hasfloor |= f + + self.open(max((lx+1)*sum(self.y), (ly+1)*sum(self.x))+lx*ly*4*t, + 2*self.h + hasfloor*sum(self.y) + 12*t) + + self.edges["s"] = boxes.edges.Slot(self, self.hi/2.0) + self.edges["C"] = boxes.edges.CrossingFingerHoleEdge(self, self.hi) + self.ctx.save() # Horizontal Walls