English | Русский
OpenRebar generates reinforcement layouts for flat RC slabs from isoline-based inputs (DXF or PNG). The core libraries build for .NET 8 and .NET 10. The CLI ships on .NET 10. The engineering logic stays testable outside Revit. The Revit add-in is two builds, chosen by the Revit process runtime: RevitNet8 when that runtime is still .NET 8, and RevitNet10 for .NET 10.
This repo ships three execution surfaces:
- CLI host (
src/OpenRebar.Cli) — batch runs, CI, debugging, integration artifacts - Revit host (
src/OpenRebar.RevitPlugin) — external command + UI (compiled only when Revit SDK references are available) - Optional ML module (
ml/) — U-Net segmentation for PNG isolines exposed via HTTP (FastAPI)
- Problem Statement
- Quick Start (CI-Parity)
- Outputs and Integration Contract
- Architecture
- Domain Ports
- Build and Test
- CI Quality Gates
- History
- Known limitations
- Canonical Examples and Snapshots
- Python ML Module (Optional)
- Revit Host Boundary
- Project Docs
- Scientific Reporting Standard
Prerequisites:
- .NET SDK 8.x and .NET SDK 10.x (the CLI and the
net10.0libraries need the 10 SDK; the Revit .NET 8 build needs the 8 SDK) - Python 3.11+ (for
tools/ci/*.pyand optionalml/lane) - Git with LF-aware checkout
Run from repository root:
dotnet restore OpenRebar.sln --locked-mode -p:EnableWindowsTargeting=true -p:Platform=x64
dotnet build OpenRebar.sln --no-restore --configuration Release -p:EnableWindowsTargeting=true -p:Platform=x64
dotnet format OpenRebar.sln --verify-no-changes --no-restore
dotnet test tests/OpenRebar.Domain.Tests/OpenRebar.Domain.Tests.csproj --no-build --configuration Release -f net8.0
dotnet test tests/OpenRebar.Infrastructure.Tests/OpenRebar.Infrastructure.Tests.csproj --no-build --configuration Release -f net8.0
dotnet test tests/OpenRebar.TestCorpus/OpenRebar.TestCorpus.csproj --no-build --configuration Release -f net8.0
dotnet test tests/OpenRebar.Application.Tests/OpenRebar.Application.Tests.csproj --no-build --configuration Release -f net8.0
dotnet test tests/OpenRebar.Cli.Tests/OpenRebar.Cli.Tests.csproj --no-build --configuration Release -f net10.0
python tools/ci/verify_readme_regression_claim.pyThis sequence mirrors the core .NET lane in CI and is the recommended pre-PR minimum for code or docs claims touching test status.
The motivating workflow is reinforcement placement in Revit from isoline maps exported by tools such as LIRA-SAPR / Stark-ES. Manual placement is time-consuming and susceptible to inconsistency across floors, zones, and engineers.
OpenRebar implements a reproducible pipeline:
- Parse an isoline file (DXF or PNG) into color-coded reinforcement zones
- Classify zones and decompose complex polygons into rectangles (with persisted coverage/over-coverage evidence)
- Calculate reinforcement layout per zone (spacing, diameter, anchorage rules)
- Optimize cutting (1D CSP) to reduce waste (exact small-instance path + column-generation baseline for larger instances)
- Persist auditable machine-readable artifacts for downstream BIM systems
- (When enabled) place straight Rebar elements in Revit and generate tags. Bent bars are refused with an error until bent shapes are supported
The target is to reduce routine slab reinforcement placement from engineer-weeks to engineer-hours under validated assumptions and with a stable, reviewable output contract.
The repository treats the machine-readable outputs as first-class artifacts.
| Artifact | Produced by | Purpose |
|---|---|---|
*.result.json |
Pipeline / CLI | Canonical reinforcement execution report (schema-backed) |
*.aerobim.json |
CLI exporter | AeroBIM-oriented summary export |
*.schedule.csv |
CLI exporter | Rebar schedule export for downstream spreadsheets/ERP |
*.reinforcement.ifc |
CLI exporter | IFC export surface (IFC4 via xBIM) |
Canonical schema: contracts/aerobim-reinforcement-report.schema.json (schemaVersion 2.0.0)
The canonical report explicitly persists:
normativeProfile(for exampleru.sp63.2018) and a versioned table-set id (for exampleru.sp63.2018.tables.v3)analysisProvenancefor geometry decomposition and cutting optimisation (algorithm ids, thresholds, and fallbacks)- per-cutting-plan
sawCutWidthMm, so downstream consumers can independently recompute kerf-awarewasteMm/wastePercent - per-diameter
dualBound/gapquality-bound telemetry when available from the optimizer; heuristic fallback-master runs intentionally suppress these fields (null) because LP lower-bound guarantees do not apply
Clean Architecture with strict dependency inversion:
Domain (pure) ← Application (use cases) ← Infrastructure (adapters) ← Hosts (CLI, RevitPlugin)
- Domain (
src/OpenRebar.Domain): models, ports (interfaces), rules; no external dependencies - Application (
src/OpenRebar.Application): orchestration and use cases; depends only on Domain - Infrastructure (
src/OpenRebar.Infrastructure): DXF/PNG parsing, optimisation, exports, report store, logging adapter; depends on Domain + Application - Hosts:
- CLI (
src/OpenRebar.Cli) - Revit plugin (
src/OpenRebar.RevitPlugin,#if REVIT_SDK)
- CLI (
Ports are defined in src/OpenRebar.Domain/Ports/.
| Port | Responsibility |
|---|---|
IIsolineParser |
Parse DXF/PNG isolines into zones |
ILegendLoader |
Load legend configuration or provide defaults |
IZoneDetector |
Zone classification and polygon decomposition |
IReinforcementCalculator |
Generate rebar segments per zone |
IRebarOptimizer |
Cutting stock optimisation (1D CSP) |
ISupplierCatalogLoader |
Load available stock lengths / pricing |
IReportStore |
Persist canonical *.result.json execution reports |
IReportExporter |
Export external-system reports (for example AeroBIM) |
IScheduleExporter |
Export rebar schedule (CSV) |
IIfcExporter |
Export IFC artefacts |
IRevitPlacer |
Place rebars in an active Revit document |
IImageSegmentationService |
ML-backed PNG segmentation bridge (HTTP) |
IStructuredLogger |
Minimal structured logging abstraction (host-friendly) |
The current normative basis is packaged as a versioned embedded profile resource, with golden tests covering:
- bond stress / design strength lookup
- periodic-profile classification
- linear mass tables
Two optimiser implementations behind IRebarOptimizer:
| Algorithm | Intended role |
|---|---|
ColumnGenerationOptimizer |
Production-oriented baseline with persisted optimisation provenance and an exact small-instance fast path |
FirstFitDecreasingOptimizer |
Heuristic baseline and fallback |
The column-generation implementation should be understood as a strong engineering baseline (LP/pricing/repair), not as a mathematically complete branch-and-price solver. This distinction is persisted into the canonical report provenance.
Reported WasteMm / WastePercent are kerf-aware: they measure residual stock after both installed rebar length and saw-cut material loss are subtracted.
- DXF: AutoCAD ACI palette (256 colors) + ByLayer resolution
- PNG: exact RGB match against the legend in the deterministic path; anti-aliased edge pixels stay unlabeled. CIE L*a*b* ΔE*76 is used to check legend color separation and to match ML-segmented zones (ISO/CIE 11664-4)
- Optional ML segmentation for PNG via FastAPI (
ml/)
dotnet restore OpenRebar.sln --locked-mode -p:EnableWindowsTargeting=true -p:Platform=x64
dotnet build OpenRebar.sln --no-restore --configuration Release -p:EnableWindowsTargeting=true -p:Platform=x64
dotnet format OpenRebar.sln --verify-no-changes --no-restore
dotnet test tests/OpenRebar.Domain.Tests/OpenRebar.Domain.Tests.csproj --no-build --configuration Release -f net8.0
dotnet test tests/OpenRebar.Infrastructure.Tests/OpenRebar.Infrastructure.Tests.csproj --no-build --configuration Release -f net8.0
dotnet test tests/OpenRebar.TestCorpus/OpenRebar.TestCorpus.csproj --no-build --configuration Release -f net8.0
dotnet test tests/OpenRebar.Application.Tests/OpenRebar.Application.Tests.csproj --no-build --configuration Release -f net8.0
dotnet test tests/OpenRebar.Cli.Tests/OpenRebar.Cli.Tests.csproj --no-build --configuration Release -f net10.0Current regression status (those five commands): 399/399 tests passing.
The build-and-test workflow enforces claim-driven checks, not only compilation:
| Gate | Purpose | Failure effect |
|---|---|---|
dotnet restore --locked-mode |
lockfile integrity and deterministic dependency graph | blocks lane |
dotnet build |
compile-time integrity | blocks lane |
dotnet format --verify-no-changes --no-restore |
whitespace/style drift prevention | blocks lane |
dotnet test + TRX |
executable regression baseline | blocks lane |
verify_readme_regression_claim.py |
README EN/RU test-count claim parity against TRX | blocks lane |
| dependency governance reports | supply-chain visibility (--vulnerable, --outdated) |
evidence artifacts |
| benchmark summary gate | threshold-based quality envelope evidence | blocks benchmark lane |
For audit-grade closure, use docs/VALIDATION_BASELINE.md.
The April 2026 audits and execution plans are historical and are not the source of truth. They are in docs/archive/. The current plan is docs/OPENREBAR_AGENT_PLAN_r7_2026_10_02.md.
The normal test lane skips BatchReinforcementCorpusFixtureTests when no manifest is present. On push and pull request the corpus lane writes corpus: NotEvaluated. The scheduled and manually dispatched benchmark-corpus job sets OPENREBAR_REQUIRE_BATCH_CORPUS=1 only when OPENREBAR_BATCH_CORPUS_ROOT is configured, and then fails if the manifest is missing. To run the envelope locally, add:
tests/OpenRebar.Application.Tests/Fixtures/BatchBenchmarkCorpus/manifest.json, or- set
OPENREBAR_BATCH_CORPUS_ROOTto a directory containing the manifest and fixtures.
Still open relative to docs/OPENREBAR_AGENT_PLAN_2026_10_01.md:
- A single drawing is still one layer. A project file can name up to four drawings. Anchorage is drawn only as far as the working area allows. A hook is the centerline arc of the bend and has no straight tail. A bar longer than stock is lapped. Couplers are not modeled. Holes are counted rather than cut out of the zone.
- Column generation packs a single stock length. A dual bound is published only when
boundStatusisProven. - The schedule is a CSV specification and a steel-mass sheet. XLSX is not written. IFC export has no
IfcReinforcingBarTypeand no bar geometry. - Raster input requires calibration. The optional ML service ships with an empty model manifest.
- A 50 mm grid rejects a layout when any cell is short of the specified area (
Passedonly at zero deficit). Development is measured from the placed end, so an edge without room for anchorage fails the check. Holes are still part of the checked area.examples/dxf/simple-slabstays failed because its edges are Free, the required area runs to the edge, and a hook is not credited. A free edge also insets the axis by cover + d/2 (40 mm for Ø20 and 30 mm cover):edgeDevelopmentAreaM2is 6.12,realDeficitAreaM2is 0.99, andunderReinforcedAreaM2is 7.11.
dotnet run --project src/OpenRebar.Cli -- <isoline-file> [options]Common options:
--legend <path>: legend configuration (JSON)--catalog <path>: supplier catalog (JSON/CSV)--ml-url <url>: PNG segmentation service (for examplehttp://localhost:8101)--slab-width <mm>/--slab-height <mm>/--thickness <mm>/--cover <mm>
The CLI writes the canonical report next to the input file (.result.json) and also emits .schedule.csv, .aerobim.json, and .reinforcement.ifc exports.
The repository now ships canonical reproducible examples under examples/:
examples/dxf/simple-slab/input.dxfexamples/png/simple-slab/input.pngexamples/fe-field/supported-slab.csvwithsupported-slab.project.json(slab on walls, verification passed)
Each example has committed expected snapshots:
expected/input.result.jsonexpected/input.schedule.csv
Regeneration scripts:
# Linux/macOS
bash tools/examples/generate_expected_outputs.sh
# Windows PowerShell
powershell -ExecutionPolicy Bypass -File tools/examples/generate_expected_outputs.ps1Snapshot verification is executed in ExamplesSnapshotTests (tests/OpenRebar.Cli.Tests).
The ML module uses cryptographically-verified dependencies to prevent supply-chain attacks:
cd ml
# Install with hash verification (recommended for production)
pip install --require-hashes -r requirements.locked.txt
# Or use the standard requirements (development)
pip install -r requirements.txt
# Run tests
pytest tests -q
# Start segmentation service
uvicorn src.api.server:app --port 8101Security: See ml/SUPPLY_CHAIN_SECURITY.md for:
- Dependency lock file with SHA256 hashes
- Model checkpoint manifest at
ml/models/MANIFEST.jsonwith integrity verification - CI/CD verification procedures
- Weekly dependency re-pinning workflow
CI executes the Python smoke tests with an explicit PYTHONPATH pointing to ml/ and installs dependencies from ml/requirements.locked.txt using --require-hashes.
The Revit host is compiled under #if REVIT_SDK and requires local Autodesk Revit references. Copy addin/RevitNet8 next to the net8.0-windows build when the Revit process is still .NET 8, and addin/RevitNet10 next to the net10.0-windows build when it is .NET 10. See RELEASE_POLICY.md.
The repository includes:
- DI composition root (
src/OpenRebar.RevitPlugin/Bootstrap.cs) - placement implementation using
Rebar.CreateFromCurves - tag creation pass (
IndependentTag.Create) - bending-shape tracking (element creation is intentionally left as an explicit TODO boundary)
- bar axes at cover + d/2, with the inner direction of a face on top of the outer one; top cover is read from
CLEAR_COVER_TOP - safe mode: a bar with a hook, L, or U end is not placed as a straight line. It is reported as an error, and the schedule and IFC stay the source of truth
- Documentation router: docs/README.md
- Normative Traceability: docs/NORMATIVE_TRACEABILITY.md — mapping of SP 63 clauses to code and tests
- Architecture notes: docs/architecture.md
- Current plan: docs/OPENREBAR_AGENT_PLAN_r9_2026_10_02.md (on top of r8 and r7)
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Security policy: SECURITY.md
- Code of conduct: CODE_OF_CONDUCT.md
- Citation metadata: CITATION.cff
- Funding metadata: .github/FUNDING.yml
To keep public claims and internal evidence aligned:
- Update canonical surfaces first (
README.md,README.ru.md, docs/VALIDATION_BASELINE.md, docs/README.md). - Keep historical numbers dated in roadmap/audit docs; keep only current numbers in active claim surfaces.
- If behavior changed, update command examples and CI-parity guidance in the same change.
- Treat report snapshots as dated evidence, not evergreen truth.
This README distinguishes implemented and verified behavior from roadmap intent.
- Verified statements map to executable code paths, contracts, tests, and persisted reports.
- Planned work remains explicitly framed as future roadmap.
- Performance and quality metrics are tied to named artifacts and validation lanes, not universal guarantees.
Use docs/VALIDATION_BASELINE.md as the canonical validation baseline before publishing engineering or benchmark claims.
Minimum repository baseline:
dotnet build OpenRebar.sln --configuration Release -p:EnableWindowsTargeting=true
dotnet test tests/OpenRebar.Domain.Tests/OpenRebar.Domain.Tests.csproj --configuration Release -f net8.0
dotnet test tests/OpenRebar.Infrastructure.Tests/OpenRebar.Infrastructure.Tests.csproj --configuration Release -f net8.0
dotnet test tests/OpenRebar.TestCorpus/OpenRebar.TestCorpus.csproj --configuration Release -f net8.0
dotnet test tests/OpenRebar.Application.Tests/OpenRebar.Application.Tests.csproj --configuration Release -f net8.0
dotnet test tests/OpenRebar.Cli.Tests/OpenRebar.Cli.Tests.csproj --configuration Release -f net10.0
cd ml
python -m pip install --require-hashes -r requirements.locked.txt
python -m pytest tests -qIf you changed ML dependency governance or workflow behavior, also verify the pinned lock-refresh path documented in docs/VALIDATION_BASELINE.md:
cd ml
python -m pip install --require-hashes -r ..\.github\requirements\pip-tools.locked.txt
python -m piptools compile --allow-unsafe --generate-hashes --output-file=requirements.locked.txt requirements.inFor report-derived claims, include the report file path, schema contract version, and commit SHA.
- Cite software metadata via CITATION.cff.
- For comparative studies, report both achieved quality indicators and unresolved boundary conditions.
- Keep normative profile and tables version visible when sharing external evidence.
MIT — see LICENSE.