Class AcDbDatabaseConverter<TModel>Abstract

Abstract base class for database converters.

This class provides the foundation for converting various file formats (such as DXF, DWG) into AcDbDatabase objects. It handles the conversion process in stages and provides progress tracking capabilities.

class MyConverter extends AcDbDatabaseConverter<MyModel> {
protected parse(data: string | ArrayBuffer): MyModel {
// Implementation for parsing data
}

......

protected processEntities(model: MyModel, db: AcDbDatabase) {
// Implementation for processing entities
}
}

Type Parameters

  • TModel = unknown

    The type of the parsed model data

Hierarchy (View Summary)

Constructors

Properties

Configuration for the converter

Optional progress callback for tracking conversion progress

Methods

  • Resolves the parser worker timeout in milliseconds.

    Explicit timeout always takes precedence. Otherwise the timeout scales linearly with file size at one extra second per MiB, clamped to the range of 30 seconds to 2 minutes.

    Parameters

    • data: ArrayBuffer
    • Optionaltimeout: number

    Returns number

  • Optional stage: CLASSES metadata only augments the database and older converters predate it. A throwing default (like the mandatory stages above) would break any converter compiled before this stage existed — the HEADER task calls it unconditionally, so a data-model upgrade without a matching converter upgrade aborted every file open with "Error occurred in conversion stage HEADER" (mlightcad/cad-viewer#437).

    Parameters

    Returns void