Skip to main content

Python - Gearworks

A gear generator in python.

Py-gearworks is built on build123d CAD package. It focuses on accurate geometric representation of gears, gear-pairs. Design calculations related to strength, pitting, efficiency may be implemented in the future - but currently not supported.

Installation

Py_gearworks can be installed via pip:

pip install py-gearworks
pip install git+https://github.com/GarryBGoode/py_gearworks

Alternatively, you can clone or download this repository and install via this command from the repository root directory:

pip install .

Dependencies

py_gearworks CAD model creation uses build123d package: build123d github

It is highly recommended, though not strictly necessary to use a python-CAD gui solution. See OCP VSCode and CadQuery Editor.

Documentation

Docs hosted on readthedocs

Features

Gear Types Profile Mods Position & Alignment
Spur Undercut Std. position
Helical Profile shift Backlash-controlled position*
Bevel Root/tip fillet Axis alignment (bevels and helicals)
Cycloid Crowning Rotation to align teeth to mesh
Inside-ring Axial offset (only spur and helical)

It is a development goal that all (sensible) combination of supported features should be combined. Profile shifted cycloids don't exist, but inside-ring-bevel cycloids can be made. Undercut and profile shift is available for bevels - but positioning of profile shifted bevels is lacking. Please use complementary profile shifts for bevels.

* Positioning and backlash design is a bit of work-in-progress. Spur gears and parallel-axis helical gears can be placed with accurate backlash (inc. 0 backlash). This matters for profile shifted gears. Cross-axis helicals and bevel gears can only be positioned via nominal formula (can't adjust backlash via axial distance).

Bevel Gear Example

Work in progress / partially supported:

  • Racks
  • Backlash control
  • Contact ratio calculation
  • Planetary drive design

Not yet supported:

  • Hypoid gears
  • Worm gears
  • Face / crown gears

Planned upcoming other features

  • Backlash, contact ratio and profile shift optimization

Example

The example is built on VSCode with OCP VScode plugin. See examples/examples.py for more.

from py_gearworks import *
from ocp_vscode import show
from build123d import *

# create 2 spur gears
gear1 = SpurGear(
    number_of_teeth=12,
    module=2,
    height=4,
    profile_shift=0.3,
)
gear2 = SpurGear(
    number_of_teeth=23,
    module=2,
    height=4,
)

# move and align gear 1 next to gear 2 in the Y direction
# backlash can be optionally specified
# angle_bias conrtols location within backlash range (-1 to 1)
# backlash is a coefficient of module
# there will be 0.2 mm distance between inactive tooth sides in this example
gear1.mesh_to(gear2, target_dir=UP, backlash=0.1, angle_bias=1)

# generate build123d Part objects
gear_part_1 = gear1.build_part()
gear_part_2 = gear2.build_part()

# center-bores are recommended to be added separately via build123d workflow
# center_location_top can be used as a build123d location object
# location * Hole means placement of Hole at that location (build123d syntax)
hole_obj_1 = gear1.center_location_top * Hole(radius=2, depth=4)
gear_part_1 = gear_part_1.cut(hole_obj_1)
hole_obj_2 = gear2.center_location_top * Hole(radius=2, depth=4)
gear_part_2 = gear_part_2.cut(hole_obj_2)

# export to STEP files (build123d export function)
# note: export retains positioning, gear1 will not be at origin
export_step(gear_part_1, "gear1.step")
export_step(gear_part_2, "gear2.step")

# export to DXF files (build123d export function)
gear_wire_1 = gear1.build_boundary_wire()
gear_wire_2 = gear2.build_boundary_wire()

exporter = ExportDXF(unit=Unit.MM, line_weight=0.5)
exporter.add_layer("Layer 1", line_type=LineType.CONTINUOUS)
exporter.add_shape(gear_wire_1, layer="Layer 1")
exporter.add_shape(gear_wire_2, layer="Layer 1")
exporter.write("gears.dxf")

# visualize parts
show(gear_part_1, gear_part_2)

Spur Gear Example

Name conflict and rebrand

This project was originally named gggears - a poor choice, since it was already taken by another, similar project. I've renamed the project, but some references, URLs might still point to gggears.

License

Project is licensed under Apache 2.0, see license file for details.

Download files

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

Source Distribution

py_gearworks-0.0.23.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_gearworks-0.0.23-py3-none-any.whl (81.9 kB view details)

Uploaded Python 3

File details

Details for the file py_gearworks-0.0.23.tar.gz.

File metadata

  • Download URL: py_gearworks-0.0.23.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for py_gearworks-0.0.23.tar.gz
Algorithm Hash digest
SHA256 0de1f0bdaa803d6606a376b1c11ece919f428df5b7198b1cf93964ee16bc7986
MD5 a39dcaeb0135e67d97e5a284fb841d69
BLAKE2b-256 fbe4d3122d30c9cf04330efee44d9740c3b7d38026521155fc577d4e85c2cf24

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_gearworks-0.0.23.tar.gz:

Publisher: publish.yml on GarryBGoode/py_gearworks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_gearworks-0.0.23-py3-none-any.whl.

File metadata

  • Download URL: py_gearworks-0.0.23-py3-none-any.whl
  • Upload date:
  • Size: 81.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for py_gearworks-0.0.23-py3-none-any.whl
Algorithm Hash digest
SHA256 471b293ff105f84c92bc4d313c91238ce7d641769c465e7c8149d6ba66642203
MD5 95433203b8188d3903cbf0d6b4e28929
BLAKE2b-256 48acbc9e03e0407a6f8e2d64c3b787364a3899b1b048736a00b8b9f5088c72d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_gearworks-0.0.23-py3-none-any.whl:

Publisher: publish.yml on GarryBGoode/py_gearworks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.23 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page