Classes¶
- class manim_extensions.gearbox.Gear(num_of_teeth, module=0.2, alpha=20, h_a=1, h_f=1.2, inner_teeth=False, profile_shift=0, cutout_teeth_num=0, nppc=5, **kwargs)[source]¶
Bases:
VMobjectA Manim mobject representing an involute gear.
The gear is constructed from involute curves and can mesh with other
Gearobjects (orRackobjects) usingmesh_to().Two gears mesh correctly when they share the same module and alpha (pressure angle). The pitch-circle radius of a gear is
module * num_of_teeth / 2.- Parameters:
num_of_teeth (int) – Number of gear teeth.
module (float, optional) – Standard size scaling parameter.
diameter = module * num_of_teeth. Defaults to0.2.alpha (float, optional) – Pressure angle in degrees. Affects tooth curvature. Suggested values are between
10and30. Defaults to20.h_a (float, optional) – Addendum coefficient (tooth height above the pitch circle). Defaults to
1.h_f (float, optional) – Dedendum coefficient (tooth height below the pitch circle). Defaults to
1.2.inner_teeth (bool, optional) – If
True, generate a ring gear with teeth pointing inward. Defaults toFalse.profile_shift (float, optional) – Profile-shift coefficient. Changes the tooth shape and diameter slightly and reduces undercut. Defaults to
0.cutout_teeth_num (int, optional) – Number of teeth to omit. Defaults to
0.nppc (int, optional) – Number of points per involute curve. One tooth is built from four to six curve pieces depending on undercut. Defaults to
5.**kwargs – Additional keyword arguments forwarded to
VMobject.
Examples
Example: GearDocExample ¶
from manim import * from manim_extensions.gearbox import Gear class GearDocExample(Scene): def construct(self): gear1 = Gear(15, stroke_opacity=0, fill_color=WHITE, fill_opacity=1) gear2 = Gear(25, stroke_opacity=0, fill_color=RED, fill_opacity=1) gear1.shift(-gear1.rp * 1.5 * RIGHT) gear2.mesh_to(gear1) self.add(gear1, gear2) self.play( Rotate(gear1, gear1.pitch_angle, rate_func=linear), Rotate(gear2, -gear2.pitch_angle, rate_func=linear), run_time=4, ) self.wait()
from manim import * from manim_extensions.gearbox import Gear class GearDocExample(Scene): def construct(self): gear1 = Gear(15, stroke_opacity=0, fill_color=WHITE, fill_opacity=1) gear2 = Gear(25, stroke_opacity=0, fill_color=RED, fill_opacity=1) gear1.shift(-gear1.rp * 1.5 * RIGHT) gear2.mesh_to(gear1) self.add(gear1, gear2) self.play( Rotate(gear1, gear1.pitch_angle, rate_func=linear), Rotate(gear2, -gear2.pitch_angle, rate_func=linear), run_time=4, ) self.wait()- __init__(num_of_teeth, module=0.2, alpha=20, h_a=1, h_f=1.2, inner_teeth=False, profile_shift=0, cutout_teeth_num=0, nppc=5, **kwargs)[source]¶
Create an involute gear. See the class docstring for parameter details.
- set_stroke(color=None, **kwargs)[source]¶
Override set_stroke to avoid revealing the line which is used for tracking center and angle. If family is specified, it will still do it.
- class manim_extensions.gearbox.Rack(num_of_teeth, module=0.2, alpha=20, h_a=1, h_f=1.17, **kwargs)[source]¶
Bases:
VMobjectA Manim mobject representing a rack for involute gears.
The rack must use the same module and pressure angle as the mating gear for proper meshing.
Example: RackExample ¶
from manim import * from manim_extensions.gearbox import Gear, Rack class RackExample(Scene): def construct(self): gear = Gear(15, stroke_opacity=0, fill_color=WHITE, fill_opacity=1) rack = Rack(12, module=gear.m, stroke_opacity=0, fill_color=RED, fill_opacity=1) gear.shift(RIGHT * gear.rp) rack.shift(UP * rack.pitch * 0.5) self.add(gear, rack)
from manim import * from manim_extensions.gearbox import Gear, Rack class RackExample(Scene): def construct(self): gear = Gear(15, stroke_opacity=0, fill_color=WHITE, fill_opacity=1) rack = Rack(12, module=gear.m, stroke_opacity=0, fill_color=RED, fill_opacity=1) gear.shift(RIGHT * gear.rp) rack.shift(UP * rack.pitch * 0.5) self.add(gear, rack)- __init__(num_of_teeth, module=0.2, alpha=20, h_a=1, h_f=1.17, **kwargs)[source]¶
Basic rack for involute gears (pinion-rack connection). Must have the same module and alpha as the gear for proper meshing.
- Parameters:
num_of_teeth (number of gear teeth.)
module (standard size scaling parameter. Diameter = module * num_of_teeth.)
alpha (pressure angle in degrees, affects tooth curvature. Suggested values between 10-30)
h_a (addendum / module coefficient (tooth height above pitch circle))
h_f (dedendum / module coefficient (tooth height below pitch circle))