diff options
author | Eugenio Pignataro <info@oscurart.com.ar> | 2017-01-09 18:32:27 +0300 |
---|---|---|
committer | Eugenio Pignataro <info@oscurart.com.ar> | 2017-01-09 18:32:27 +0300 |
commit | 071aa3e5450991563a5ffe25d442ba06344bdcf6 (patch) | |
tree | a4aaf01e3db5dbbd0a4bf82428c38d6bf9882b52 /oscurart_tools/oscurart_meshes.py | |
parent | 07c0cab22450cf1f6f81f4b3d5a3549a289f0ad2 (diff) |
add new tool: Select Doubles. Search and select doubles verts
Diffstat (limited to 'oscurart_tools/oscurart_meshes.py')
-rw-r--r-- | oscurart_tools/oscurart_meshes.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/oscurart_tools/oscurart_meshes.py b/oscurart_tools/oscurart_meshes.py index 07088df2..ae221ff7 100644 --- a/oscurart_tools/oscurart_meshes.py +++ b/oscurart_tools/oscurart_meshes.py @@ -466,3 +466,42 @@ class ModalIndexOperator(Operator): else: self.report({"WARNING"}, "Is not a 3D Space") return {'CANCELLED'} + +# -------------------------- SELECT DOUBLES + +def SelDoubles(self, context): + bm = bmesh.from_edit_mesh(bpy.context.object.data) + + for v in bm.verts: + v.select = 0 + + dictloc = {} + + rd = lambda x: (round(x[0],4),round(x[1],4),round(x[2],4)) + + for vert in bm.verts: + dictloc.setdefault(rd(vert.co),[]).append(vert.index) + + for loc, ind in dictloc.items(): + if len(ind) > 1: + for v in ind: + bm.verts[v].select = 1 + + bpy.context.scene.objects.active = bpy.context.scene.objects.active + + +class SelectDoubles(Operator): + bl_idname = "mesh.select_doubles" + bl_label = "Select Doubles" + bl_options = {"REGISTER", "UNDO"} + + @classmethod + def poll(cls, context): + return (context.active_object is not None and + context.active_object.type == 'MESH' and + context.active_object.mode == "EDIT") + + + def execute(self, context): + SelDoubles(self, context) + return {'FINISHED'}
\ No newline at end of file |