Search code examples
dxf

Application specfic data in DXF Entities


I'm looking for a way to tag entities (for example arc) in a DXF with an numeric ID of my choosing. Is there a good (standard complient) way of doing this?

Looking at the DXF format reference, I see there is a "common group code" 102 that is documented as "application defined codes". Can I use that? If so an example of the correct way to use it whould be nice.


Solution

  • After asking a similar question on the autodesk forums, I have found that I can use Extended Data to add my numeric ID.

    Extended Data is appended at the end of the entity and in my case I will solve it by appending the following:

    1001
    MYAPP
    1002
    {
    1070
        12
    1002
    }
    
    • Where 1001 marks the start of extended data
    • 1002 marks the beginning end end of list
    • 1070 is a 16-bit integer

    It's also possible to add extended data from Autocad software using the command _xdata