Involute Spur Gear DXF Generator (Python CAD Automation)
A Python script (ezdxf) that draws a true involute spur gear from three numbers: module, number of teeth and pressure angle, and writes a layered DXF ready for laser, waterjet or CNC cutting.
Both drawings shown are real output from the same script with different inputs (m=2 / 24 teeth with a keyed 14 mm bore, and m=1.5 / 40 teeth with a plain 20 mm bore).
Features:
True involute flanks calculated from the base circle (tooth thickness at the pitch circle checked against the theoretical value)
Standard addendum (1.0 m) and dedendum (1.25 m)
Plain or keyed bore, with a check that the bore fits inside the root circle
Separate layers for outline, bore, centre lines/pitch circle and spec text
Spec line with PCD, outside diameter and bore written into the drawing
DXF opens in AutoCAD, LibreCAD, FreeCAD and CAM software
Tools: Python 3, ezdxf, matplotlib (preview rendering).
Published