Skip to content

Decode row layouts of the most used table sections (fixes #16) - #33

Merged
mahach666 merged 3 commits into
mainfrom
feat/issue-16-decode-table-rows
Nov 14, 2026
Merged

mahach666 merged 3 commits into
mainfrom
feat/issue-16-decode-table-rows

Conversation

@mahach666

Copy link
Copy Markdown
Contributor

This PR decodes the fields of the most common model database table sections and exposes them as typed values next to the raw row bytes:

  • Added 21 typed readonly record structs in \TdbIO\ namespace:
    • \ObjectRow\ (Table 1, size 72): object hierarchy, parent ID (\kuuluu), assembly ID, 128-bit RFC 4122 GUID, type, subtype, external type GUID, masks, status flags, owner ID, privilege ID.
    • \AssemblyRow\ (Table 2, size 92): assembly type, class, main part ID (\dum), lot, name, flags, main part by user flag.
    • \CoordsysRow\ (Table 3, size 40): coordinate system attribute ID, origin coordinates X, Y, Z, and length.
    • \PartRow\ (Table 10, size 64): part attribute link (\part_attr), positioning attribute link, start point ID (\p1), end point ID (\p2), geometry tree root ID, coordinate system attribute ID, local coordinate origin X, Y, Z, length.
    • \PointRow\ (Table 13, size 32): point visibility, 3D coordinates X, Y, Z in millimeters.
    • \RelationRow\ (Table 16, size 60): relation type, related object IDs (\Id1, \Id2), GUID string, flags.
    • \WeldingRow\ (Table 20, size 24): common weld attributes link, seam 1 and 2 links, compound seam links.
    • \NumAttrRow\ (Table 38, size 24): numeric attribute link (father ID, attribute ID, name ID).
    • \StrAttrRow\ (Table 39, size 24): string attribute link (father ID, attribute ID, name ID).
    • \PartAttrRow\ (Table 44, size 372): prefix, name, profile, parameter string ID, assembly position mark, assembly name, material, finish, assembly type, pour phase.
    • \NumAttrAttrRow\ (Table 48, size 44): numeric attribute value (double) and name.
    • \StrAttrAttrRow\ (Table 49, size 120): string attribute value and name.
    • \StringPoolRow\ (Table 50, size 45): string pool chunk (next ID link, hash, ref count, text).
    • \PartNumberingRow\ (Table 94, size 68): series ID, start number, fabrication position, mark prefix.
    • \AssemblyNumberingRow\ (Table 95, size 76): series ID, start number, position numbers, mark prefix.
    • \ObjectNumberingRow\ (Table 105, size 12): object ID, numbering ID, numbering group.
    • \BoltRow\ (Table 107, size 24): bolt attribute link, positioning attribute link, reference points (\p1, \p2), polygon link.
    • \ObjectModificationRow\ (Table 132, size 20): modification ID, modified object ID, modification type, dependency ID, modification timestamp.
    • \BoltHoleRow\ (Table 140, size 48): bolt ID, hole index, connected part ID, point Z, length, slotted hole direction/type, shortening length.
    • \ObjectPhaseRow\ (Table 141, size 8): object ID, phase number.
    • \BoltHolePointsRow\ (Table 142, size 60): bolt ID, intermediate coordinates 1 & 2 (X, Y, Z), number of holes.
  • Added typed row decoding methods on \TableRow\ (\AsObject(), \AsPart(), \AsPoint(), \AsAssembly(), etc.) and bulk decoders on \TableSection\ (\AsObjects(), \AsParts(), \AsPoints(), etc.).
  • Added unit tests covering all synthetic decoders, bounds checks, and decoding against real models.
  • Updated \docs/public-api.md\ with all new types.

Fixes #16.

@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.

Do not merge yet: the shared string decoder silently changes invalid input bytes. This also affects the object-model and JSON-export PRs that include this commit.

Comment thread src/TdbIO/Internal/Bytes.cs Resolved
@mahach666
mahach666 merged commit 66dbede 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.

Decode row layouts of the most used table sections

1 participant