I am dealing with an obj import from a different program - which I have no control on.

The output is one single mesh, different logical parts of which are assigned different materials.

I would like to separate the mesh by material - so that from the state below:

enter image description here

I could get to one with two separate meshes, one per material.

How is that done - both manually and (ideally) with python/bpy?


1 Answer 1



Separate selected geometry into a new mesh

You can use mesh.separate() in Edit Mode and pass 'MATERIAL' to its type argument:

import bpy

C = bpy.context

# If object type is mesh and mode is set to object
if C.object.type == 'MESH' and C.mode == 'OBJECT':
    # Edit Mode
    # Seperate by material
    # Object Mode

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .