dxf-viewer is a high-performance 2D DXF viewer for JavaScript/TypeScript, leveraging WebGL via three.js for rendering large CAD files. Current stable version is 1.0.47. It uses geometry batching and instanced rendering to minimize draw calls, and supports lazy-loading of multiple TTF fonts for text. Key differentiators include web-worker support for offloading heavy processing and efficient handling of block instances. It has limited support for features like MTEXT formatting, line patterns, and hatches, and is primarily maintained by a single developer with periodic updates. No stream parser yet, so large files (>1GB) may hit JS engine string limits.
npm install dxf-viewerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a DxfViewer instance, loads a DXF file from a Buffer, and renders it in a loop.
Update to >=1.0.36 and ensure earcut is installed (npm install earcut) or let dxf-viewer install it.
Consider splitting large DXF files or using alternative tools for files exceeding memory limits.
Update to >=1.0.41 and adjust any option types as needed.
No fix available; feature is incomplete. Use standard fonts and avoid complex MTEXT.
No workaround; consider converting to polyline with segments for patterns.
Convert DXF files to UTF-8 before loading.
Import three.js before dxf-viewer: import * as THREE from 'three'; or load via script tag.
Ensure dxf-viewer is >=1.0.0 and instantiate: const viewer = new DxfViewer(scene, camera, renderer);
Install earcut explicitly: npm install earcut
Update to dxf-viewer >=1.0.41 and use import { DxfViewerConfig } from 'dxf-viewer';