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

compatibility notice

py_gearworks was designed for algebra-style usage of build123d. If users need it in builder context, please use the add() or insert() function as so:

with BuildPart() as build_context:
    add(gear.build_part())
    ...

Improved support of builder contexts is planned for future releases.

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.

Release files for py-gearworks 0.0.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-gearworks 0.0.24
File Size Uploaded
py_gearworks-0.0.24.tar.gz 1.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-gearworks 0.0.24
File Interpreter ABI Platform
py_gearworks-0.0.24-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / py_gearworks-0.0.24.tar.gz

Download URL py_gearworks-0.0.24.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
a8d3e44d9e91b45438c3c0b5ca5b886226fef31939fa8073eb11830e8a384768
BLAKE2b-256 checksum
How to use checksums
a6807bd2b82b8244a7d4223dbc3c0ed560b4fcccc47e5038ef73d8b2153077db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release files / py_gearworks-0.0.24-py3-none-any.whl

Download URL py_gearworks-0.0.24-py3-none-any.whl
Size 86.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c16ae7eb03ad8701373b655e34163648cc288b1740456304db2623a70c36d9b3
BLAKE2b-256 checksum
How to use checksums
67158247c62b33d15c10790727367d1296ddf881fde670197d156d39b9004bc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.24 This release

2 release 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