Repository navigation
Read the drawings of a model database from table 27 - #50
Merged
Merged
Conversation
The drawing table (key 27, rows of 256 bytes) holds one row per drawing of the model: its id, mark, save times, the name of its .dg file next to the model database and the drawing type name. The layout is verified black-box on all sample containers and recorded in the format notes of the project (sections 1.11 and 2.10 of the private format spec). - DrawingRow: the typed decoder of the row body, with the mark, the file name and the type name as text values in the encoding rule of the rows; the words of unknown meaning stay in the raw body. - TableRow.AsDrawing(), TableSection.AsDrawings() and Db1Document.ReadDrawings() read the table on request; a file with no table-section area (text sections only) has no drawings. - tdbio info prints the number of drawings as drawings, in text and JSON. Fixes none; feature from the format research.
ReadDrawings() leaves out the deleted and superseded rows, and the text of table 27 counts toward the code page chosen once for the file. Only a payload whose section separators all open text sections has no table area. Otherwise tables that cannot be read are an error instead of an empty list, and so is a drawing table with rows of another size. tdbio info warns and leaves drawings out when it cannot count them, so its exit code stays what it was before it counted drawings. Use made-up values in the tests and drop the XML doc examples and the reference to notes outside the repository. Join the split Db1Document row of the API table.
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.
The drawing table (key 27, rows of 256 bytes) of a model database holds one row per drawing: its identifier (the object
of type 34 in table 1), its mark, the creation and modification times, the name of its
.dgfile next to the modeldatabase and the drawing type name. The layout was found black-box on sample files.
What changed
DrawingRow: the typed decoder of the row body (table 27, size 256):Id,ObjType(34 in the samples),Mark,CreatedAtandModifiedAt(Unix seconds),FileName,TypeName. The words of unknown meaning are notproperties; the raw body stays on
TableRow.Body.once for the file.
Db1Document.ReadDrawings()returns the drawings without deleted and superseded rows.TableRow.AsDrawing()andTableSection.AsDrawings()decode any row, like the other typed decoders.ReadTables(), when the drawing table has rows of another size, or when a text value of a drawing does not decode.tdbio infoprints the number of drawings asdrawings, in text and JSON. When it cannot count them, it leaves thekey out and adds a warning that says why. The exit code stays what it was before this change.
Verification
dotnet build TdbIO.slnx -c Release: no warnings.dotnet test TdbIO.slnx -c Releaseon net8.0 and net10.0: on this branch, TdbIO.Tests 508 passed and 38 skipped; onits merge with main (
31eebf4), 518 passed and 38 skipped, and TdbIO.Scene.Tests 13 of 13.dotnet packpasses the package validation, and theBuildNativeCoreOnly=truebuild passes.info(text and JSON) differs only by the newdrawingsline.tablesandtextare identical. Object model JSON is identical. Scene JSON is identical when bothexports fall in the same second; otherwise only its
CreatedAtexport time differs. IFC is identical once the exporttime and the random identifiers are masked.
model databases.