Compare multiple block references geometry and swap block if geometry is equal

Hi,
I try to find solution for this. I have dwg file and lot of blocks in it. Some block reference have same gometry but it is not same block. I would like to swap block with same geometry and reduce block definitions names. Do you have any experience with this? Maybe there is some command in AutoCAD for this. I attached dwg and dynamo file, where I do not know how to compare geometry.


D4C3D_blocks_01.dwg (477.7 KB)

D4C3D_blocks_01.dyn (36.2 KB)

Hello,
the length of the geometries are equivalent, can be a starting point to study.
Then a superposition of geometry (to avoid parasitic blocks), but I admit that I have trouble finding a way to do it.

cordially
christian.stan

Hi, @Drbohlav !

So, we have to compare every block’s geometry vs others to get copies.
And what about same geometry but different insertion point?
Also may be useful:
(617) Blockify for Autocad - YouTube

I tried to use this node


but without success. I am not sure what to use when circle is in block definition.

Although not a Dynamo solution, I usually use the BLOCKREPLACE command for this.

1 Like

Hi @mzjensen, I know about this command BLOCKREPLACE, I don’t know how to use it on multiple blocks. I can select only one block

Hi @Drbohlav ,

Perhaps something as simple as summing all the lengths of each curve is enough here. Seems to work on the sample you uploaded. And you could always extend this method with other methods if this method alone incorrectly assumes two objects are the same, i.e. amount of curves, BoundingBox area, etc.:


2022-12-28 Group AutoCAD Blocks by their Curve Length.dyn (16.8 KB)

PS: I also couldn’t get the Geometry.AlmostEqualTo node to work.

3 Likes