@mlightcad/libredwg-converter
Version:
The `libredwg-converter` package provides a DWG file converter for the RealDWG-Web ecosystem, enabling reading and conversion of DWG files into the AutoCAD-like drawing database structure. It is based on the [LibreDWG](https://www.gnu.org/software/libredw
57 lines • 3.04 kB
TypeScript
import { AcDbConversionProgressCallback, AcDbDatabase, AcDbDatabaseConverter, AcDbDatabaseConverterConfig, AcDbParsingTaskResult } from '@mlightcad/data-model';
import { DwgDatabase } from '@mlightcad/libredwg-web';
/**
* Database converter for DWG files based on [libredwg-web](https://github.com/mlight-lee/libredwg-web).
*/
export declare class AcDbLibreDwgConverter extends AcDbDatabaseConverter<DwgDatabase> {
constructor(config?: AcDbDatabaseConverterConfig);
protected parse(data: ArrayBuffer, timeout?: number): Promise<AcDbParsingTaskResult<DwgDatabase>>;
/**
* Gets all of fonts used by entities in model space and paper space
* @param dwg dwg database model
* @returns Returns all of fonts used by entities in model space and paper space
*/
protected getFonts(dwg: DwgDatabase): string[];
/**
* Iterate entities in model space to get fonts used by text, mtext and insert entities
*/
private getFontsInBlock;
protected processLineTypes(model: DwgDatabase, db: AcDbDatabase): void;
protected processTextStyles(model: DwgDatabase, db: AcDbDatabase): void;
protected processDimStyles(model: DwgDatabase, db: AcDbDatabase): void;
protected processLayers(model: DwgDatabase, db: AcDbDatabase): void;
protected processViewports(model: DwgDatabase, db: AcDbDatabase): void;
protected processBlockTables(model: DwgDatabase, db: AcDbDatabase): void;
protected processBlocks(_model: DwgDatabase, _db: AcDbDatabase): void;
private processEntitiesInBlock;
/**
* Breaks up the work into smaller chunks that are executed asynchronously. This is often referred to
* as "batch processing" or "cooperative multitasking," where the time-consuming task is broken into
* smaller pieces and executed in small intervals to allow the UI to remain responsive.
*/
protected processEntities(model: DwgDatabase, db: AcDbDatabase, minimumChunkSize: number, startPercentage: {
value: number;
}, progress?: AcDbConversionProgressCallback): Promise<void>;
protected processHeader(model: DwgDatabase, db: AcDbDatabase): void;
private processCommonTableEntryAttrs;
protected processObjects(model: DwgDatabase, db: AcDbDatabase): void;
private processLayouts;
private processImageDefs;
private processCommonObjectAttrs;
/**
* Groups entities by their `type` property and flattens the result into a single array.
*
* The order of `type` groups follows the order in which they first appear in the input array.
* Items within each group preserve their original order.
*
* This runs in O(n) time, which is generally faster than sorting when you
* don't care about alphabetical order of types.
*
* @param entities - The array of entities to group and flatten.
*
* @returns A new array of entities grouped by their `type` property.
*/
private groupAndFlattenByType;
private isModelSpace;
}
//# sourceMappingURL=AcDbLibreDwgConverter.d.ts.map