Skip to content

maowiz/step2pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

step2pdf — 3D CAD models → dimensioned engineering drawings, automatically

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.

Before / after: 3D elbow model to dimensioned 2D drawing

The problem

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.

What this does

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)

Results

3D input (STEP) Generated drawing (PDF)
Elbow 3D Elbow drawing
Flange 3D Flange drawing
Tee 3D Tee drawing

Sample DN50 piping parts (straight, elbow, flange, tee) are included in input_steps/, with their generated drawings in output_drawings/.

Batch run

Running it

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

Every .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.py

Tech

Python · FreeCAD Part API · TechDraw · STEP/ISO 10303 · ISO 5455 scales · first-angle projection · rule-based dimensioning

Extending

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)

About

CAD automation: 3D STEP models → dimensioned 2D engineering drawing PDFs via FreeCAD TechDraw — auto projection views, rule-based dims, ISO scales.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages