UniversalBox: Use a more robust way of placing the pieces

No longer rely on all side walls having the same height
This commit is contained in:
Florian Festi 2019-01-11 12:19:16 +01:00
parent 97e7e3b68f
commit 64fb498e6e
1 changed files with 13 additions and 9 deletions

View File

@ -31,7 +31,7 @@ class UniversalBox(_TopEdge, _ChestLid):
self.argparser.add_argument(
"--lid", action="store", type=str, default="default (none)",
choices=("default (none)", "chest", "flat"),
help="additional lid")
help="additional lid (for straight top_edge only)")
self.angle = 0
def top_hole(self, x, y, top_edge):
@ -66,19 +66,15 @@ class UniversalBox(_TopEdge, _ChestLid):
d2 = d3 = None
self.rectangularWall(y, h, [b, "f", t2, "f"],
bedBolts=[d3], move="right")
self.ctx.save()
self.rectangularWall(x, h, [b, "F", t1, "F"],
bedBolts=[d2], move="up")
self.rectangularWall(x, h, [b, "F", t3, "F"],
bedBolts=[d2])
self.rectangularWall(y, h, [b, "f", t4, "f"],
bedBolts=[d3], move="left")
self.rectangularWall(x, h, [b, "F", t3, "F"],
bedBolts=[d2], move="up only")
bedBolts=[d2], move="up")
if self.bottom_edge != "e":
self.rectangularWall(x, y, "ffff", bedBolts=[d2, d3, d2, d3], move="right")
self.rectangularWall(x, y, "ffff", bedBolts=[d2, d3, d2, d3], move="up")
if (self.drawLid(x, y, self.top_edge, [d2, d3]) and
self.bottom_edge != "e"):
self.rectangularWall(x, y, "ffff", move="left only")
@ -89,5 +85,13 @@ class UniversalBox(_TopEdge, _ChestLid):
self.ctx.set_source_rgb(0, 0, 0)
self.drawAddOnLid(x, y, self.lid)
self.ctx.restore()
self.rectangularWall(x, h, [b, "F", t3, "F"],
bedBolts=[d2], move="right only")
self.rectangularWall(y, h, [b, "f", t2, "f"],
bedBolts=[d3], move="up")
self.rectangularWall(y, h, [b, "f", t4, "f"],
bedBolts=[d3], move="up")
self.close()