Object cleanup (add the decimate modifier) with Phyton on many objects

Hi everyone,
I created a Lego model and import it into Blender.

My Problem is I want to decimate the polygons on each Lego brick. I would do it manuelly but 4000 Bricks are too much.

Im a noob in codeing maybe someone can help me.

What I need:

A script or code piece which add automatically the decimate modifier with 0.8 and apply it on all 4000 Bricks wihch called almost the same ( Brick0001, Brick0002…).

I need to optimize them as good as possible. Thats the reason for decimate it before I join them to one object.

If you have more ideas for optimizeing them, I would love to hear them :slight_smile:

The Blenderversion is not that important. I have 2.79 and 2.8 and I could use any of them.

Thanks for help


Protip: for all the same shapes, link the mesh data. So for example, each brick can be whatever color but you use linked data. So for all bricks that are say, 6x1 brick you link the data. This way when you change the geometry for the original 6x1, you change them all simultaneously.

1 Like

You can also use the add on…bundled in blender… copy attribute menu…select all ,then the one with the decimate modifier CTRL C and finally chose copy selected modifier…
If you want to change parameters on all decimate at the same time. Select all decimated objects and change parameters till pressing ALT key.
Happy blending

1 Like

Thanks for your Tip @sirmaxim. The problem is, that I rebuild a lego with roughly 4000 pieces. To link the same pieces together would take way tooo long.

Thanks for your Tip @skuax. Ill try it tomorrow.

Are equal bricks unique in dimensions or share the same material or have other unique properties? This might be a solution approach to find equal bricks for linking object data.