Add params for top and bottom edges of box2

This commit is contained in:
Florian Festi 2016-04-09 11:47:12 +02:00
parent 6cf7af75c6
commit 7048681f3e
2 changed files with 22 additions and 7 deletions

View File

@ -193,6 +193,14 @@ class Boxes:
self.argparser.add_argument(
"--hi", action="store", type=float, default=0.0,
help="inner height of inner walls in mm (leave to zero for same as outer walls)")
elif arg == "bottom_edge":
self.argparser.add_argument(
"--bottom_edge", action="store", type=str, default="h",
help="edge type for bottom edge")
elif arg == "top_edge":
self.argparser.add_argument(
"--top_edge", action="store", type=str, default="e",
help="edge type for top edge")
else:
raise ValueError("No default for argument", arg)

View File

@ -23,7 +23,7 @@ class Box(Boxes):
def __init__(self):
Boxes.__init__(self)
self.buildArgParser("x", "y", "h")
self.buildArgParser("top_edge", "bottom_edge", "x", "y", "h")
self.argparser.set_defaults(
fingerjointfinger=3.0,
fingerjointspace=3.0
@ -31,19 +31,26 @@ class Box(Boxes):
def render(self):
x, y, h = self.x, self.y, self.h
t = self.thickness
self.open(width=x+y+40, height=y+2*h+50)
b = self.edges.get(self.bottom_edge, self.edges["F"])
t = self.edges.get(self.top_edge, self.edges["e"])
d2 = Bolts(2)
d3 = Bolts(3)
d2 = d3 = None
self.moveTo(t, t)
self.rectangularWall(x, h, "hFeF", bedBolts=[d2], move="right")
self.rectangularWall(y, h, "hfef", bedBolts=[d3], move="up")
self.rectangularWall(y, h, "hfef", bedBolts=[d3])
self.rectangularWall(x, h, "hFeF", bedBolts=[d2], move="left up")
self.moveTo(self.thickness, self.thickness)
self.rectangularWall(x, h, [b, "F", t, "F"],
bedBolts=[d2], move="right")
self.rectangularWall(y, h, [b, "f", t, "f"],
bedBolts=[d3], move="up")
self.rectangularWall(y, h, [b, "f", t, "f"],
bedBolts=[d3])
self.rectangularWall(x, h, [b, "F", t, "F"],
bedBolts=[d2], move="left up")
self.rectangularWall(x, y, "ffff", bedBolts=[d2, d3, d2, d3])