Repository navigation
Add RvtIO.Scene, which turns a Revit document into an IOScene scene - #198
Merged
Merged
Conversation
RvtSceneReader maps the element meshes into one model: placed symbols as shared geometry with one instance per placement and mesh, an element's own meshes local to their lowest corner, lengths in metres, the UniqueId as the source id, names, categories, materials and the instance and type parameters as text property sets with revit: keys. Incomplete geometry and an undecoded file are reported as diagnostics. The project is not packable while the scene contract is a preview; it references IOScene with the range [0.1.0-preview.1, 0.2.0-0).
docfx evaluates every project for net10.0 only: the adapter's reference to RvtIO otherwise loads its net8.0 build, whose System.IO.Hashing support warning fails the docs build.
Parameters flagged IsApproximate are estimates of the reader (such as the fixed thermal values of a wall), not values of the file, so the scene does not carry them under revit:bip keys.
The golden test keeps the model key, the element count and the id suffix of every source id, and pins the two UniqueIds of the fixture file that tracked tests already contain.
RvtSceneReader.Read(document, meshes, options) maps meshes the caller extracted, and the tests use it, so the adapter no longer opens its internals to the test project.
… in the scene Property text is the display string of the public parameter API, and values without an exact one are left out. IfcGuid is the element's valid IfcGUID parameter, else the export id of its UniqueId. The IOScene range now starts at 0.1.0-preview.2.
…UID override The reader guesses the unit of every built-in double from its name, which gives the factor TEXT_WIDTH_SCALE the unit mm, so a double is written only when its unit comes from its measurement spec. The IfcGuid override is the built-in IFC_GUID parameter only, as in RvtIO's IFC export.
# Conflicts: # docs/test-fixtures.md
…diagnostics Read(path) now adds, after read-cut and in stream order, one diagnostic per stream and kind by the rules of the export report: failed-members (error), recovered-members and unverified-members (warnings). The element table rows of the report's no-rows issue have no public API, so that issue is not reported. The document overloads open no file; their docs say to read RvtReaderOptions.Diagnostics.
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes and why
Stacked on
feat/public-mesh-api: the adapter maps the meshes ofElementMeshes.Extract, which that branch makes public API.src/RvtIO.Scene(net8.0, net10.0).RvtSceneReader.Read(path),Read(document, options)andRead(document, meshes, options)turn an RVT document into an IOSceneSceneDocumentwith one model: placed symbols as shared geometry with one instance per placement and mesh, an element's own meshes local to their lowest corner, lengths in metres, materials with name and colour. Incomplete geometry and an undecoded file are reported as diagnostics.Read(path)reports a stream a reader limit cut (read-cut, error) and, per stream by the rules of the export report'sissues[], members that failed to decode (failed-members, error), were rebuilt by structural recovery (recovered-members, warning) or decoded without a matching checksum (unverified-members, warning). The report'sno-rowsis not mapped: the element table rows have no public API. The document overloads open no file and report none of these; their docs say to readRvtReaderOptions.Diagnostics.RvtIO.ScenehasInternalsVisibleTo RvtIO.Tests, as RvtIO has, for the test of this mapping.SourceIdis the Revit UniqueId.IfcGuidis the element's built-inIFC_GUIDparameter when it is a valid GlobalId, else the export id of the UniqueId (the episode GUID with its last 32 bits XORed with the element id) in the IFC base-64 form, as Revit's IFC export derives it. Both depend on the element only; changing either is a breaking release of the adapter.revit:instanceandrevit:type, built-in parameters keyedrevit:bip:<id>. The text is the display string ofParameter.AsValueString, written only where it is the text Revit shows. A double is written only when its unit is resolved from its measurement spec (mm, m², m³, °, A). Built-in doubles are left out for now: RvtIO guesses their unit from the parameter name (it givesTEXT_WIDTH_SCALEthe unit mm). Built-in integers, element ids and values the reader only estimates (IsApproximate) are left out as well.RvtIO.Sceneis packable and published on the RvtIO release tag. Its RvtIO dependency is packed as the exact version[X.Y.Z](a target after_GetProjectReferenceVersions); IOScene is[0.1.0-preview.2, 0.2.0-0)inDirectory.Packages.props, with NU5104 suppressed for that bound.tools/pack-release.ps1reads the packed nuspec and fails the release unless (a) RvtIO.Scene depends on RvtIO exactly at the release version and (b) its IOScene range has a lower bound that is not a preview. (a) guards the pin target, which hooks a private NuGet target; (b) replaces the NU5104 check.docs/scene.md(usage, what the scene holds, the property text rule, diagnostics, limits), added to the toc and the API reference. docfx now evaluates the projects for net10.0 only, because the net8.0 build of RvtIO that the adapter otherwise loads fails the docs build with a System.IO.Hashing warning; the docs workflow also runs onsrc/RvtIO.Scene/**. Two CHANGELOG entries under [Unreleased].Tests
Restored with IOScene 0.1.0-preview.2 from a local package folder; the version published on nuget.org has the same public API and method bodies.
dotnet build RvtIO.slnx -c Release): 0 errors, 192 warnings, the same warning set as before the merge offeat/public-mesh-api.feat/public-mesh-apimerged: net8.0 10894 cases, 10450 passed, 444 skipped; net10.0 10898 cases, 10454 passed, 444 skipped, as recorded indocs/test-fixtures.md.feat/public-mesh-api.RvtSceneReaderTests: 26 new cases on synthetic meshes and parameters (scene validation, model fields, symbol instancing, mirrored placement, metres, own-mesh origin, names and categories, property sets and keys, approximate values, the text rule per storage type, IfcGuid from the UniqueId and the parameter override, materials, diagnostics, model key). Read diagnostics: a synthetic file with a damaged partition gives exactly onefailed-memberserror throughRead(path)(it gave none before the fix), an intact file gives none of the three codes, and the mapping is checked for order, severities and the unverified-minus-recovered rule. WithRvtSceneIdentitySampleTests: 27/27 on both TFMs with the private files.RvtSceneIdentitySampleTests, the golden identity test, on a private Revit 2022 sample (skipped without the private files): the model key, the element count, the UniqueId suffix of every source id, two pinned UniqueIds and the two IFC GlobalIds Revit 2022 wrote for those walls, an empty validation and no diagnostics.Validate()reported nothing.tools/pack-release.ps1under Windows PowerShell 5.1: it packed RvtIO, RvtIO.Cli and RvtIO.Scene, assertion (a) passed, and it stopped at assertion (b) as intended while IOScene is a preview. The assertion was also run on edited copies of the nuspec: a bare RvtIO version and a missing IOScene lower bound fail, a stable IOScene lower bound passes. Not run under pwsh, which the release workflow uses.Notes
feat/public-mesh-api) first; then retarget this PR tomain.Directory.Packages.propsmoves to[0.1.0, 0.2.0-0). This is intended: no adapter built on a preview contract reaches nuget.org. The break procedure runs in one session: IOScene, then the engines, then IOViewer.docs/scene.md): built-in doubles once their unit comes from a spec, typed values, keys for shared, project and family parameters, levels and an element tree.