This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
@jscad/dxf-deserializer with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
DXF deserializer for the JSCAD project
This deserializer converts raw DXF data to JSCAD code fragments, or converts raw DXF data directy to CSG library objects. When converting unknown DXF data, converting to JSCAD code fragments will provide more information.
The DXF(tm) file structure changes continously as AutoDesk releases new features and fixes. So, you can imagine that after 20 years, the contents of DXF files are pretty messed up. Expect the worst.
NOTE: At this time, only ASCII DXF files are supported. BINARY DXF files are not supported.
This deserializer converts only what is required by JSCAD libraries and applications. Full document conversion is NOT supported, so don't even try. However, conversion of the following DXF entities are possible:
|DXF Entity||CSG Object||Notes|
|CIRCLE||to CAG||Start and stop angles are ignored|
|ELLIPSE||to CAG||Start and stop angles are ignored|
|LINE||to Line2D or Line3D||This will change in the future|
|LWPOLYLINE||to Path2D or CAG||Conversion to CAG if LWPOLYLINE is closed|
|POLYLINE (line)||to Path2D or CAG||Conversion to CAG if POLYLINE is closed|
|POLYLINE (mesh)||to CSG|
|POLYLINE (face)||to CSG|
In addition, colors are converted using the AutoCad standard color index (256 colors).
Finally, there are many applications that can save to DXF formats. All testing is performed with files from AutoCad, period.
npm install @jscad/dxf-deserializer
const deSerializer = require('@jscad/dxf-deserializer') const rawData = fs.readFileSync('PATH/TO/file.dxf') const jscadCode = deSerializer(rawData)
For questions about the API, please contact the User Group
Small Note: If editing this README, please conform to the standard-readme specification.