sprocket - parametric sprockets

_images/sprocket.png

A sprocket can be generated and saved to a STEP file with just four lines of python code using the Sprocket class:

from build123d import *
from bd_warehouse.sprocket import Sprocket

sprocket32 = Sprocket(num_teeth=32)
export_step(sprocket32, "sprocket.step")

How does this code work?

  1. The first line imports the build123d CAD system

  2. The second line imports the Sprocket class from the sprocket sub-package of the cq_warehouse package

  3. The third line instantiates a 32 tooth sprocket named “sprocket32”

  4. The fourth line uses the build123d exporter functionality to save the generated sprocket object in STEP format

class Sprocket(num_teeth: int, chain_pitch: float = 12.7, roller_diameter: float = 7.9375, clearance: float = 0.0, thickness: float = 2.1336, bolt_circle_diameter: float = 0.0, num_mount_bolts: int = 0, mount_bolt_diameter: float = 0.0, bore_diameter: float = 0.0, rotation: ~build123d.geometry.Rotation | tuple[float, float, float] = (0, 0, 0), align: None | ~build123d.build_enums.Align | tuple[~build123d.build_enums.Align, ~build123d.build_enums.Align, ~build123d.build_enums.Align] = <Align.CENTER>, mode: ~build123d.build_enums.Mode = <Mode.ADD>)[source]

Create a new sprocket object as defined by the given parameters. The input parameter defaults are appropriate for a standard bicycle chain.

Parameters:
  • num_teeth (int) – number of teeth on the perimeter of the sprocket

  • chain_pitch (float) – distance between the centers of two adjacent rollers. Defaults to 1/2 inch.

  • roller_diameter (float) – size of the cylindrical rollers within the chain. Defaults to 5/16 inch.

  • clearance (float) – size of the gap between the chain’s rollers and the sprocket’s teeth. Defaults to 0.

  • thickness (float) – thickness of the sprocket. Defaults to 0.084 inch.

  • bolt_circle_diameter (float) – diameter of the mounting bolt hole pattern. Defaults to 0.

  • num_mount_bolts (int) – number of bolt holes (default 0) - if 0, no bolt holes are added to the sprocket

  • mount_bolt_diameter (float) – size of the bolt holes use to mount the sprocket. Defaults to 0.

  • bore_diameter (float) – size of the central hole in the sprocket (default 0) - if 0, no bore hole is added to the sprocket

  • rotation (RotationLike, optional) – angles to rotate about axes. Defaults to (0, 0, 0)

  • align (Align | tuple[Align, Align, Align] | None, optional) – align MIN, CENTER, or MAX of object. Defaults to Align.CENTER

  • mode (Mode, optional) – combine mode. Defaults to Mode.ADD

NOTE: Default parameters are for standard single sprocket bicycle chains.

Variables:
  • pitch_radius (float) – radius of the circle formed by the center of the chain rollers

  • outer_radius (float) – size of the sprocket from center to tip of the teeth

  • pitch_circumference (float) – circumference of the sprocket at the pitch radius

  • plan (Face) – 2D plan of the base sprocket without any cutouts

Example

>>> s = Sprocket(num_teeth=32)
>>> print(s.pitch_radius)
64.78458745735234
>>> s.rotate((0,0,0),(0,0,1),10)
property plan: Face

2D plan of the base sprocket without any cutouts

static sprocket_circumference(num_teeth: int, chain_pitch: float) float[source]
Calculate and return the pitch circumference of a sprocket with the given number of

teeth and chain pitch

Parameters:
  • num_teeth (int) – the number of teeth on the perimeter of the sprocket

  • chain_pitch (float) – the distance between two adjacent pins in a single link (default 1/2 inch)

static sprocket_pitch_radius(num_teeth: int, chain_pitch: float) float[source]
Calculate and return the pitch radius of a sprocket with the given number of teeth

and chain pitch

Parameters:
  • num_teeth (int) – the number of teeth on the perimeter of the sprocket

  • chain_pitch (float) – the distance between two adjacent pins in a single link (default 1/2 inch)

Most of the Sprocket parameters are shown in the following diagram:

sprocket parameters

The sprocket in the diagram was generated as follows:

MM = 1
chain_ring = Sprocket(
    num_teeth = 32,
    clearance = 0.1 * MM,
    bolt_circle_diameter = 104 * MM,
    num_mount_bolts = 4,
    mount_bolt_diameter = 10 * MM,
    bore_diameter = 80 * MM
)

Note

Units in build123d are defined so that 1 represents one millimeter but MM = 1 makes this explicit.

Tooth Tip Shape

Normally the tip of a sprocket tooth has a circular section spanning the roller pin sockets on either side of the tooth tip. In this case, the tip is chamfered to allow the chain to easily slide over the tooth tip thus reducing the chances of derailing the chain in normal operation. However, it is valid to generate a sprocket without this “flat” section by increasing the size of the rollers. In this case, the tooth tips will be “spiky” and will not be chamfered.