Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting entities attributes #61

Open
pranavramkrishnan opened this issue Jun 8, 2020 · 4 comments
Open

Extracting entities attributes #61

pranavramkrishnan opened this issue Jun 8, 2020 · 4 comments

Comments

@pranavramkrishnan
Copy link

Hi!

I've found this package extremely useful in trying to run some experiments with AutoCAD/DXF files.

I wanted to understand if there is a way to get entity attributes through this parser? Specifically, attributes for an inserted block entity.

Thanks in advance!

@bjnortier
Copy link
Collaborator

If you look in examples/example.es6.js you can see how to access the raw parsed entities (including blocks)

@pranavramkrishnan
Copy link
Author

Thanks for the response @bjnortier!

I'm looking to get entity attributes as well as details such as a entity handles.

Based on the example you suggest, here is the code I'm using to parse:

const dxf = new Helper(fs.readFileSync('...', 'utf-8'))

const {blocks, entities} = dxf.parsed

However the entities returned seem to be as such:

{
    type: 'INSERT',
    layer: 'M-CORNER',
    block: '*U57',
    x: 3.431680568112945,
    y: -5.903964967049045,
    z: 0
  }

In AutoCAD - this particular insert as associated attributes (ATTRIB). And I'm also looking to get handles for each entity.

Is there a different way/method I should be using?

Thanks again!

@bjnortier
Copy link
Collaborator

Ah I misundersood.

This library doesn't do any parsing of ATTRIB entities unfortunately.

@z3dev
Copy link

z3dev commented Jun 10, 2020

I’ve been reading this issue, and still don’t understand what’s required.

DXF is a series of blocks, entities, etc. It doesn’t provide any linkage between pieces, except for references, which are typically just strings.

So, no matter what, whatever you want to do, you still have to put the pieces together. For example, the third entity references block 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants