I just started using python and got stuck. I found this script which is used to take the selected objects from the scene and add them to a list based on the name of the material. I should do almost the same thing but based on the name of the collection, rather than that of the material. Can you help me? Thanks in advance.
selection = bpy.context.selected_objects
obj_list = []
for o in selection:
for m in o.material_slots:
if '_abetemono15' in m.name:
obj_list.append(o)
More explanations.
Thanks brockmann, Yes, well it is difficult to explain. However I try. I am a designer for a carpentry shop. In Blender I have not found a way to calculate the quantities of lumber and things like that. In recent days I have written things like this:
It was a nightmare. In addition to not understanding Python, I also struggle with English. I'm good at Blender but this time is not enough. However this thing works, but I had to use the materials to separate the types of timber that are used in the furniture. But this doesn't work because sometimes I have to replace the surface material without changing the name of the material that is related to the script. Probably the best thing to do is to use collections to group material types, materials for materials and emptys to group furniture.
I found this. But it works without considering the selection on the scene.
selection = bpy.data.collections["Abete massiccio"].objects