TheSwamp

Code Red => .NET => Topic started by: Jeff H on November 26, 2019, 09:55:19 PM

Title: Inserting blocks with XDATA on Attributes is dependent on ATTREQ & ATTDIA
Post by: Jeff H on November 26, 2019, 09:55:19 PM
I am having a issue with built-in AutoCAD INSERT command  not adding XDATA to AttributeReferences contained on AttributeDefinitions
I hoping some of would test in 2019 or 2020 by setting ATTREQ = 1 & ATTDIA = 1 and see XDATA is added to AttributeReference. I figured most of you have MgdDbg installed to be able to see XDATA on AttributeReference, or maybe built in way that I am not aware of.

To test you just need drawing with a block containing an attribute with XDATA on the AttributeDefinition.
I have uploaded a drawing for testing if needed that has one block with attribute that I added XDATA using Express Tools AttachXdata. It also has some text with fields pointing to ATTDIA & ATTREQ to be able to see settings.

I have tested both 2020 & 2019 and get the same result. I am not sure if the issue is caused by a combination of other settings but so far this is what I have found

Here are steps to test using attached drawing as an example with block named C
Code: [Select]
Set ATTREQ = 1
Set ATTDIA = 1
INSERT C
Use MgdDbg to snoop inserted BlockReference and look Attributes collection and see if XDATA is null on the AttributeReference

Set ATTDIA = 0 or ATTREQ = 0
INSERT C
Use MgdDbg to snoop 2nd inserted BlockReference and look Attributes collection and see if XDATA is now on the AttributeReference

Below is screencast showing doing all 4 combinations of settings in 2020 if explanation was not clear.
ATTREQ & ATTDIA with ATTRIBUTES  (https://knowledge.autodesk.com/community/screencast/83256309-f6e9-496e-8ab2-ee7387845ba7)

To summarize
When ATTREQ = 1 & ATTDIA = 1 then XDATA is NOT copied from AttributeDefinition to AttributeReference when inserting BlockReference
If  ATTREQ = 0 then it will add XDATA no matter setting of ATTDIA.
If  ATTREQ = 1 then ATTDIA =0 for it add XDATA
And to reiterate I am not sure if any other settings might also be causing this behaviour.

Here is another screencast done yesterday with 2019 to try help explain problem to someone else
ATTDIA & XDATA  (https://knowledge.autodesk.com/community/screencast/b210908c-0b2f-4289-b125-affac771919e)
Title: Re: Inserting blocks with XDATA on Attributes is dependent on ATTREQ & ATTDIA
Post by: Jeff H on November 27, 2019, 09:15:16 PM
I was able have this behavior confirmed, and also he discovered dragging a block from design center will not add xdata. no matter what variables settings.
Title: Re: Inserting blocks with XDATA on Attributes is dependent on ATTREQ & ATTDIA
Post by: Bryco on December 05, 2019, 07:34:29 PM
Pretty odd. On a slightly different note, I have never figured out how to add the xdata (as listed in the block) to the blockref when using code to insert. I have always added it to the blockref separately.