Fix surroundingWall to work with Edegs with non zero .(start|end)width()
Add Boxes.edgeCorner() to join to Edges with the proper width correction and use it in rectangluarWall() and surroundingWall()
This commit is contained in:
parent
3086485a25
commit
e3673df408
|
@ -495,6 +495,11 @@ class Boxes:
|
||||||
self.corner(90)
|
self.corner(90)
|
||||||
self.edge((length-d)/2.0)
|
self.edge((length-d)/2.0)
|
||||||
|
|
||||||
|
def edgeCorner(self, edge1, edge2, angle=90):
|
||||||
|
"""Make a corner between two Edges. Take widht of edges into account"""
|
||||||
|
self.edge(edge2.startwidth()/math.sin(math.radians(180-angle)))
|
||||||
|
self.corner(angle)
|
||||||
|
self.edge(edge1.endwidth()/math.sin(math.radians(180-angle)))
|
||||||
|
|
||||||
def grip(self, length, depth):
|
def grip(self, length, depth):
|
||||||
"""Corrugated edge useful as an gipping area
|
"""Corrugated edge useful as an gipping area
|
||||||
|
@ -996,7 +1001,7 @@ class Boxes:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.ctx.save()
|
self.ctx.save()
|
||||||
self.moveTo(left.margin(), bottom.margin())
|
self.moveTo(left.spacing(), bottom.margin())
|
||||||
|
|
||||||
self.cc(callback, 0, y=bottomwidth+self.burn)
|
self.cc(callback, 0, y=bottomwidth+self.burn)
|
||||||
bottom(x/2.0-r)
|
bottom(x/2.0-r)
|
||||||
|
@ -1014,11 +1019,9 @@ class Boxes:
|
||||||
bottom(l-2*r)
|
bottom(l-2*r)
|
||||||
bottom(x/2.0-r)
|
bottom(x/2.0-r)
|
||||||
|
|
||||||
self.corner(90)
|
self.edgeCorner(bottom, right, 90)
|
||||||
self.edge(bottomwidth)
|
|
||||||
right(h)
|
right(h)
|
||||||
self.edge(topwidth)
|
self.edgeCorner(right, top, 90)
|
||||||
self.corner(90)
|
|
||||||
|
|
||||||
top(x/2.0-r)
|
top(x/2.0-r)
|
||||||
for i, l in zip(range(4), (y, x, y, 0)):
|
for i, l in zip(range(4), (y, x, y, 0)):
|
||||||
|
@ -1027,18 +1030,15 @@ class Boxes:
|
||||||
top(l - 2*r)
|
top(l - 2*r)
|
||||||
top(x/2.0-r)
|
top(x/2.0-r)
|
||||||
|
|
||||||
self.corner(90)
|
self.edgeCorner(top, left, 90)
|
||||||
self.edge(topwidth)
|
|
||||||
left(h)
|
left(h)
|
||||||
self.edge(bottomwidth)
|
self.edgeCorner(left, bottom, 90)
|
||||||
self.corner(90)
|
|
||||||
|
|
||||||
self.ctx.restore()
|
self.ctx.restore()
|
||||||
self.ctx.stroke()
|
self.ctx.stroke()
|
||||||
|
|
||||||
self.move(overallwidth, overallheight, move)
|
self.move(overallwidth, overallheight, move)
|
||||||
|
|
||||||
|
|
||||||
def rectangularWall(self, x, y, edges="eeee",
|
def rectangularWall(self, x, y, edges="eeee",
|
||||||
holesMargin=None, holesSettings=None,
|
holesMargin=None, holesSettings=None,
|
||||||
bedBolts=None, bedBoltSettings=None,
|
bedBolts=None, bedBoltSettings=None,
|
||||||
|
@ -1069,15 +1069,13 @@ class Boxes:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.ctx.save()
|
self.ctx.save()
|
||||||
self.moveTo(edges[-1].margin(), edges[0].margin())
|
self.moveTo(edges[-1].spacing(), edges[0].margin())
|
||||||
for i, l in enumerate((x, y, x, y)):
|
for i, l in enumerate((x, y, x, y)):
|
||||||
self.edge(edges[i-1].endwidth())
|
|
||||||
self.cc(callback, i, y=edges[i].startwidth()+self.burn)
|
self.cc(callback, i, y=edges[i].startwidth()+self.burn)
|
||||||
edges[i](l,
|
edges[i](l,
|
||||||
bedBolts=self.getEntry(bedBolts, i),
|
bedBolts=self.getEntry(bedBolts, i),
|
||||||
bedBoltSettings=self.getEntry(bedBoltSettings, i))
|
bedBoltSettings=self.getEntry(bedBoltSettings, i))
|
||||||
self.edge(edges[i+1].startwidth())
|
self.edgeCorner(edges[i], edges[i+1], 90)
|
||||||
self.corner(90-edges[i].endAngle()-edges[i+1].startAngle())
|
|
||||||
|
|
||||||
if holesMargin is not None:
|
if holesMargin is not None:
|
||||||
self.moveTo(holesMargin+edges[-1].endwidth(),
|
self.moveTo(holesMargin+edges[-1].endwidth(),
|
||||||
|
|
|
@ -15,7 +15,6 @@ Infrastructure
|
||||||
|
|
||||||
* Use stretch setting in flexboxes
|
* Use stretch setting in flexboxes
|
||||||
* Add CLI params for flex settings
|
* Add CLI params for flex settings
|
||||||
* Make CompoundEdge support differences in Edge.width()
|
|
||||||
|
|
||||||
Generators
|
Generators
|
||||||
..........
|
..........
|
||||||
|
|
Loading…
Reference in New Issue