dxf-parser
dxf-parser copied to clipboard
Name of Dynamic Block Inserts
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!
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?
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.
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!
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.
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 theBLOCK_RECORD
table in theTABLES
section, you are able to followingownerHandles
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