tolstack Read the README
Python · Streamlit · OpenCascade

Tolerance stack-ups from 3D and 2D, straight to Excel

Pick a gap or step between two faces of a STEP assembly; tolstack finds the chain of parts, reads tolerances from your 2D drawings and writes worst case, RSS, Cp/Cpk and Monte Carlo results.

Python · Streamlit · OpenCascade
tolstack · previewscreenshot
tolstack screenshot
3platforms: Python, Streamlit, OpenCascade
MITopen source licence
Why it exists

Every gap is a chain of parts.

The result is an Excel file with live formulas, a colour section picture, the 2D evidence and a reviewer sign-off block.

How it works

Five steps in the web app

  1. 1

    Load

    Load the demo assembly, upload a STEP and the 2D PDFs, or point to a folder.

  2. 2

    Pick the faces

    Choose Step or Gap, then the From and To part and face; set LSL/USL if you have a spec.

  3. 3

    Pick the chain

    Pick the chain from the ranked list and build it from the 3D; a section picture appears.

  4. 4

    Check the table

    Check each row and the 2D dimension it uses; assign another drawing or candidate if needed.

What's inside

What it reads, finds and writes

Reads the STEP assembly

Every part, its name and its planar faces along the stack-up axis (X, Y or Z).

Real face contacts

Two faces touch only if their real outlines overlap, holes and L-shapes included, within a contact tolerance (default 0.02 mm).

Ranked chains

Every possible chain from the From face to the To face, fewest contacts first. A chain that does not close against the 3D is refused.

Tolerances from your 2D

Finds 62.73±0.1, 2 +0/-0.05 or limit dimensions in the matching PDF, ranks the candidates and crops the one used as evidence.

WC, RSS, Cpk, Monte Carlo

Nominal, mean shift, worst case, RSS, Cp, Cpk, ppm, yield and contribution %. Each row can be normal, uniform or triangular.

Excel with live formulas

Inputs in yellow, everything else a formula: edit a tolerance and the whole stack, Cpk and verdict recalculate.

Audit trail

2D references sheet, Assumptions sheet (method, chain used, other chains found, general table) and a Prepared / Checked / Approved block.

Web app and CLI

A Streamlit app for picking faces and chains, and tolstack demo, faces, paths and run for batch work from a YAML config.

Run it yourself

Run the demo

From the README’s “Try the demo” section. Full options, requirements and troubleshooting are there too.

Open the README
bash
$ git clone https://github.com/juw12/tolstack.git
$ cd tolstack
$ pip install -e ".[app]"
$ python -m tolstack demo tolstack_demo --run
$ streamlit run app.py
Good to know

Honest limits.

Straight from the README, so you know what you're getting before you try it.

  • 1-D stack-ups only, along one axis.
  • Contacts are planar faces normal to the axis.
  • 2D lookup needs PDFs with a text layer (or Tesseract for OCR).
  • A dimension that is not on the 2D is taken from the 3D with the general tolerance; the report says so in the source column.
  • Cp/Cpk and ppm assume the sum is normally distributed; Monte Carlo uses the per-row distributions.
Under the hood

How it's built.

Built with

Language
Python
Data
NumPyopenpyxlpandas
Media
Pillow
UI
Streamlit
Testing
Automated tests

29 files in the repo · last updated 12 Nov 2026.

Browse the code

Recently shipped

  1. Hone round 1: ranked chains, true face outlines, closure check, distributions + Cp/Cpk, limit dims, 2D candidates, Excel assumptions + sign-off…

  2. 1-D tolerance stack-up from STEP + 2D PDFs to Excel (web app + CLI)

Full history on GitHub
Questions

Good questions.

What does it run on?

Python, Streamlit, OpenCascade.

How do I get it running?

The commands in the “Try the demo” box above come straight from the README. Paste them into a terminal; the README covers options and troubleshooting.

What doesn't it do yet?

1-D stack-ups only, along one axis. Contacts are planar faces normal to the axis.

Is it free?

The source is public on GitHub under the MIT licence.

Who made it?

Juwen Lie, an R&D mechanical engineer in Batam, Indonesia, as an independent personal project.

Keep exploring

More from the same workbench.

Inputs in yellow, everything else a formula.

Tolerance stack-ups from 3D and 2D, straight to Excel