how to remove doubled faces that allready have the same vertices ?

I imported a model from another program and i now have a mesh with faces that share the same vertices.
remove doubles doesn’t work because there are no vertices on top of eachother. removing/selecting the “identical” faces by hand isn’t an option because there are more then a couple of thousand of them, is there an automated script for this?
thanks in advance!:smiley:


Could you post a link to the .blend file? I can’t duplicate your problem, locally. Depending on the tools you have available, exporting using a different file format OR importing into another 3D suite and then re-exporting as an obj could work.

I resolved it on my own, Yey!

Just select the objects you want the duplicate faces to be removed, paste the code below in the Text Editor and run the script (alt+P).
I’m a scripting noobie and I hope this is the fastest way to do this, if not, improve upon the code below as you wish .
This code ONLY works on faces which have the same verts (f.e. face 1 has verts(1,2,3,4) and face 2 has verts(2,3,4,1) or some other order).
i think Blender’s built-in “remove doubles” will work on all other situations where you want double faces removed.


#-----------------------------------------------------------------------------
#remove duplicates v1.3
#best way to remove duplicates, just select the objects you want the duplicates removed, then run this scrpit
import bpy 

for obj in bpy.context.selected_objects:
    if obj.type == 'MESH':
        bpy.data.scenes[0].objects.active = obj # make obj active to do operations on it
        bpy.ops.object.mode_set(mode='OBJECT', toggle=False)    # set 3D View to Object Mode (probably redundant)
        bpy.ops.object.mode_set(mode='EDIT', toggle=False)      # set 3D View to Edit Mode
        bpy.context.tool_settings.mesh_select_mode = [False, False, True]   # set to face select in 3D View Editor
        bpy.ops.mesh.select_all(action='SELECT')    # make sure all faces in mesh are selected
        bpy.ops.object.mode_set(mode='OBJECT', toggle=False)    # very silly, you have to be in object mode to select faces!!
        
        found = set([])              # set of found sorted vertices pairs
 
        for face in obj.data.polygons:
            facevertsorted = sorted(face.vertices[:])           # sort vertices of the face to compare later
            if str(facevertsorted) not in found:                # if sorted vertices are not in the set
                found.add(str(facevertsorted))                  # add them in the set
                obj.data.polygons[face.index].select = False    # deselect faces i want to keep
 
        bpy.ops.object.mode_set(mode='EDIT', toggle=False)      # set to Edit Mode AGAIN
        bpy.ops.mesh.delete(type='FACE')                        # delete double faces
        bpy.ops.mesh.select_all(action='SELECT')
        bpy.ops.mesh.normals_make_consistent(inside=False)      # recalculate normals
        bpy.ops.mesh.remove_doubles(threshold=0.0001, use_unselected=False) #remove doubles
        bpy.ops.mesh.normals_make_consistent(inside=False)      # recalculate normals (this one or two lines above is redundant)
        bpy.ops.object.mode_set(mode='OBJECT', toggle=False)    # set to Object Mode AGAIN

@dlax: I imported xnalara model “Data_LaraWetSuit” (with MeshBinToAscii.exe and add-on “import_xnalaura_mesh_ascii_extended.py” from tombraiderforums.com).
Renders looked horrible cause it seemed the duplicate faces where “Z-fighting”.

Later Alligator!:stuck_out_tongue:

Duplicate vertices (Shift+d) without moving … or Extrude (Alt+e) Invidual faces without moving… and after that remove doubles. I have fought this one also :slight_smile:

had a similar problem a few weeks ago and there was a bug
now if you use one of the import and it makes double faces that wold be a bug also!

so why don’t report it as a bug and see what happen !

happy blendering

@ [B]@JuhaW : your methods are elegant and I tested it a couple of times on different meshes but they don’t work (, well they do work but only for about 90%).
For example, in a mesh with 4260 faces, 2275 faces remained, and you have to tweak the threshhold of remove doubles to remove more or less.
With the script on the third post I commented lines 26, 27, 28 out as to not use blender’s “remove doubles” and “recalculate normals and it removed 2130 faces, exactly half of the faces. Furthermore, with your method you have to select each mesh individually, go into edit mode, do some stuff, go out of edit mode and go to the next mesh, etc. With my method you just have to select the objects you want in “object mode” and run the script.

[/B]

I haven’t tried this myself but just wanted to say i’m glad this is out there for emergencies! :slight_smile:

Thanks to everyone who helped out. :slight_smile: