Skip to content

Commit

Permalink
FlexBook: Use rectagularWalls where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
florianfesti committed Mar 12, 2024
1 parent 9e6ed3e commit 130a531
Showing 1 changed file with 12 additions and 33 deletions.
45 changes: 12 additions & 33 deletions boxes/generators/flexbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ def flexBookLatchWall(self, h, y, latchSize, callback=None, move=None):
(90, t/2),
2.5*t,
-90,
(y-latchSize) / 2)

self.corner(90)
(y-latchSize) / 2,
90
)

self.move(tw, th, move)

Expand Down Expand Up @@ -223,38 +223,12 @@ def flexBookLatchBracket(self, isCover, move=None):

if not isCover:
# anchor pin
self.moveTo(-1.25*t, 1.5*t)
self.edges["e"](t)
self.corner(90)
self.edges["e"](2*t)
self.corner(90)
self.edges["e"](t)
self.corner(90)
self.edges["e"](2*t)
self.corner(90)
self.moveTo(-1.5*t, 1.25*t)
self.ctx.stroke()
self.rectangularWall(t, 2*t)

self.move(tw, th, move)

def flexBookLatchGrip(self, move=None):
t = self.thickness
l = self.latchsize

if self.move(l, 4*t, move, True):
return

self.edge(l)
self.corner(90)
self.edge(4*t)
self.corner(90)
self.edge(l)
self.corner(90)
self.edge(4*t)
self.corner(90)

self.rectangularHole(l/2, 2*t, .8*l, 2.5*t, r=1.25*t)

self.move(l, 4*t, move)

def flexBookLatchPin(self, move=None):
t = self.thickness
l = self.latchsize
Expand Down Expand Up @@ -304,6 +278,7 @@ def render(self):
y = self.h
self.h = self.y
self.y = y
t = self.thickness

self.radius = self.h / 2
self.c4 = c4 = math.pi * self.radius * 0.5
Expand All @@ -329,6 +304,10 @@ def render(self):
self.flexBookLatchBracket(True, move="up")
self.flexBookLatchBracket(False, move="right only")

self.flexBookLatchGrip(move="right rotated")
l = self.latchsize
self.rectangularWall(
4*t, l,
callback=[lambda: self.rectangularHole(2*t, l/2, 2.5*t, .8*l, r=2*t)],
move="right")
self.flexBookLatchPin(move="right")

0 comments on commit 130a531

Please sign in to comment.