sprocket - parametric sprockets

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

import cadquery as cq
from cq_warehouse.sprocket import Sprocket

sprocket32 = Sprocket(num_teeth=32)
cq.exporters.export(sprocket32,"sprocket.step")

How does this code work?

  1. The first line imports cadquery CAD system with the alias cq

  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 cadquery exporter functionality to save the generated sprocket object in STEP format

Deprecated since version 0.8.0: Previous versions of cq_warehouse required the used of a cq_object instance variable to access the CadQuery cad object. Currently sprocket objects are a sub-class of the CadQuery Solid object and therefore can be used as any other Solid object without referencing cq_object. Future versions of cq_warehouse will remove cq_object entirely.

class Sprocket(num_teeth, chain_pitch=12.7, roller_diameter=7.9375, clearance=0.0, thickness=2.1336, bolt_circle_diameter=0.0, num_mount_bolts=0, mount_bolt_diameter=0.0, bore_diameter=0.0)

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

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

Example

>>> s = Sprocket(num_teeth=32)
>>> print(s.pitch_radius)
64.78458745735234
>>> s.rotate((0,0,0),(0,0,1),10)
static sprocket_circumference(num_teeth, chain_pitch)
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)

Return type

float

static sprocket_pitch_radius(num_teeth, chain_pitch)
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)

Return type

float

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 CadQuery 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.