Metadata-Version: 2.4
Name: beltpy
Version: 0.2.1
Summary: Geometric solver and visualizer for GT-belt systems
Author-email: Vincent Wallsten <vincent.wallsten03@gmail.com>
License: MIT License
        
        Copyright (c) 2026 vincewall
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: HomePage, https://github.com/vincewall/beltpy
Project-URL: Bug Tracker, https://github.com/vincewall/beltpy/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: matplotlib>=3.4.0
Requires-Dist: numpy>=1.21.0
Requires-Dist: pybeltsolver>=0.1.1
Dynamic: license-file

![Cover banner](https://raw.githubusercontent.com/vincewall/beltpy/main/.github/assets/cover.png)


# Beltpy: Geometric Solver and Visualizer for timing belts!

This module provides you with a way to generate realistic profiled belt paths. Currently, GT and HTD profiled belts can be generated, but more profiles might get added in the future. This module can be seen as a 2D expansion to my other project `pybeltsolver`, which can generate generic 1D belt paths without a profile.

## Installation
Install using pip:
```commandline
pip install beltpy
```

## Examples

The procedure to define a valid path configuration is identical for this module as in `pybeltsolver`.

### Example 1
This example demonstrates a belt system with 3 pulleys, one of which is a tensioner, using the GT2 belt profile
```python
import matplotlib.pyplot as plt
import numpy as np
from pybeltsolver import Belt, BeltFace

from beltpy import BeltSystem, SmoothPulley, ToothedPulley
from beltpy.profiles import GT2

# This example demonstrates a belt system with 3 pulleys, one of which is movable.

profile = GT2

p1 = ToothedPulley(
    teeth=53,
    coords=(0, 0),
    profile=profile,
    name="Pulley 1",
)

p2 = SmoothPulley(
    diameter=23 * 2 / np.pi,
    coords=(50, 8),
    profile=profile,
    name="Idler",
)

p3 = ToothedPulley(
    teeth=20,
    coords=(78.87, 0),
    profile=profile,
    name="Pulley 2",
)

routing = [BeltFace.FRONT, BeltFace.BACK, BeltFace.FRONT]
midline = Belt(circles=[p1, p2, p3], topology=routing, allow_crossing=True)

belt_length = midline.total_length

target_length = belt_length // profile.pitch * profile.pitch
midline.find_movable_circle_position(target_length, 1, np.array([0, 1]))

system = BeltSystem(
    belt=midline,
    profile=profile,
)

fig, ax = system.plot(detailed=False, show=False)

ax.grid()
plt.show()
```

![Example of a generated 3 pulley GT2 belt system](https://raw.githubusercontent.com/vincewall/beltpy/main/.github/assets/example_1.png)

### Example 2
This example demonstrates a belt system with 4 pulleys, one of which is a tensioner, using the GT3 profile.

```python
import matplotlib.pyplot as plt
import numpy as np
from pybeltsolver import Belt, BeltFace

from beltpy import BeltSystem, SmoothPulley, ToothedPulley
from beltpy.profiles import GT3

# This example demonstrates a belt system with 4 pulleys, one of which is movable.

profile = GT3

p1 = ToothedPulley(
    teeth=25,
    coords=(0, 0),
    profile=profile,
    name="Pulley 1",
)

p2 = SmoothPulley(
    diameter=23 * 2 / np.pi,
    coords=(50, 8),
    profile=profile,
    name="Idler",
)

p3 = ToothedPulley(
    teeth=20,
    coords=(78.87, 0),
    profile=profile,
    name="Pulley 2",
)
p4 = ToothedPulley(
    teeth=35,
    coords=(30, -29),
    profile=profile,
    name="Pulley 3",
)

routing = [
    BeltFace.FRONT,
    BeltFace.BACK,
    BeltFace.FRONT,
    BeltFace.FRONT,
]
midline = Belt(
    circles=[p1, p2, p3, p4],
    topology=routing,
    allow_crossing=True,
)

belt_length = midline.total_length
target_length = belt_length // profile.pitch * profile.pitch
midline.find_movable_circle_position(
    target_length,
    1,
    np.array([0, 1]),
)

system = BeltSystem(
    belt=midline,
    profile=profile,
)

fig, ax = system.plot(detailed=False, show=False)

ax.grid()
plt.show()
```

![Example of a generated 4 pulley GT3 belt system](https://raw.githubusercontent.com/vincewall/beltpy/main/.github/assets/example_2.png)

### How to add your own tooth-profile
The code ships with two example tooth profiles: GT2 and GT3 with a 2 and 3 mm pitch. However, you may add any profile you want, even custom ones, as long as they can be broken down as the figure below suggests:

![Tooth profile descriptive diagram](https://raw.githubusercontent.com/vincewall/beltpy/main/.github/assets/tooth_description.png)

To add a profile, simply follow the GT2 and GT3 examples found in `src/beltpy/profiles.py`.

