Add callback and move param to regular gears

This commit is contained in:
Florian Festi 2016-07-13 14:20:34 +02:00
parent a2a2695c03
commit 3abf95d665
1 changed files with 11 additions and 1 deletions

View File

@ -537,7 +537,6 @@ class Gears():
base_height, tab_width, clearance, pitchcircle) base_height, tab_width, clearance, pitchcircle)
width = tooth_count * pitch + 2*tab_width + 2 * s width = tooth_count * pitch + 2*tab_width + 2 * s
height = base_height+ 2* addendum + 2 * s height = base_height+ 2* addendum + 2 * s
self.boxes.rectangularHole(width/2, height/2, width, height)
if self.boxes.move(width, height, move, before=True): if self.boxes.move(width, height, move, before=True):
return return
self.boxes.cc(callback, None, s+b, s+b) self.boxes.cc(callback, None, s+b, s+b)
@ -549,6 +548,12 @@ class Gears():
self.boxes.move(width, height, move) self.boxes.move(width, height, move)
return return
# Move only
width = height = 2 * (outer_radius +s)
if self.boxes.move(width, height, move, before=True):
return
self.boxes.ctx.save()
# Detect Undercut of teeth # Detect Undercut of teeth
## undercut = int(ceil(undercut_min_teeth( angle ))) ## undercut = int(ceil(undercut_min_teeth( angle )))
## needs_undercut = teeth < undercut #? no longer needed ? ## needs_undercut = teeth < undercut #? no longer needed ?
@ -568,6 +573,8 @@ class Gears():
# All base calcs done. Start building gear # All base calcs done. Start building gear
points = generate_spur_points(teeth, base_radius, pitch_radius, outer_radius, root_radius, accuracy_involute, accuracy_circular) points = generate_spur_points(teeth, base_radius, pitch_radius, outer_radius, root_radius, accuracy_involute, accuracy_circular)
self.boxes.moveTo(width/2, height/2)
self.boxes.cc(callback, None, 0, 0)
self.drawPoints(points) self.drawPoints(points)
# Spokes # Spokes
if not self.options.internal_ring: # only draw internals if spur gear if not self.options.internal_ring: # only draw internals if spur gear
@ -628,6 +635,9 @@ class Gears():
self.boxes.text(note, -outer_radius, y) self.boxes.text(note, -outer_radius, y)
y += text_height * 1.2 y += text_height * 1.2
self.boxes.ctx.restore()
self.boxes.move(width, height, move)
if __name__ == '__main__': if __name__ == '__main__':
e = Gears() e = Gears()
e.affect() e.affect()