Skip to content

feat: align with IOExtend architecture and add JSON, IFC, and HTML exports - #39

Merged
mahach666 merged 4 commits into
mainfrom
feat/architecture-scene-ifc-html
Nov 14, 2026
Merged

mahach666 merged 4 commits into
mainfrom
feat/architecture-scene-ifc-html

Conversation

@mahach666

Copy link
Copy Markdown
Contributor

Summary

This PR aligns \TdbIO\ with the ecosystem architecture defined in \IOExtend\ (\profile/README.md), and implements export pipelines for JSON, IFC, and HTML.

Architecture Alignment

  1. Engine as a Leaf (\TdbIO):

    • Pure managed .NET 8/10 library with zero external dependencies.
    • Decodes Tekla Structures model databases into \TeklaModel.
    • Direct export capabilities:
      • JSON: \model.ToJson(), \model.WriteJson(Stream stream)\ (object model JSON).
      • IFC (clean-room): \model.ToIfc(), \model.WriteIfc(Stream stream), \model.WriteIfc(string path)\ with ISO 10303-21 \StepWriter\ and buildingSMART \IfcGuid.
        • Supports IFC2x3 (Coordination View 2.0) and IFC4 (Design Transfer View).
        • Maps \IFCPROJECT\ -> \IFCSITE\ -> \IFCBUILDING\ -> \IFCBUILDINGSTOREY.
        • Maps \ModelAssembly\ to \IFCELEMENTASSEMBLY.
        • Classifies \ModelPart\ into \IFCBEAM, \IFCCOLUMN, \IFCPLATE, or \IFCMEMBER\ with 3D faceted BREP geometry (\scale = 0.001\ for metres), materials (\IFCMATERIAL), and property sets (\IFCPROPERTYSET).
        • Maps \ModelBolt\ to \IFCMECHANICALFASTENER\ and \ModelWeld\ to \IFCFASTENER.
        • Exposes \ModelObject.IfcGuid\ and \TeklaIfcGuid.
  2. Neutral Scene Adapter (\TdbIO.Scene):

    • New project in \src/TdbIO.Scene/\ targeting
      et8.0;net10.0.
    • Depends only on \TdbIO\ and NuGet package \IOScene\ ([0.1.0, 0.2.0-0.0)).
    • \TdbSceneReader.Read(model)\ converts \TeklaModel\ into a \SceneDocument\ in metres with Z up.
    • Validates against IOScene contract (\scene.Validate()\ passes with 0 errors / warnings).
    • Maps assemblies (groups), parts (elements), bolts, welds, Tekla class colors, property sets, and 3D oriented box meshes.
  3. CLI Integration (\TdbIO.Cli):

    • References \TdbIO.Scene\ and NuGet package \IOViewer\ (\

@mahach666 mahach666 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked commit 683dd849764761f8f1cbd7b877f1f0d4ebf6aef5. Please do not merge yet: the seven inline findings below are reproduced with synthetic inputs. The existing Windows suite passes locally on both net8.0 and net10.0 (456 core/CLI tests + 4 scene tests per target; 38 private-fixture tests skipped), but seven additional regression probes fail on each target. Independent IfcOpenShell 0.8.4 parsing/schema validation also rejects the generated IFC.

There is an additional CI issue to resolve before merging: macOS net10.0 fails GzipTests.LargeForgedIsizeWithCorruptDataDoesNotAllocateLargeBuffer: 11,455,512 bytes measured against the 4 MiB limit. The existing assertion uses the process-wide allocation counter, so unrelated parallel tests can contribute. This does not establish a new gzip-reader regression; isolate the measurement (as already done for NC1) and obtain a green run.

Comment thread src/TdbIO.Cli/Cli.cs Resolved
Comment thread src/TdbIO.Cli/Cli.cs Resolved
Comment thread src/TdbIO.Cli/Cli.cs Resolved
Comment thread src/TdbIO/Internal/Export/StepWriter.cs Resolved
- Reject output path identifying input file to prevent source truncation
- Implement atomic file replacement via temporary file across all export paths
- Align IFC entities with IFC2X3 and IFC4 schemas (IfcBuilding, IfcElementAssembly, IfcMaterial, IfcMechanicalFastener, IfcFastener, IfcPlate, and omit IfcProductDefinitionShape when no geometry exists)
- Add shared TeklaModel.ValidateFiniteNumbers() boundary before renderers
- Convert dimensioned length properties and match declared IFC length units
- Reuse object.IfcGuid in IFC exporter to match IOScene element identity on empty GUIDs
- Preserve STEP real precision with G17 and ensure valid mantissa decimal point
- Fix GzipTests allocation measurement to use current thread on macOS

@mahach666 mahach666 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked f9037cba4ce9a0bbf7f5b8b40267165d56a596e5. Five of the seven inline threads are fully fixed; two remain open with new concrete reproductions in those same threads: source loss through a parent-directory junction (P1), and non-finite geometry parsed from PLNaN*200 (P2). Please do not merge yet.

Validation: full Release suite passes on net8.0/net10.0 (465 core/CLI + 4 scene tests per target; 38 private-fixture skips). All 11 original independent probes now pass; five additional failing cases on each target cover the two remaining issues. Independent IfcOpenShell parsing/schema checks are clean for both schemas with geometry on/off, millimetre units and the precision fixture; the malformed-profile fixture still fails. CI is now green on Windows, Ubuntu and macOS, and the process-allocation-counter issue is fixed. No project code was changed during review.

- Resolve destination identity across parent NTFS directory junctions and symlinks in CLI export (AreSameFile, ResolveCanonicalPath), preventing source overwrite via directory aliases.
- Reject non-finite parsed profile dimensions (e.g. PLNaN*200) in TeklaModel.ValidateFiniteNumbers, IfcExporter.EstimateProfileDimensions, and TdbSceneReader.EstimateProfileDimensions.
- Guard StepWriter.Real and StepWriter.RealExact against non-finite values.
- Validate SceneDocument error diagnostics before JSON and HTML serialization.
- Add regression tests covering junction export identity and non-finite profile handling across IFC, scene JSON, and HTML renderers.

@mahach666 mahach666 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked a959bd219b1591336f6c7f1a84a5fcab29301ba8. Both prior reproductions are fixed, and the source-identity thread is now resolved. One P2 regression remains in the existing non-finite-data thread: blanket matching of NAN/INFINITY rejects custom profile names such as the synthetic CUSTOM_NANO200, including plain JSON export. The exact same input succeeds on f9037cb and fails on this head. Please fix this before merging.

Validation: full Release suite passes on net8.0/net10.0 (469 core/CLI + 5 scene tests per target; 38 private-fixture skips). All 16 prior independent checks now pass; four additional format cases reproduce the custom-profile regression on each target. Independent IfcOpenShell 0.8.4 parsing/schema validation is clean for IFC2X3/IFC4 with geometry on/off, the millimetre fixture and the small-number fixture. Windows/Ubuntu/macOS CI and Docs are green. No project code was changed during review.

- Remove blanket NAN/INFINITY substring rejection on profile names in TeklaModel.ValidateFiniteNumbers, allowing finite custom profile names like CUSTOM_NANO200.
- Check parsed profile dimensions for non-finite values (double.IsFinite) at the numeric parsing boundary in IfcExporter and TdbSceneReader.
- Keep StepWriter real-number guards and scene document validation checks.
- Add regression tests verifying that CUSTOM_NANO200 exports successfully across JSON, IFC, scene JSON, and HTML formats.

@mahach666 mahach666 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked 7ac01aec781716c826e247debc42eb622d6c8e35. No remaining actionable findings; all review threads are resolved. Ready to merge.

Validation: full Release suite passes on net8.0/net10.0 (471 core/CLI + 6 scene tests per target; 38 private-fixture skips). All 20 independent regression checks pass on each target. IfcOpenShell 0.8.4 parsing/schema validation reports zero diagnostics for IFC2X3/IFC4 with geometry on/off, millimetre units and the small-number fixture. The original data-loss, NaN, identity, units and precision regressions are covered. Windows/Ubuntu/macOS CI and Docs are green. No project code was changed during review.

Not checked: private models/38 fixture-dependent tests, full IFC/MVD certification and real-model geometry fidelity.

@mahach666
mahach666 merged commit e082db2 into main Nov 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant