OttoLegs: Make room for cables

This commit is contained in:
Florian Festi 2017-02-08 23:38:17 +01:00
parent db4e878bb4
commit e316877d06
1 changed files with 11 additions and 21 deletions

View File

@ -32,16 +32,8 @@ class OttoLegs(Boxes):
def __init__(self): def __init__(self):
Boxes.__init__(self) Boxes.__init__(self)
# Uncomment the settings for the edge types you use
self.addSettingsArgs(edges.FingerJointSettings) self.addSettingsArgs(edges.FingerJointSettings)
# remove cli params you do not need
#self.buildArgParser("x", "sx", "y", "sy", "h", "hi")
# Add non default cli params if needed (see argparse std lib)
#self.argparser.add_argument(
# "--XX", action="store", type=float, default=0.5,
# help="DESCRIPTION")
def foot(self, x, y, ly, l, r=5., move=None): def foot(self, x, y, ly, l, r=5., move=None):
if self.move(x, y, move, True): if self.move(x, y, move, True):
return return
@ -55,8 +47,6 @@ class OttoLegs(Boxes):
for l in (x, y, x, y): for l in (x, y, x, y):
self.polyline(l - 2*r, 45, r*2**0.5, 45) self.polyline(l - 2*r, 45, r*2**0.5, 45)
self.move(x, y, move) self.move(x, y, move)
def ankle1(self): def ankle1(self):
@ -77,29 +67,29 @@ class OttoLegs(Boxes):
# Initialize canvas # Initialize canvas
self.open() self.open()
lx, ly, lh = 12.4, 22.5, 40.0 lx, ly, lh = 12.4, 23.5, 40.0
self.ctx.save() self.ctx.save()
# Legs # Legs
c1 = edges.CompoundEdge(self, "EF", (6.0, lh-6.0)) c1 = edges.CompoundEdge(self, "FE", (ly-7.0, 7.0))
e = ["F", c1, "F", "F"] c2 = edges.CompoundEdge(self, "EF", (8.0, lh-8.0))
self.rectangularWall(lx, lh-6., [LegEdge(self, None), "f", "F", "f"], move="right") e = [c1, c2, "F", "F"]
self.rectangularWall(lx, lh-8., [LegEdge(self, None), "f", "F", "f"], move="right")
self.rectangularWall(lx, lh, "FfFf", callback=[ self.rectangularWall(lx, lh, "FfFf", callback=[
lambda:self.hole(6, 6, 1.5)], move="right") lambda:self.hole(6, 8, 1.5)], move="right")
self.rectangularWall(ly, lh, e, move="right") self.rectangularWall(ly, lh, e, move="right")
self.rectangularWall(ly, lh, e, move="right") self.rectangularWall(ly, lh, e, callback=[
self.rectangularWall(lx, ly, "Efff", callback=[ lambda:self.hole(ly/2, 32, 5)], move="right")
lambda:self.rectangularHole(6.1, 6.35, 12, 2.4), None, self.rectangularWall(lx, ly-7.0, "efff", move="right")
lambda:self.rectangularHole(4, 8, 8, 2.)], move="right")
self.rectangularWall(lx, ly, "ffff", callback=[lambda: self.hole(lx/2, ly/2, 2.3)], move="right") self.rectangularWall(lx, ly, "ffff", callback=[lambda: self.hole(lx/2, ly/2, 2.3)], move="right")
self.rectangularWall(lx, ly, "eeee", callback=[lambda: self.hole(lx/2, ly/2, 1.5)], move="right") self.rectangularWall(lx, ly, "eeee", callback=[lambda: self.hole(lx/2, ly/2, 1.5)], move="right")
self.ctx.restore() self.ctx.restore()
self.rectangularWall(lx, lh, "ffff", move="up only") self.rectangularWall(lx, lh, "ffff", move="up only")
# feet # feet
self.rectangularTriangle(30, 25, "fee", r=20, num=4, callback=[None, self.ankle1], move="right") self.rectangularTriangle(30, 25, "fee", r=20, num=2, callback=[None, self.ankle1], move="right")
self.rectangularTriangle(30, 25, "fee", r=20, num=4, callback=[None, self.ankle2], move="right") self.rectangularTriangle(30, 25, "fee", r=20, num=2, callback=[None, self.ankle2], move="right")
self.foot(60, 40, ly, 30, move="right") self.foot(60, 40, ly, 30, move="right")
self.foot(60, 40, ly, 30, move="right") self.foot(60, 40, ly, 30, move="right")
self.close() self.close()