Block.Blockreference not working

Hi everyone,
I am developing a script to create 3D elements from existing 2D blocks. When trying to select the 2D blocks by Name the node Block.Blockreference does not seem to work with some elements and I do not understand why, I have tried auditing the drawing and others but can’t workout what the issue is.

I am using Civil 3D 2020 with Update 2 and Dynamo4Civil 2.4, I leave some screenshots below and any help would be much appreciated!
Thanks in advance!

Can you put these on a new later, freeze the later, delete all other elements, purge unused a few times, audit the drawing, ensure it still reproduces, and post the dwg?

1 Like

Yes, still does. I send the file attached

Test-Blocks.dwg (1.1 MB)

1 Like

@VAparici for those ending in “-66” there are 8 under *U23, for those ending in “-67”, there are 14 under *U18

1 Like

@VAparici this happens frequently with dynamic blocks and is caused by anonymous block names. If you select a block and do the LIST command, you’ll see that some of them have an anonymous name:

Anonymous Block

When the dynamic properties of a dynamic block are manipulated, the changes are stored behind the scenes as anonymous blocks. An anonymous block is created for each different state of the dynamic block in the drawing. The anonymous naming allows the same block to be different by changing it’s name for every different occurrence.

This answer doesn’t seem to fully explain how some of your blocks became anonymous in the first place, because it doesn’t seem like aligning the block to an object using the grip will add the anonymous name - so that part is still a mystery. But this means that you should be able to select the blocks by name in Dynamo after using the RESETBLOCK command.

Or just select them by their layer, that’s another way to do it.

4 Likes

Yes @Paolo_Emilio_Serra1 I just realised about this! @mzjensen the RESETBLOCK command has worked perfectly thank you very much!