Code Monkey home page Code Monkey logo

node-dxf's Introduction

node-dxf

Parse DXF files to get polygons and text elements.

usage

nodedxf('pathTo.dxf', function (res) {
    /*
    res output:
    { layers: [...],
      polygons: [...],
      texts: [...],
      mappings: [...]
    */
});

output types

node-dxf will give you 4 outputs a.t.m. Layers, polygons, texts and mappings. Layers, polygons and texts should be clear, just run the test to get a better understanding or look at the following sample. Mappings are potential relations between text elements and polygons. node-dxf tests whether a text element lies inside a polygon, if so it creates a potential mapping. The mappings-Array contains the potential mappings.

{ layers:
   [ { name: '0\r' },
     { name: 'DEFPOINTS\r' },
     { name: '_VT_ohnePIDs_1OG_SP\r' } ],
  polygons:
   [ { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', points: [Object] } ],
  texts:
   [ { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] },
     { layer: '_VT_ohnePIDs_1OG_SP\r', txt: [Object] } ],
  mappings:
   [ { polygonIndex: 0, textIndex: 14 },
     { polygonIndex: 1, textIndex: 16 },
     { polygonIndex: 2, textIndex: 15 },
     { polygonIndex: 3, textIndex: 17 },
     { polygonIndex: 4, textIndex: 11 },
     { polygonIndex: 5, textIndex: 12 },
     { polygonIndex: 6, textIndex: 13 },
     { polygonIndex: 7, textIndex: 10 },
     { polygonIndex: 8, textIndex: 9 },
     { polygonIndex: 9, textIndex: 0 },
     { polygonIndex: 10, textIndex: 1 },
     { polygonIndex: 12, textIndex: 8 },
     { polygonIndex: 13, textIndex: 7 },
     { polygonIndex: 14, textIndex: 6 },
     { polygonIndex: 15, textIndex: 5 },
     { polygonIndex: 16, textIndex: 4 },
     { polygonIndex: 17, textIndex: 3 } ] }

contributors

node-dxf's People

Contributors

eurochriskelly avatar johannesboyne avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.