Skip to content

Read the drawings of a model database from table 27 - #50

Merged
mahach666 merged 2 commits into
mainfrom
feat/drawing-table
Nov 28, 2026
Merged

mahach666 merged 2 commits into
mainfrom
feat/drawing-table

Conversation

@mahach666

@mahach666 mahach666 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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 .dg file next to the model
database 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,
    CreatedAt and ModifiedAt (Unix seconds), FileName, TypeName. The words of unknown meaning are not
    properties; the raw body stays on TableRow.Body.
  • The text values of drawings follow the encoding rule of the rows, and they count toward the code page that is chosen
    once for the file.
  • Db1Document.ReadDrawings() returns the drawings without deleted and superseded rows. TableRow.AsDrawing() and
    TableSection.AsDrawings() decode any row, like the other typed decoders.
  • A file that holds text sections only has no drawings. It is an error when the tables cannot be read, as in
    ReadTables(), when the drawing table has rows of another size, or when a text value of a drawing does not decode.
  • tdbio info prints the number of drawings as drawings, in text and JSON. When it cannot count them, it leaves the
    key 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 Release on net8.0 and net10.0: on this branch, TdbIO.Tests 508 passed and 38 skipped; on
    its merge with main (31eebf4), 518 passed and 38 skipped, and TdbIO.Scene.Tests 13 of 13.
  • On the merge with main, dotnet pack passes the package validation, and the BuildNativeCoreOnly=true build passes.
  • Output compared with main on three synthetic model databases: info (text and JSON) differs only by the new
    drawings line. tables and text are identical. Object model JSON is identical. Scene JSON is identical when both
    exports fall in the same second; otherwise only its CreatedAt export time differs. IFC is identical once the export
    time and the random identifiers are masked.
  • Skipped: the tests that need private inputs. Neither the output comparison nor the new behaviour was checked on real
    model databases.

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.
@mahach666
mahach666 merged commit d2b621d into main Nov 28, 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