Need private packages and team management tools?Check out npm Teams »

@jscad/dxf-deserializer

0.1.3 • Public • Published

@jscad/dxf-deserializer

DXF deserializer for the JSCAD project

GitHub version Build Status

Overview

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.

DXF Implementation Notes

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
3DFACE to CSG
ARC to Path2D
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
MESH to CSG
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.

Table of Contents

Installation

npm install @jscad/dxf-deserializer

Usage

const deSerializer = require('@jscad/dxf-deserializer')
 
const rawData = fs.readFileSync('PATH/TO/file.dxf')
const jscadCode = deSerializer(rawData)
 

Contribute

For questions about the API, please contact the User Group

PRs accepted.

Small Note: If editing this README, please conform to the standard-readme specification.

License

The MIT License (MIT)

Install

npm i @jscad/dxf-deserializer

DownloadsWeekly Downloads

96

Version

0.1.3

License

MIT

Unpacked Size

98.3 kB

Total Files

16

Last publish

Collaborators

  • avatar
  • avatar