haplokuon / netDxf

.net dxf Reader-Writer
MIT License
965 stars 390 forks source link

property of Insert #234

Open itcasth opened 3 years ago

itcasth commented 3 years ago

Hi! What is the difference between attributes in Insert and XDataRecord in XData?

haplokuon commented 3 years ago

You will find more detailed information in the AutoCad manual more than I can give you here, it is available online.

But, here a few tips. Both can be used to store data if this is what you are looking for. Attributes are restricted to only Insert entities, and those attributes are inherited from the attribute definitions of the referenced Block. So, all inserts that reference the same block have the same attributes, without derailing too far I will point that this is not exactly true since once the insert is created they become independent to the block that originated them. Why Autodesk took such a convoluted direction I have no idea. You could, theoretically, delete and add attributes directly to an Insert but this is not possible in netDxf as it is now, nonetheless, you can hide them using the attribute flags.

XData, aka, extended data information is more generic container that can hold different types of data, and it can be associated to all kinds of entities, not just inserts. It is normally used by AutoCad or plugins to store internal information, normally not modified directly by the user.

Another important difference is, that in AutoCad attributes have a a graphical representation while the XData does not.

One last thing, the Attribute value property is always stored as a string, while the XDataRecord value is not, its type is defined by its associated code.