Pulley: Add insideout param

This allows using timing belts as strainwaves in harmonic drives.
This commit is contained in:
Florian Festi 2017-03-22 22:00:22 +01:00
parent c2ab70eefe
commit c2fa8c85cf
2 changed files with 17 additions and 6 deletions

View File

@ -38,6 +38,9 @@ class Pulley(Boxes):
self.argparser.add_argument( self.argparser.add_argument(
"--axle", action="store", type=float, default=5, "--axle", action="store", type=float, default=5,
help="diameter of the axle") help="diameter of the axle")
self.argparser.add_argument(
"--insideout", action="store", type=BoolArg(), default=False,
help="create a ring gear with the belt being pushed against from within")
self.argparser.add_argument( self.argparser.add_argument(
"--top", action="store", type=float, default=0, "--top", action="store", type=float, default=0,
help="overlap of top rim (zero for none)") help="overlap of top rim (zero for none)")
@ -77,7 +80,7 @@ class Pulley(Boxes):
self.axle, move="right") self.axle, move="right")
for i in range(int(math.ceil(self.h / self.thickness))): for i in range(int(math.ceil(self.h / self.thickness))):
self.pulley(self.teeth, self.profile, r_axle=self.axle / 2.0, move="right") self.pulley(self.teeth, self.profile, insideout=self.insideout, r_axle=self.axle / 2.0, move="right")
self.close() self.close()

View File

@ -83,7 +83,7 @@ class Pulley:
@classmethod @classmethod
def getProfiles(cls): def getProfiles(cls):
return list(cls.teeth.keys()) return list(sorted(cls.teeth.keys()))
def drawPoints(self, lines, kerfdir=1): def drawPoints(self, lines, kerfdir=1):
if kerfdir != 0: if kerfdir != 0:
@ -103,7 +103,8 @@ class Pulley:
return tooth_spacing(teeth, *self.spacing[profile][1:]) return tooth_spacing(teeth, *self.spacing[profile][1:])
def __call__(self, teeth, profile, move="", r_axle=None, callback=None): def __call__(self, teeth, profile, insideout=False, r_axle=None,
callback=None, move=""):
# ******************************** # ********************************
# ** Scaling tooth for good fit ** # ** Scaling tooth for good fit **
@ -122,7 +123,11 @@ class Pulley:
tooth_width_scale = (tooth_width + additional_tooth_width) / tooth_width tooth_width_scale = (tooth_width + additional_tooth_width) / tooth_width
tooth_depth_scale = ((tooth_depth + additional_tooth_depth) / tooth_depth) tooth_depth_scale = ((tooth_depth + additional_tooth_depth) / tooth_depth)
total_width = pulley_OD if insideout:
pulley_OD += 2*tooth_depth * tooth_depth_scale
tooth_depth_scale *= -1
total_width = max(pulley_OD, 2*r_axle)
if self.boxes.move(total_width, total_width, move, before=True): if self.boxes.move(total_width, total_width, move, before=True):
return return
@ -131,6 +136,9 @@ class Pulley:
self.boxes.cc(callback, None, 0.0, 0.0) self.boxes.cc(callback, None, 0.0, 0.0)
if r_axle: if r_axle:
if insideout:
self.boxes.circle(0, 0, r_axle)
else:
self.boxes.hole(0, 0, r_axle) self.boxes.hole(0, 0, r_axle)
points = [] points = []
@ -140,5 +148,5 @@ class Pulley:
m = mmul(m, rotm(i * 2 * pi / teeth)) m = mmul(m, rotm(i * 2 * pi / teeth))
points.extend((vtransl(pt, m) for pt in self.teeth[profile][1:-1])) points.extend((vtransl(pt, m) for pt in self.teeth[profile][1:-1]))
self.drawPoints(points) self.drawPoints(points, kerfdir=-1 if insideout else 1)
self.boxes.move(total_width, total_width, move) self.boxes.move(total_width, total_width, move)