2
$\begingroup$

This question is similar but didn't seem to solve this problem.

How can you turn a face from an existing mesh into a new standalone mesh, without changing the visual state of the object?

Let's use as an example the default cube in Blender that appears with new files.

How could you extract each cube face from the existing mesh and create a new mesh with only that one cube face?

In the end, the cube should look the same but you should have six meshes -- one for each cube face.

$\endgroup$
5
$\begingroup$
  • Step one: Give the Cube an Edge Split modifier and apply it. Now you have a mesh with 6 separate faces. If you have a mesh with less pronounced angles, you might need to select all faces and hit CTRLE 'Mark Sharp'.

  • Step two: Go into edit mode and hit P for seParate and choose 'By loose parts'.

  • Step three, optional: in object mode, select all the new objects and in the tools, use 'set origin to geometry'. All faces have the object origin moved into their middle. Depends on what you want to do.

split personality

I recommend saving before trying this with a mesh that has lots of faces. Separate can take quite some time and has no indicator whether it's still working.

P.S.: I scaled the object centers of the right Suzie's faces to illustrate the effect. If I hadn't, it would look identical to the left Suzie.

I eventually came up with a script. It uses the active object as its source.

import bpy

targetName = "new-object" # name for the new objects

def createNewObj(verts, faces): 
    global targetName    
    newMesh = bpy.data.meshes.new(targetName)
    newMesh.from_pydata(verts, [], faces)
    newMesh.update()

    obj = bpy.data.objects.new(targetName, newMesh)        
    scene = bpy.context.scene
    scene.objects.link(obj)

def iterateFaces(sourceName): 
    obj   = bpy.data.objects[sourceName]
    mesh  = obj.data
    verts = mesh.vertices
    faces = mesh.polygons    
    total = len(faces)
    counter = 0

    for a in faces:            
        newFace = [list(range(len(a.vertices)))]
        newVerts = []
        for b in a.vertices:
            newVerts.append(verts[b].co)   
        createNewObj(newVerts, newFace)        
        counter += 1
        if counter % 100 == 0:
            print(counter,"/", total, "done")
    if counter % 100 != 0:
        print(total,"/", total, "done")
    print("Separation finished.")    

if bpy.context.active_object.type == 'MESH':
    sourceName = bpy.context.active_object.name
    iterateFaces(sourceName)
else:
    print("The selected object isn't a mesh")
$\endgroup$
  • 1
    $\begingroup$ Thanks so much! Is there a faster way to do this if a mesh has many faces? $\endgroup$ – Crashalot Feb 13 '18 at 2:16
  • $\begingroup$ The only other way I can imagine would be a python script that reads the list of faces and produces objects. Separating the mesh into objects a thousand faces each might help. Never tried it. $\endgroup$ – Haunt_House Feb 13 '18 at 2:32
  • $\begingroup$ On my very slow pc, a 1000 faces took about 22 seconds. How many faces do you have to split? $\endgroup$ – Haunt_House Feb 13 '18 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.