A javascript parser for DXF files. It reads DXF file strings into one large javascript object with more readable properties and a more logical structure.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist Stored the AutoCad color index in the layer data, updated tests to ex… May 14, 2018
lib Merge pull request #34 from Serthys/master Sep 18, 2018
samples Changed browser version from dxfPartser to DxfParser Oct 5, 2015
scripts
test
.gitignore
.jshintrc
.npmignore
LICENSE Initial commit Apr 23, 2015
README.md Updated for publishing 0.6.0 Apr 2, 2018
index.js
jsconfig.json
package-lock.json added test for extended data Feb 18, 2018
package.json Updated minor version May 14, 2018

README.md

Dxf-Parser

Dxf Parser is a javascript parser for dxf files. It reads dxf files into one large javascript object with readable properties and a more logical structure.

Also, keep an eye on three-dxf, a browser module for rendering the output of Dxf-Parser in the browser.

Install

npm install dxf-parser

Browsers -- As of 0.1.3 standalone browserify version is in the dist/ folder. Copy it out of the install directory or just download it from the GitHub repo directly. We may evetually publish this to bower, but the build environment needs a little work first.

Usage

// Grab fileText in node.js or browser
var fileText = ...;

var parser = new DxfParser();
try {
    var dxf = parser.parseSync(fileText);
}catch(err) {
    return console.error(err.stack);
}

See the wiki Example Output page to get an idea of what the results look like.

Run Samples

node.js

node samples/parseSync
node samples/parseStream

browser - the three-dxf repo has a sample for viewing dxf cad in the browser

What's Supported

Support

  • Header
  • Most 2D entities
  • Layers
  • LType table
  • Block table and inserts
  • VPort table
  • Text and some MTEXT
  • Some XData

Does not yet support

  • 3DSolids
  • All types of Leaders
  • other less common objects and entities.

Contributing

See the wiki for info on contributing

Run Tests

npm install -g mocha
//Then
npm test
//OR
mocha test