Select doubles?

Hello everyone!
Is there a way to select doubles in Blender?
Sometimes when working on video game assets, I accidentally create doubles I don’t want to be there without noticing.
The thing is that when I remove doubles in the complete mesh, there may be further errors following that I would have to clean up. But as I don’t know where the vertices were removed, I would have to take a close look at each face of the entire mesh which would be pretty much insane.
Any ideas?

Many thanks in advance,
Greetings,
Shu

depending, you might be able to locate some by going to the select menu, and choosing ‘non-manifold’. this at least will show you the ones that occurred when merging two mirrored halves of a mesh for instance. also, you can adjust the threshold of the remove doubles function.

Thank you very much for your reply, Modron!
Unfortunately, when selecting “non-manifold”, Blender will show me many vertices that are supposed to be like that.
Also, “Remove Doubles” will always remove doubles that are supposed to stay, too.
Adjusting the threshold won’t help there, I guess.
(Most of the time, I place vertices very exactly.
Sometimes there will be a .00001 or something gap for some odd reason.
This happens when duplicating and snapping all the time.)

Here’s a script, but it performs poorly on complex meshes - 3k vertices is okay however.

import bpy
import bmesh
from mathutils.kdtree import KDTree

def main(ob, threshold, extend):

    bm = bmesh.from_edit_mesh(ob.data)
    verts = bm.verts
    
    if not extend:
        bpy.ops.mesh.select_all(action='DESELECT')
    
    me = ob.data.copy()
    me.transform(ob.matrix_world)

    size = len(me.vertices)
    kd = KDTree(size)

    kd_insert = kd.insert
    for i, v in enumerate(me.vertices):
        kd_insert(v.co, i)
    kd.balance()

    for v in me.vertices:
        for vec, index, dist in kd.find_range(v.co, threshold):
            if index != v.index:
                verts[index].select = True
    bm.select_flush(True)
    
    bpy.data.meshes.remove(me)


class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "mesh.select_doubles"
    bl_label = "Select Doubles"
    bl_options = {'REGISTER', 'UNDO'}

    threshold = bpy.props.FloatProperty(
        name="Select Distance",
        description="Minimum distance between vertices to select",
        default=0.0001,
        min=0.000001,
        soft_min=0.00001,
        soft_max=10,
        max=50,
    )
    
    extend = bpy.props.BoolProperty(
        name="Extend",
        description="Extend the selection",
    )

    @classmethod
    def poll(cls, context):
        return (context.object is not None and
                context.object.type == 'MESH' and
                context.object.data.is_editmode)

    def execute(self, context):
        main(context.object, self.threshold, self.extend)
        return {'FINISHED'}


def register():
    bpy.utils.register_class(SimpleOperator)


def unregister():
    bpy.utils.unregister_class(SimpleOperator)


if __name__ == "__main__":
    register()


Hi, on simple objects I try to narrow down view. way 1) in 3D View properities panel (N) in View tab try to manipulate Start / End of Clip. way 2) use Clipping Border Alt+B. Next select doubles with B, C or CTRL+drag with LMB

Thank you for your replies, CoDEmanX and PiotrPL!

@CoDEmanX:
Did you write that script?
I haven’t tried it yet, but I guess it won’t work for me at the moment because my mesh is made
of about 80k vertices which I want to split up into different parts after finishing the environment completely.
This would probably work nicely if I run into doubles when working on smaller parts, though!


EDIT:
I just tried using the script, but there was an error showing up:

location: <unknown location>:-1

SyntaxError: invalid character in identifier
^
bm = bmesh.from_edit_mesh(ob.data)
File “/Text”, line 7
Python script fail, look in the console for now…

I’m not sure if the script doesn’t work, if it doesn’t work with Blender 2.69 (which I am using) or if this is an error produced by me.
I’m not familiar with Python and I have barely used any scripts in Blender at all.
I just copied your script into the Text Editor and pressed “Run Script”.


@PiotrPL:
I guess this won’t help right now because I am working on a pretty large scene.
But it’s good to know that routine! Maybe it will help at some point when there are doubles on simple objects.

Script works for me.

Tried on Blender 2.70a, Linux 64-bit.

Did you write that script?

Yes, and it works for me, maybe some bad character sneaked in or indentation got messed up when you copied it?

To make it as fast as remove doubles, it would need to be written in C, like remove doubles.

I just copy & pasted the code from a quote of your post.
I deleted the

 and [quote]s. And it doesn't seem to work at all.
I tried this on my 2.70a version and I even downloaded Blender 2.70a again (from blender.org) just to make sure.
But all I get is the exact same error as I already quoted.
Maybe this problem is caused by some modification of the settings in Blender?
Or maybe it's some addon I use that could be making troubles?
I'm rather confused right now.

I tried it again and this time there was an anomaly. If the script is run while in edit mode and then try it, doesn’t do its thing. Have to jump back to object mode and back and then it works. Maybe that got in the way.

https://dl.dropboxusercontent.com/u/26346140/test_select_doubles.avi

Did you get the same error that I got?
I just tried it about 10 times, jumping back and forth from Edit- to Objectmode, but it didn’t help.
The same error keeps showing up. That’s confusing.

No, definitely not.

Well yes, that’s exactly what I do. Unless I’m missing some small detail.
Now I also tried to copy the text directly from your “Code:”.
What’s even weirder is that, when trying to use the code from “Code:”, there will be a different error than the one that occurs when using the code from a quote of your “Code:”.
So I guess the problem comes with the process of copying?

Here is a screenshot of trying to use the code from a quotation:


and this is what it looks like when I copied the code directly from “Code:”:


Thanks & working.

I just tried one more thing: I copied the text directly from your “Code:” and tried using it in Blender 2.70a.
It worked. It was the same copy I tried using in Blender 2.69 and it didn’t work there.
So I guess it’s not compatible with 2.69 and copying from the quote doesn’t work either
(or maybe I did some mistake when testing it in Blender 2.70a the first times).
Hopefully, Blender 2.71 will be a “good” release. I just can’t work with 2.70a.