copy mesh data to multiple objects preserving the materials

Hello everyone,

hope that is the right category.

I’m working on a domino project with lots of dominos. I want to design the layout in Illustrator because of flexibility, then importing the svg to blender.
I placed the rectangles of the “bases” of the dominos in Illustrator (like looking from above onto the domino) according to my layout, then exported it as svg and imported it into blender.

Now the comes the tricky part: In order to save me some time I would like to do the following:
after converting the rectangle curves of illustrator to a mesh (bases of the dominos) I want to replace it with a pre modelled domino but keeping the materials already assigned to the converted curves.
(see attachment: the modelled domino, the bases I want to replace with it on the right.)

Background: I could set up all the colours in illustrator, blender would adapt them from the svg and I would only need to replace the rectangle shapes with the actual domino and would have all colours already set up.
That way I could save a huge amount of time. Otherwise I would need to assign all the colors to the dominos by hand. Which can be a really tedious task when having a field von 20.000 dominos revealing a logo for example:D.

I tried many things for the last couple of hours but I can’t manage to only copy the mesh data from the modelled domino to the converted rectangles preserving the materials. I found a script but it always overwrites the materials as well (which are the crucial part of everything).

The script I used is:


import bpy

the name of the mesh to copy to all selected objects

mesh = bpy.data.meshes[“Cube.020”]

for o in bpy.data.objects:
if o.select:
bpy.data.meshes = mesh


Unfortunately I never scripted in python before. Maybe there is just another command I need to know and everything would work.
Any help would be greatly appreciated.

Best regards

magicer

Attachments