# How to randomly (with a checkered pattern) select a number of faces in a mesh?

I have an isosphere with 4k polygon. How do I delete only 2000 random polygons but not deleting adjacent of deleted polygon?

EDIT -- clarification

Imagine a chessboard, let say white = stay, black = to be deleted. The minimum distance between 2 nearest black is white (which is same distance of black). As @DavidS. puts it, "checkered pattern selection"

However, out of 4k, I'd like to delete half of it.

• What do you mean by but not deleting adjacent of deleted polygon? If you want to remove half of the polys, with that condition, wouldn't it be a checker pattern selection you really need? – David S. Dec 5 '13 at 12:48
• @DavidS. I'd like to delete faces randomly, but not the selected polygon cannot be next to each other. "Checkered pattern selection" is the shortest distance between polygons that needs to be deleted. Good you brought up there. – ikel Dec 5 '13 at 19:42
• You could try the Checker Deselect operator, select everything, then run it from Select menu. – CoDEmanX Dec 5 '13 at 21:15

Go to the icosphere's Edit mode with Face selection, execute Select > Random, set Percent to 50%:

It won't select exactly 50% of the faces, but close enough that only a few additional manual (de)selection is needed. Then execute Delete X > Only Faces.

You can see exactly how many faces were selected by looking at the Info view header

I use this occasion to learn BMesh, and come up with this script:

import bpy
import bmesh

obj = bpy.context.object
prev_mode = obj.mode
bpy.ops.object.mode_set(mode='OBJECT')
bm = bmesh.new()
bm.from_mesh(obj.data)

bm.faces[0].select = True
selected_edges = list(bm.faces[0].edges)
for face in bm.faces:
sl = [(edge in selected_edges) for edge in face.edges]
if any(sl):
continue
selected_edges.extend(face.edges)

face.select = True
print('*' * 10)

bm.to_mesh(obj.data)
bpy.ops.object.mode_set(mode=prev_mode)


Unlike Checker Deselect mentioned by @CoDEmanX, it only selects less than half of the faces in an icosphere. I think those strips can't be selected without breaking the non-adjacency requirement:

• More than 4 years with Blender, I never knew this! Superb! But I wonder, if there is a way to avoid manually de-selecting face. 500 polys I can handle, but dealing with 2k/4k, might take up my whole lunch break. – ikel Dec 5 '13 at 19:55
• @ikel: In several test runs, Select Random never settles at exactly the stated percentage. For 5-subdiv icosphere (5120 faces) it always select on average 50 faces more (or less). I didn't realize you have extra requirement; not-so-random selection would require a bit of scripting, I suppose. – Adhi Dec 5 '13 at 20:13
• I understand with percentage of selection, it can never be exact, but I can live with that. I just clarified my requirement this morning after receiving a comment from DavidS. – ikel Dec 5 '13 at 20:22