Repository navigation
Align the engine with the IOExtend architecture and fix row text decoding - #45
Merged
Merged
Conversation
The IFC output is target-format output, not native decoding. Its sources move to src/TdbIO/Ifc. With BuildNativeCoreOnly=true the engine is compiled without that folder and produces no package; CI compiles the engine and TdbIO.Scene this way in a separate artifact path. The regular build keeps the same public types. - Compare the public API of the library with the published 0.1.0 on pack. - Check the TdbIO.Scene package in pack-release.ps1: the engine dependency is exactly the packed version and IOScene is a released version. - Publish the NuGet packages before the GitHub release is created, and update a release that an earlier run of the same tag left. - Document the library boundaries, the native core check, the export comparison and the current scope, and add an Unreleased section to the changelog. Refs #44
The text values of table rows are single-byte in the code page of the system that saved the model. The typed decoders required valid UTF-8, so ReadModel() and tdbio export failed with "invalid UTF-8 string" on every model saved on a system with another code page. - Decode each value as ASCII, UTF-8, code page 1251 or 1252, in that order: the order used for templates and reports without its byte order mark steps. A byte the chosen page does not define is an error at its offset in the row body. - Apply TdbReadOptions.TextEncoding to table rows too. It reaches the rows through TableRow.TextEncoding, and the decoded row types with text take the encoding in Decode(ReadOnlySpan<byte>, Encoding). - Join the chunks of a string pool chain as bytes and decode them as one value. - Test the rule, the encoding reaching rows and the model, and the decoded text of the private vectors. The choice between the two code pages counts bytes from 0xC0, which hold Cyrillic letters in 1251 and Latin letters with diacritics in 1252: a model saved with a Western European page needs its encoding given.
A code page chosen for each value cannot read short values: "№5" holds one
byte from 0x80 and none from 0xC0, so in a model saved with code page 1251
it was read as code page 1252 ("¹5"), while the longer values of the same
row were read as 1251.
- Count the bytes from 0x80 of all the values of the typed tables that are
neither ASCII nor UTF-8 at the end of the walk, and read those values in
the one code page they choose. ASCII and UTF-8 values are read as before;
Decode(body, Encoding) on a body alone still chooses per value.
- Accept --encoding for model databases and DBV@ files, and in tdbio
export, so a model saved with a Western European page can be read.
- Name the position of an undecodable string pool chain as a byte of the
joined chunks instead of an offset that looks like one of the file.
- Document StringPoolRow.Text as the text of one chunk.
- release.yml creates a release only when gh release view reports that it
is missing, and stops on any other failure of the lookup.
Each read of the sections builds its own text rule, so rows from two ReadTables() calls on one document compared unequal by reference. Compare the encoding and the chosen code page instead. State that the code page is chosen once for a model database only: the sections of a DBV@ file have no table key, so there it is chosen for each value.
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
Native engine and IFC output. The organization's architecture keeps native decoding in the engine and target-format output apart. RvtIO and NwcIO compile the native engine and its scene adapter without the export sources; this change makes the same split.
src/TdbIO/Ifc: the exporter, the STEP writer,TeklaIfcExportOptionsand the IFC methods ofTeklaModel. WithBuildNativeCoreOnly=truethe engine is compiled without that folder and produces no package. CI compiles the engine andTdbIO.Scenethis way in a separate artifact path. The regular build keeps the same public types.dotnet packcompares the public API of both target frameworks with the published 0.1.0. An unintended difference fails the pack.tools/pack-release.ps1checks theTdbIO.Scenepackage before anything is pushed: the engine dependency is exactly the packed version andIOSceneis a released version.release.ymlpublishes the NuGet packages before it creates the GitHub release, and updates a release that an earlier run of the same tag left. This covers the failure order of A failed NuGet push leaves a GitHub release that blocks retrying the workflow #44. The workflow does not verify the expected set of packages yet, so the issue stays open.docs/dependencies.md,docs/index.mdand the changelog (newUnreleasedsection) describe the current scope: the object model, the exports, the approximate part geometry and the supported systems.Text of table rows. The text values of table rows are single-byte in the code page of the system that saved the model. The typed decoders required valid UTF-8, so
ReadModel()andtdbio exportfailed withinvalid UTF-8 stringon every model saved on a system with another code page.TdbReadOptions.TextEncodingapplies to table rows too. It reaches the rows throughTableRow.TextEncoding, and the decoded row types with text take the encoding inDecode(ReadOnlySpan<byte>, Encoding).The change is two commits: the engine split, then the text of table rows.
How it was checked
dotnet build TdbIO.slnx -c Releasehas no warningsdotnet test TdbIO.slnx -c Releasepasses: without private inputs 486 passed and 38 skipped of 524 inTdbIO.Tests, 6 of 6 inTdbIO.Scene.Tests, on .NET 8 and .NET 10tdbio info,tdbio tablesandtdbio texton the same files is identical before and after: 94 runs on 47 private files of 9 kinds, byte for byte, with the same exit codesWith the private files, on .NET 8 and .NET 10: 523 passed, 0 failed, 1 skipped of 524 in
TdbIO.Tests.tdbio exportbefore and after, this branch againstmainwith the sameIOScene0.1.2:CreatedAt. IFC differs only in the export time and the random GlobalIds of the site, the building, the storey and the relations.invalid UTF-8 string, exit code 2) now export as JSON, scene JSON and IFC.Also checked:
decoded_text_at_N_width_Min the private manifests).dotnet packfails withCP0002for both target frameworks.dotnet build src/TdbIO.Scene/TdbIO.Scene.csproj -c Release -p:BuildNativeCoreOnly=true --artifacts-path <folder>passes and produces no package.tools/pack-release.ps1run into a temporary folder: 10 artifacts, the checksums match, and theTdbIO.Scenepackage depends onTdbIO[0.1.0]and onIOScene[0.1.2, 0.2.0-0.0).The CI workflow ran on this pull request on Windows, Ubuntu and macOS: restore, build, tests and the native core check
passed on all three, and so did the package step with the API comparison on Windows. The release workflow has not run;
its changed file was checked for its structure only.