# dxf-parser

> Parse dxf files into a readable, logical js object.

Latest version **1.1.2** (published 2021-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install dxf-parser
pnpm add dxf-parser
yarn add dxf-parser
bun add dxf-parser
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2021-11-12 |
| First published | 2015-04-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 188.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 556 |
| Author | GDS Storefront Estimating |
| Maintainers | bzuillsmith |
| Keywords | dxf, cad, parser, reader |

## Links

- npm: https://www.npmjs.com/package/dxf-parser
- Repository: https://github.com/gdsestimating/dxf-parser
- Issues: https://github.com/gdsestimating/dxf-parser/issues
- npm.io page: https://npm.io/package/dxf-parser

## Dependencies (1)

- [loglevel](https://npm.io/package/loglevel.md) ^1.7.1

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2021-11-12
- 1.1.1 — 2021-11-05
- 1.1.0 — 2021-11-04
- 1.0.2 — 2021-09-26
- 1.0.1 — 2021-09-26
- 1.0.0 — 2021-09-16
- 1.0.0-alpha.2 — 2019-11-29
- 1.0.0-alpha.1 — 2019-02-27
- 0.6.1 — 2018-04-02
- 0.5.1 — 2018-01-08
- 0.5.0 — 2018-01-06
- 0.4.8 — 2017-07-09
- 0.4.7 — 2017-06-21
- 0.4.6 — 2016-09-08
- 0.4.4 — 2016-05-28
- … 11 more at https://npm.io/package/dxf-parser/versions

## README

# 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](https://github.com/gdsestimating/three-dxf), a browser module for rendering the output of Dxf-Parser in the browser.

#### Install

```sh
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

``` js
import parse, { DxfParser } from 'dxf-parser';

// Grab fileText in node.js or browser
const fileText = ...;

const parser = new DxfParser();
try {
    const dxf = parser.parseSync(fileText);
}catch(err) {
    return console.error(err.stack);
}
```

or

```ts
// Grab fileText in node.js or browser
import parse from 'dxf-parser';

const fileText = ...;

try {
    const dxf = parse(fileText);
}catch(err) {
    return console.error(err.stack);
}
```

See the [wiki Example Output page](https://github.com/gdsestimating/dxf-parser/wiki/Example-Output) to get an idea of what the results look like.

#### Run Samples

node.js

```sh
npm install
npm run build
node samples/node/parseSync
node samples/node/parseStream
```

browser - the [three-dxf repo](https://github.com/gdsestimating/three-dxf) 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](https://github.com/gdsestimating/dxf-parser/wiki) for info on contributing

#### Run Tests

```sh
npm install -g mocha
//Then
npm test
//OR
mocha test
```

---
_Source: https://npm.io/package/dxf-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
