After openDocument() returns true for a DWG file, the canvas stays blank.
The exact same setup works correctly with DXF files.
To Reproduce
AcApDocManager.createInstance({
container, // 1024x559, confirmed via getBoundingClientRect()
autoResize: true,
webworkerFileUrls: {
mtextRender: '/assets/mtext-renderer-worker.js',
dwgParser: '/assets/libredwg-parser-worker.js',
dxfParser: '/assets/dxf-parser-worker.js',
},
});
const buffer = await fetch(fileUrl).then(r => r.arrayBuffer());
const ok = await AcApDocManager.instance.openDocument(filename, buffer, { readOnly: true });
// ok === true, canvas blank for .dwg, works for .dxf
Expected: DWG renders like DXF does.
Observed:
openDocument() returns true for both DWG and DXF
DXF → renders correctly
DWG → blank canvas
"Failed to convert hatch boundaries!" warnings appear (entities ARE being processed)
No worker errors
DWG file tested:
sample_architectural_blueprint.dwg
Downloaded here:
https://www.fileexamples.com/category/cad
Instead sample_engineering_schematic.dxf works correctly.
Since DXF works and DWG doesn't, I suspect database.currentSpaceId in DWG files points to a paper space layout (files saved from AutoCAD with paper space active), causing setActiveLayout() to display an empty paper space instead of model space. Is there a way to explicitly switch to model space after opening?
Environment
@mlightcad/cad-simple-viewer: v1.5.0
Chrome 148 + Safari 26
After openDocument() returns true for a DWG file, the canvas stays blank.
The exact same setup works correctly with DXF files.
To Reproduce
AcApDocManager.createInstance({
container, // 1024x559, confirmed via getBoundingClientRect()
autoResize: true,
webworkerFileUrls: {
mtextRender: '/assets/mtext-renderer-worker.js',
dwgParser: '/assets/libredwg-parser-worker.js',
dxfParser: '/assets/dxf-parser-worker.js',
},
});
const buffer = await fetch(fileUrl).then(r => r.arrayBuffer());
const ok = await AcApDocManager.instance.openDocument(filename, buffer, { readOnly: true });
// ok === true, canvas blank for .dwg, works for .dxf
Expected: DWG renders like DXF does.
Observed:
openDocument() returns true for both DWG and DXF
DXF → renders correctly
DWG → blank canvas
"Failed to convert hatch boundaries!" warnings appear (entities ARE being processed)
No worker errors
DWG file tested:
sample_architectural_blueprint.dwg
Downloaded here:
https://www.fileexamples.com/category/cad
Instead sample_engineering_schematic.dxf works correctly.
Since DXF works and DWG doesn't, I suspect database.currentSpaceId in DWG files points to a paper space layout (files saved from AutoCAD with paper space active), causing setActiveLayout() to display an empty paper space instead of model space. Is there a way to explicitly switch to model space after opening?
Environment
@mlightcad/cad-simple-viewer: v1.5.0
Chrome 148 + Safari 26