Drop STEP files in a folder, get professional 2D drawing PDFs out — projection views placed, scale chosen, dimensions applied, title block filled. No manual drafting.
Converting 3D CAD models into dimensioned 2D manufacturing drawings is slow, manual CAD work — every part needs views placed, a scale picked, dimensions attached, and a title block filled in. For catalogs of piping components, that's hours of repetitive drafting per batch.
A batch pipeline built on FreeCAD's Python API + TechDraw that fully automates it:
input_steps/*.step ──► geometry analysis ──► drawing generation ──► output_drawings/*.pdf
· bounding box · A4 landscape template + structured JSON
· cylinder detection · first-angle 3-view cluster log per run
· part-family · auto scale (ISO 5455)
classification · rule-based dimensions
· Ø diameters on cylinders
- Geometry analysis (
src/geometry.py) — pure Part-API: bounding box, deduplicated cylindrical-feature detection (radius + axis), and a part-family classifier (straight pipe / elbow / tee / flange) - Drawing generation (
src/drawing.py) — TechDraw page creation, first-angle front/top/right view cluster auto-placed in the usable paper region, standard scale selection from the ISO 5455 series (1:N and N:1), rule-based length + diameter dimensioning per part family, PDF export - Batch driver (
src/main.py) — scans the input folder, processes every STEP file, writes one PDF per part plus a structured JSON run log (status, family, scale, dimensions applied, errors)
| 3D input (STEP) | Generated drawing (PDF) |
|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Sample DN50 piping parts (straight, elbow, flange, tee) are included in input_steps/, with their generated drawings in output_drawings/.
Needs FreeCAD 1.0+ (free, open source). PDF export requires the GUI-capable executable (TechDraw's exportPageAsPdf needs the Qt graphics scene):
"C:\Program Files\FreeCAD 1.0\bin\freecad.exe" src\main.pyEvery .step / .stp in input_steps/ becomes output_drawings/<name>_drawing.pdf, with a JSON log in logs/.
# regenerate the sample parts (parametric, no external CAD needed)
freecad.exe src/make_samples.pyPython · FreeCAD Part API · TechDraw · STEP/ISO 10303 · ISO 5455 scales · first-angle projection · rule-based dimensioning
The rule-based dimensioner is intentionally simple (family classifier → dimension recipe). Natural next steps: more part families, GD&T symbols, DXF export alongside PDF, section views for internal features, and a headless render path.
Author: Muhammad Maowiz Saleem · LinkedIn — I build CAD/document automation pipelines (see also: P&ID tag extraction, HVAC blueprint takeoff)







