Table of Contents

Class Db1Document

Namespace
TdbIO
Assembly
TdbIO.dll

A model database (.db1, also xslib.db1 and their .bak copies): the header, the id map and the unpacked bytes. Text sections and table sections are read on request.

public sealed class Db1Document : TdbDocument

Inheritance

Inherited Members

Properties

IdMap

The id map entries in file order (never sorted), or null with a warning when the header variant before the map is not known.

public IReadOnlyList<IdMapEntry>? IdMap { get; }

Property Value

IReadOnlyList<IdMapEntry>?

IdMapField65

The raw u32 at offset 65, or null when the id map is not read. Values other than 0x0D and 0x10D give a warning; the meaning of bit 0x100 is not known.

public uint? IdMapField65 { get; }

Property Value

uint?

IdMapField73

The raw u32 at offset 73, or null when the id map is not read. Its meaning is not known.

public uint? IdMapField73 { get; }

Property Value

uint?

ModelGuid

The model GUID of the header (bytes 13 to 48).

public Guid ModelGuid { get; }

Property Value

Guid

Payload

The whole unpacked file, header included. Offsets in this library refer to it.

public ReadOnlyMemory<byte> Payload { get; }

Property Value

ReadOnlyMemory<byte>

Version

The version text of the header (bytes 8 to 11), four characters d.dd.

public string Version { get; }

Property Value

string

Methods

ReadModel()

Decodes the table sections into a connected, read-only object model of parts, assemblies, bolts, welds and attributes.

public TeklaModel ReadModel()

Returns

TeklaModel

A new TdbIO.TeklaModel representing the decoded model object graph.

ReadTables()

Reads the table sections of the model database, from the first section to the end of TdbIO.Db1Document.Payload, which they must fill exactly. The rows are a view over the payload, so large tables cost no memory per row. Builds a new list on each call.

public IReadOnlyList<TableSection> ReadTables()

Returns

IReadOnlyList<TableSection>

The sections in file order: first the sections without a key, then the ones with a key.

Exceptions

InvalidDataException

A section is malformed or cut, a section without a key follows one with a key, or bytes are left after the last section. The message names the section and the offset.

ReadTextSections()

Reads every section of 54-byte text rows and joins the rows into chains. The sections are read again on each call.

public IReadOnlyList<TextSection> ReadTextSections()

Returns

IReadOnlyList<TextSection>

The text sections in file order.

Exceptions

InvalidDataException

A text section is malformed: a bad marker or closer, a repeated id, a link to a missing id, a cycle, a row reached from two chains or a last row without NUL.