typetray.py: Have a separate height for inner walls
This commit is contained in:
parent
12b5b71300
commit
e716bdcc57
20
typetray.py
20
typetray.py
|
@ -39,8 +39,9 @@ class TopEdge(BottomEdge):
|
||||||
self.boxes.edge(self.sections[-1])
|
self.boxes.edge(self.sections[-1])
|
||||||
|
|
||||||
class TypeTray(Boxes):
|
class TypeTray(Boxes):
|
||||||
def __init__(self, x, y, h, **kw):
|
def __init__(self, x, y, h, hi=None, **kw):
|
||||||
self.x, self.y, self.h = x, y, h
|
self.x, self.y, self.h = x, y, h
|
||||||
|
self.hi = hi or h
|
||||||
Boxes.__init__(self, width=sum(x)+sum(y)+70, height=sum(y)+8*h+50, **kw)
|
Boxes.__init__(self, width=sum(x)+sum(y)+70, height=sum(y)+8*h+50, **kw)
|
||||||
|
|
||||||
def xSlots(self):
|
def xSlots(self):
|
||||||
|
@ -65,13 +66,13 @@ class TypeTray(Boxes):
|
||||||
posx = -0.5 * self.thickness
|
posx = -0.5 * self.thickness
|
||||||
for x in self.x[:-1]:
|
for x in self.x[:-1]:
|
||||||
posx += x + self.thickness
|
posx += x + self.thickness
|
||||||
self.fingerHolesAt(posx, 0, self.h)
|
self.fingerHolesAt(posx, 0, self.hi)
|
||||||
|
|
||||||
def yHoles(self):
|
def yHoles(self):
|
||||||
posy = -0.5 * self.thickness
|
posy = -0.5 * self.thickness
|
||||||
for y in self.y[:-1]:
|
for y in self.y[:-1]:
|
||||||
posy += y + self.thickness
|
posy += y + self.thickness
|
||||||
self.fingerHolesAt(posy, 0, self.h)
|
self.fingerHolesAt(posy, 0, self.hi)
|
||||||
|
|
||||||
def fingerHole(self):
|
def fingerHole(self):
|
||||||
dx = 50
|
dx = 50
|
||||||
|
@ -89,6 +90,7 @@ class TypeTray(Boxes):
|
||||||
x = sum(self.x) + self.thickness * (len(self.x)-1)
|
x = sum(self.x) + self.thickness * (len(self.x)-1)
|
||||||
y = sum(self.y) + self.thickness * (len(self.y)-1)
|
y = sum(self.y) + self.thickness * (len(self.y)-1)
|
||||||
h = self.h
|
h = self.h
|
||||||
|
hi = self.hi
|
||||||
t = self.thickness
|
t = self.thickness
|
||||||
|
|
||||||
self.moveTo(t, t)
|
self.moveTo(t, t)
|
||||||
|
@ -108,13 +110,13 @@ class TypeTray(Boxes):
|
||||||
move="right")
|
move="right")
|
||||||
# Inner walls
|
# Inner walls
|
||||||
for i in range(len(self.x)-1):
|
for i in range(len(self.x)-1):
|
||||||
e = [BottomEdge(self, self.y, 0.5*h), "f", "e", "f"]
|
e = [BottomEdge(self, self.y, 0.5*hi), "f", "e", "f"]
|
||||||
self.rectangularWall(y, h, e,
|
self.rectangularWall(y, hi, e,
|
||||||
move="up")
|
move="up")
|
||||||
for i in range(len(self.y)-1):
|
for i in range(len(self.y)-1):
|
||||||
e = [BottomEdge(self, self.x), "f",
|
e = [BottomEdge(self, self.x), "f",
|
||||||
TopEdge(self, self.x, 0.5*h), "f"]
|
TopEdge(self, self.x, 0.5*hi), "f"]
|
||||||
self.rectangularWall(x, h, e,
|
self.rectangularWall(x, hi, e,
|
||||||
move="up")
|
move="up")
|
||||||
|
|
||||||
self.ctx.stroke()
|
self.ctx.stroke()
|
||||||
|
@ -129,7 +131,7 @@ thickness=4.0
|
||||||
|
|
||||||
dx = (x-thickness)/nx-thickness
|
dx = (x-thickness)/nx-thickness
|
||||||
dy = (y-thickness)/ny-thickness
|
dy = (y-thickness)/ny-thickness
|
||||||
b = TypeTray([dx]*nx, [120, 300-3*thickness-120], 78-thickness, thickness=thickness)
|
b = TypeTray([dx]*nx, [120, 300-3*thickness-120], 78-thickness, 40, thickness=thickness)
|
||||||
b.edges["f"].settings.setValues(b.thickness, space=3, finger=3,
|
b.edges["f"].settings.setValues(b.thickness, space=3, finger=3,
|
||||||
surroundingspaces=0.5, burn=0.13)
|
surroundingspaces=0.5)
|
||||||
b.render()
|
b.render()
|
||||||
|
|
Loading…
Reference in New Issue