BlockReference.Create removes block attributes

I have a simple block containing a circle and an attribute definition. When trying to place block references at x,y coordinates specified in an Excel file, the inserted block references are stripped of the attribute. Has anyone else had this issue?

When checking the Document.BlockByName node to see if it has attributes, the Block.HasAttributeDefinitions node returns “true”. Doing the same check on the BlockReference.Create node returns “false”.

1 Like

@mzjensen please use the other node BlockReference.ByCoordinateSystem, does it make any difference?

Hi @Paolo_Emilio_Serra1, thanks for the quick reply. I tried using the CoordinateSystem.ByOrigin node instead of Point.ByCoordinates and then feeding that into BlockReference.ByCoordinateSystem. I got the same result - the block references have no attributes.

Have the same problem!

@mzjensen @olsen Could you please share the Block Reference? also can you confirm that if you insert the block references manually the attributes are still there?

I believe you got the files from my coworker. For others who may be intereseted, here are some screenshots showing my problem.

I was hoping this script would create my “ID-blokk” at 0,0,0, with the ID-attribute set to 44. However, it looses the attribute all together.

This block was inserted the normal way, as you can see it has the attribute “ID” set to 999

This is the block that lost its attribute “ID”, placed in 0,0,0 by Dynamo

The block that I was using was basically identical to the example posted by @olsen and I was experiencing the same results.

@mzjensen @olsen I had the chance to test it and yes, when you create the block reference you initially have the result of BlockReference.HasAttribute() equal to false, but as soon as you set the value everything works as expected and if you test the BlockReferences again they return true.

3 Likes

Thanks @Paolo_Emilio_Serra1. So what I’m seeing is that you either need to set attributes in Dynamo or run ATTSYNC after they’ve been placed. Is that correct? My original goal was to use Dynamo only for the initial placement of blocks in model space, and then set individual attributes values afterwards. But it looks like Dynamo will not insert a block while also setting the default value for an attribute.

1 Like

I guess you can always set the default value in dynamo though?

Hi Paolo,
I am struggling with the similar issue although I’ve got some problem with the tag definition. I thought this can be a simple string, but it is somehow not taking. Can you please share how did you define the tag field?

3 Likes

Prueba cambiando esto. A mi me funciono …

Hi palporkolab,

Did you resolve the issue with setting (read defining) attributes to a Block(reference)?
I too have this issue.
Regards,

Edward

Hi @palporkolab
Did you solved your issue?
thanks!