Skip to main content

This is an extension of Manim that helps drawing nice looking gears.

Project description

manim-Gearbox

This is a plugin for Manim that enables you to draw realistic looking gears and mechanisms. Mostly based on these tec-science pages: https://www.tec-science.com/mechanical-power-transmission/involute-gear/geometry-of-involute-gears/

Currently supported Involute gear features:

  • Basic spur gears
  • Inside ring-gears
  • Basic rack
  • Undercutting (gears with fewer than 17 teeth)
  • Profile shifted gears
  • Meshing calculation with distance variation

Planned further development:

  • Cycloid gears, cycloid rack

Installation

manim-gearbox is a package on pypi, and can be directly installed using pip:

pip install manim-gearbox

Note: manim-gearbox uses, and depends on SciPy and Manim.

Usage

Make sure include these two imports at the top of the .py file

from manim import *
from manim_gearbox import *

Add Gear objects, use mesh_to() method to position 2 gears into meshing. I tend to use 'fill_opacity=1' and 'stroke_opacity=0' options because the stroke increases the gear size by a couple pixels, and gives the feeling of interference.

Examples

2 basic gears

class gear_example(Scene):
	def construct(self):
		# small gear
		gear1=Gear(15, stroke_opacity=0, fill_color=WHITE,fill_opacity=1)
		# larger gear
		gear2=Gear(25,  stroke_opacity=0, fill_color=RED, fill_opacity=1)
		# shifting gear1 away from center
		gear1.shift(-gear1.rp * 1.5 * RIGHT)
		# position gear2 next to gear1 so that they mesh together
		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)
		

involute_gear_example

inner gear

class gear_example_inner(Scene):
    def construct(self):
        # smaller gear
        gear1 = Gear(12, module=1, profile_shift=0.3, stroke_opacity=0, fill_color=WHITE,fill_opacity=1)
        # larger gear with inner teeth
        gear2 = Gear(36, module=1, inner_teeth=True, profile_shift=0.1, stroke_opacity=0, fill_color=RED, fill_opacity=1)
        gear1.shift(gear1.rp * UP)
        gear2.shift(gear2.rp * UP)
        # mesh with 0.15*module larger distance than default
        # bias param is used to define left or right tooth flank shall engage if there is offset and play
        gear2.mesh_to(gear1,offset=0.15,bias=False)

        self.add(gear1)
        self.add(gear2)
        self.play(Rotate(gear1, gear1.pitch_angle, rate_func=linear),
                  Rotate(gear2, gear2.pitch_angle, rate_func=linear),
                  run_time=10)

inner_gear_example

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manim-GearBox-0.2.4.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

manim_GearBox-0.2.4-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file manim-GearBox-0.2.4.tar.gz.

File metadata

  • Download URL: manim-GearBox-0.2.4.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.9 Windows/10

File hashes

Hashes for manim-GearBox-0.2.4.tar.gz
Algorithm Hash digest
SHA256 865232bd3d0ccde664d66f295b20b3001efda6a11631a6172f6d955c655a13d8
MD5 bd4a4582d0f5ae136276e68524c2d09b
BLAKE2b-256 7881f50fbc773896d3371fbcc5e4355576db8d241eacb40a9780f46657a8091b

See more details on using hashes here.

File details

Details for the file manim_GearBox-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: manim_GearBox-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.9 Windows/10

File hashes

Hashes for manim_GearBox-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b197f04a993d88f2ed54a651d99229ff37982a0f30cec012011bf7bf48994513
MD5 63bd81c02fb6b81b52f6419e576eb690
BLAKE2b-256 2d66ecd982e037206b87fa6de9a82ff724f1625d4ecd8ead947475cca3618867

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page