Add flatHole() for shafts that are flattened on both sides.

This commit is contained in:
Florian Festi 2018-05-05 19:08:37 +02:00
parent 50b9bc9ffb
commit 2828a85725
1 changed files with 24 additions and 0 deletions

View File

@ -1051,6 +1051,30 @@ class Boxes:
self.corner(-a) self.corner(-a)
self.edge(2*r*math.sin(math.radians(a))) self.edge(2*r*math.sin(math.radians(a)))
@restore
@holeCol
def flatHole(self, x, y, r=None, d=None, w=None, rel_w=0.75, angle=0):
if r is None:
r = d / 2.0
if w is None:
w = r * rel_w
else:
w = w / 2.0
if r < 0.0:
return
if abs(w) > r:
return self.hole(x, y, r)
a = math.degrees(math.acos(w / r))
self.moveTo(x, y, angle-a)
self.moveTo(r-self.burn, 0, -90)
for i in range(2):
self.corner(-180+2*a, r)
self.corner(-a)
self.edge(2*r*math.sin(math.radians(a)))
self.corner(-a)
@restore @restore
def text(self, text, x=0, y=0, angle=0, align=""): def text(self, text, x=0, y=0, angle=0, align=""):
""" """