#!BPY """ Name: 'SelectArea 0.10' Blender: 241 Group: 'Mesh' Tooltip: 'Selects verts within the selected area.' """ __author__ = "BeBraw" __url__ = ("") __version__ = "0.10 04.07.06" __bpydoc__ = """\ Selects the verts within the selected area. Usage: Select area and execute the script. Tips: """ ############################################################# # Code history # ############################################################# # version 0.10 released 04.07.06 # -------------------------------------------------------------------------- # ***** BEGIN GPL LICENSE BLOCK ***** # # Copyright (C) 2006: BeBraw # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # ***** END GPL LICENCE BLOCK ***** # -------------------------------------------------------------------------- ''' Current issues: TODO: ''' import Blender from Blender import NMesh, Window inEmode = Window.EditMode() if inEmode: Window.EditMode(0) #get edges of selected object selectedObject = Blender.Object.GetSelected() me = selectedObject[0].getData() edges = me.edges #get selected verts and their references to neighbours vertsAndTheirReferencesToNeighbourVerts = {} for e in edges: try: if e.v1.sel == 1: vertsAndTheirReferencesToNeighbourVerts[e.v1] except: vertsAndTheirReferencesToNeighbourVerts[e.v1] = [e.v2] else: if e.v1.sel == 1: references = vertsAndTheirReferencesToNeighbourVerts[e.v1] references.append(e.v2) vertsAndTheirReferencesToNeighbourVerts[e.v1] = references for e in edges: try: if e.v2.sel == 1: vertsAndTheirReferencesToNeighbourVerts[e.v2] except: vertsAndTheirReferencesToNeighbourVerts[e.v2] = [e.v1] else: if e.v2.sel == 1: references = vertsAndTheirReferencesToNeighbourVerts[e.v2] references.append(e.v1) vertsAndTheirReferencesToNeighbourVerts[e.v2] = references #calculate references of neighbour verts to selected verts amountOfReferencesOfNeighbours = {} for vert, references in vertsAndTheirReferencesToNeighbourVerts.iteritems(): for r in references: if r in amountOfReferencesOfNeighbors: amountOfReferencesOfNeighbours[r] = 1 else: #syntax error here! amountOfReferencesOfNeighbours[r] += 1 print amountOfReferencesOfNeighbours #select those that have 2>= references #split them to groups that do not surpass selected verts by seeking paths #form selections recursively until verts can no longer can be selected #ask the user which group to select? me.update() if inEmode: Window.EditMode(0) Window.EditMode(1) Blender.Redraw()