How to replace selected blocks with another block in Dynamo for Civil 3D?

Hi everyone,

I’m trying to create a Dynamo script where I can select multiple existing blocks in AutoCAD/Civil 3D and replace them with another block type.

For example:

  • I select several instances of Block A in the drawing.

  • I want to replace all of them with Block B, keeping the same insertion point, rotation, scale, and layer.

I tried using the BlockReference.ByCoordinateSystem node, but I keep getting type errors because it expects Block definitions instead of BlockReference. I also tried connecting the selected blocks directly, but that didn’t work either.

Has anyone done this before? What’s the best approach — using only nodes, or is it better to handle this with a Python script inside Dynamo?

Thanks in advance!

Hi Luiz,

Here is a super simple approach for what you are looking for. You can accomplish this with the out of the box nodes. If you have additional items like attributes you can read and set those as well.

1 Like

Instead of making new block references and deleting the old ones, I would recommend using the BlockReference.SetBlock node. So you can just change the block definition of the block reference directly. There’s also a sample graph that you can try out :slight_smile:

2 Likes

That is a much easier way! :sob:

Thanks Zach! :smiley:

I’d also like to mention that the functionality that you are looking for already exists with the BLOCKREPLACE command (from Express Tools) which will allow you to do exactly what you want. With a caveat though that it doesn’t work with dynamic blocks, that might be possible with Dynamo.

Hello Devin. Thank you very much for your reply. I’m just getting started with Dynamo and I’m having some difficulties. The node BlockReference.ByPoint doesn’t appear in my Dynamo. Is it part of a specific package?

Hello Zachri. Thank you very much for your reply. I’m just getting started with Dynamo and I’m having some difficulties. The node BlockReference.SetBlock doesn’t appear in my Dynamo. Is it part of a specific package?

Hello HenrikJ. Thank you very much for your reply. This question is part of a routine I am trying to develop, which is why it is necessary for me to use Dynamo.

Should be out of the box in Dynamo for Civil 3D.

Which version of Dynamo and Civil 3D are you in? You launched it from the manage menu of Civil 3D, right?

I’m using Civil 3D 2024, and yes, I launched Dynamo from the Manage tab inside Civil 3D.

2024 might be the issue - there have been a lot of additions and changes in 2025 and 2026.

1 Like

In Civil 3D 2024 it was called BlockReference.Create.

It is available starting in Civil 3D 2025.1.

2 Likes

Thank you very much Jacod and Zachri, the problem was the version