---
name: ifc-check
description: Run deterministic checks on an IFC export and write a report that states checked, failed and not-tested per rule, independent of whatever the modelling step said it did. Use before a design review, before release of a revision, or when the designer asks "is the model right".
version: 0.1.0
---

# IFC check

The checker never depends on the modeller's description of what it did. It measures the IFC file.
You run the script, read its report, and explain findings. You do not change the model.

## Requirements
- Python 3.10+ and `ifcopenshell` (`pip install ifcopenshell`).
- An IFC file exported from SketchUp, Revit, Archicad, Rhino or any BIM tool. IFC2X3 and IFC4.

## Procedure
1. Confirm the IFC file path and the revision it represents. Record both.
2. Run:
   ```
   python <this folder>/check_ifc.py <model.ifc> --out checks/<model>-<date>.md [--min-door-width 850]
   ```
3. Read the report. For every `FAILED` item, locate the element by GlobalId and explain in plain
   words what the rule measured and why it failed. Do not guess a fix; propose where to look.
4. For every `NOT TESTED` item, say what information the model lacks for the rule to run. These
   are as important as failures: the reviewer must not assume they passed.
5. Append the ledger entry (`../_shared/run-ledger.md`). Gate: "Named reviewer reads the report
   before release · Status: pending".
6. Stop. Give the reviewer the counts: checked, failed, not tested.

## Try it
`samples/sound.ifc` passes all nine rules. `samples/flawed.ifc` fails four on purpose (duplicate storey
elevation, an uncontained door, a 700 mm door, an unnamed space); its report is `samples/flawed-report.md`.

## Rules the script runs (v0.1.0)
| Rule | Measures | Not tested when |
| --- | --- | --- |
| parse | File opens and declares a schema | — |
| units | Project length unit is defined | — |
| project-tree | IfcProject → IfcSite/IfcBuilding → IfcBuildingStorey exists | — |
| storeys | Storey elevations are unique and increase in order | fewer than 2 storeys |
| containment | Every wall, slab, door, window, column, beam, space is contained in a storey | no such elements |
| duplicate-guid | No two entities share a GlobalId | — |
| door-width | Every door with an OverallWidth is ≥ the minimum (default 850 mm, the Dutch accessible free passage; pass `--min-door-width` for another rule) | door has no OverallWidth |
| space-names | Every IfcSpace has a Name or LongName | no spaces |
| counts | Element counts by type, for the reviewer's eye | — |

Each rule reports `CHECKED`, `FAILED` (with GlobalIds) or `NOT TESTED` (with the reason).

## Permissions and gate
- Read: the IFC file. Write: `checks/` and `runs/ledger.md` only. The model file is never modified.
- Gate: a named reviewer approves a specific revision after reading the report. The script does
  not approve anything.

## Anti-patterns
- Reporting a rule as passed because the model author said the condition was met.
- Lowering the threshold to make a report green.
- Running on 'the latest export' without naming the revision.

## Never
- Never report "passed" for a rule that could not run. `NOT TESTED` is a distinct state.
- Never soften a failure because the modeller's notes say it was handled.
- Never run on a file whose revision you cannot name; ask first.
