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 library compiled to WebAssembly.
This package implements a DWG file converter compatible with the RealDWG-Web data model. It allows you to register DWG file support in your application and convert DWG files into the in-memory drawing database.
DWG parsing is provided through a dedicated Web Worker bundle (libredwg-parser-worker.js). This converter is intended for Web Worker use only. That restriction is not because parsing cannot run on the main thread in principle; it is a deliberate licensing choice. LibreDWG and its WebAssembly wrapper are copyleft (GPL), and loading them in a separate worker bundle helps keep that parser code apart from the main MIT-licensed application so license obligations are easier to manage.
npm install @mlightcad/libredwg-converter
Peer dependencies:
@mlightcad/data-model
import { AcDbDatabaseConverterManager, AcDbFileType } from '@mlightcad/data-model';
import { AcDbLibreDwgConverter } from '@mlightcad/libredwg-converter';
const dwgConverter = new AcDbLibreDwgConverter({
useWorker: true,
parserWorkerUrl: './assets/libredwg-parser-worker.js'
});
AcDbDatabaseConverterManager.instance.register(AcDbFileType.DWG, dwgConverter);
Deploy libredwg-parser-worker.js from this package's dist/ folder to a public URL accessible by your application.
AcDbDatabaseConverter)For detailed API documentation, visit the RealDWG-Web documentation.
This package is part of the RealDWG-Web monorepo. Please refer to the main project README for contribution guidelines.