gears: Add teeth_only param to allow using gears as lines and not only as parts
This commit is contained in:
parent
427a6fc54b
commit
93480e082d
|
@ -560,7 +560,7 @@ class Gears():
|
||||||
self.boxes.ctx.restore()
|
self.boxes.ctx.restore()
|
||||||
self.boxes.move(width, width, move)
|
self.boxes.move(width, width, move)
|
||||||
|
|
||||||
def __call__(self, move="", callback=None, **kw):
|
def __call__(self, teeth_only=False, move="", callback=None, **kw):
|
||||||
""" Calculate Gear factors from inputs.
|
""" Calculate Gear factors from inputs.
|
||||||
- Make list of radii, angles, and centers for each tooth and
|
- Make list of radii, angles, and centers for each tooth and
|
||||||
iterate through them
|
iterate through them
|
||||||
|
@ -637,7 +637,7 @@ class Gears():
|
||||||
if self.options.internal_ring:
|
if self.options.internal_ring:
|
||||||
width = height = width + 2 * self.options.spoke_width
|
width = height = width + 2 * self.options.spoke_width
|
||||||
|
|
||||||
if self.boxes.move(width, height, move, before=True):
|
if not teeth_only and self.boxes.move(width, height, move, before=True):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Detect Undercut of teeth
|
# Detect Undercut of teeth
|
||||||
|
@ -655,11 +655,12 @@ 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)
|
||||||
|
|
||||||
|
if not teeth_only:
|
||||||
self.boxes.moveTo(width/2, height/2)
|
self.boxes.moveTo(width/2, height/2)
|
||||||
self.boxes.cc(callback, None, 0, 0)
|
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 teeth_only and not self.options.internal_ring: # only draw internals if spur gear
|
||||||
msg = self.generate_spokes(root_radius, spoke_width, spoke_count, mount_radius, mount_hole,
|
msg = self.generate_spokes(root_radius, spoke_width, spoke_count, mount_radius, mount_hole,
|
||||||
unit_factor, self.options.units)
|
unit_factor, self.options.units)
|
||||||
warnings.extend(msg)
|
warnings.extend(msg)
|
||||||
|
@ -668,7 +669,7 @@ class Gears():
|
||||||
# A : rx,ry x-axis-rotation, large-arch-flag, sweepflag x,y
|
# A : rx,ry x-axis-rotation, large-arch-flag, sweepflag x,y
|
||||||
r = mount_hole / 2
|
r = mount_hole / 2
|
||||||
self.boxes.hole(0, 0, r)
|
self.boxes.hole(0, 0, r)
|
||||||
else:
|
elif not teeth_only:
|
||||||
# its a ring gear
|
# its a ring gear
|
||||||
# which only has an outer ring where width = spoke width
|
# which only has an outer ring where width = spoke width
|
||||||
r = outer_radius + spoke_width + self.boxes.burn
|
r = outer_radius + spoke_width + self.boxes.burn
|
||||||
|
@ -720,6 +721,7 @@ 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
|
||||||
|
|
||||||
|
if not teeth_only:
|
||||||
self.boxes.move(width, height, move)
|
self.boxes.move(width, height, move)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue