dxf-parser icon indicating copy to clipboard operation
dxf-parser copied to clipboard

Name of Dynamic Block Inserts

Open pranavramkrishnan opened this issue 4 years ago • 5 comments

Hey there,

I was wondering if there is a way to get the name of a dynamic block from an inserted instance?

Currently I am getting objects with values such as these:

{
    type: 'INSERT',
    handle: '16D8',
    ownerHandle: '2',
    layer: 'Tracing',
    lineweight: 25,
    name: '*U146',  // <------------- Would like an actual name which I can see in AutoCAD but not in the parsed value
    position: { x: 407.6777181310168, y: 883.6808549083853, z: 0 },
    xScale: -1,
    rotation: 89.99999564094279
  }

Thanks in advance!

pranavramkrishnan avatar Sep 15 '20 23:09 pranavramkrishnan

I tried launching the three-dxf sample with the test file and I can see the correct name shown.

Maybe the name '*U146' you see there is Unicode?

Serthys avatar Sep 16 '20 00:09 Serthys

If AutoCAD shows different block names then we may need a sample file. I don't know if it's stored in extended data or a standard dxf code/value pair.

bzuillsmith avatar Sep 16 '20 02:09 bzuillsmith

I investigated this a bit more.

This is my understanding. When inserting a dynamic block, AutoCad anonymizes the name (*U... like name). However, if you use the BLOCK_RECORD table in the TABLES section, you are able to following ownerHandles to link a particular insert --> block (anonymized name) --> base block (which is named).

I extended the version of dxfParser I had to also parse the block record table which helped with this investigation. More than happy to open a PR for this, but perhaps later versions already have this?

Thanks again!

pranavramkrishnan avatar Sep 16 '20 18:09 pranavramkrishnan

Ah, I see. A PR would be great. There hasn't been any other development on the BLOCK_RECROD table. I'm a little behind on maintaining this repo, but I've been making bits of progress lately and hope to bring in some PRs soon.

bzuillsmith avatar Sep 16 '20 18:09 bzuillsmith

I investigated this a bit more.

This is my understanding. When inserting a dynamic block, AutoCad anonymizes the name (*U... like name). However, if you use the BLOCK_RECORD table in the TABLES section, you are able to following ownerHandles to link a particular insert --> block (anonymized name) --> base block (which is named).

I extended the version of dxfParser I had to also parse the block record table which helped with this investigation. More than happy to open a PR for this, but perhaps later versions already have this?

Thanks again!

can you share your code, thank you! @pranavramkrishnan

Arnoldnuo avatar May 12 '23 10:05 Arnoldnuo