The Blender API is a little quirky. You have to either be in OBJECT mode or use bmesh to select or deselect vertices and edges.

Let’s start with a cube, in EDIT mode, with everything deselected.

start box

To select a vertex, one way is to change to OBJECT mode, select the vertex, and change back to EDIT mode.

#change to OBJECT mode
bpy.ops.object.mode_set(mode="OBJECT")

#deselect the 0th vertex
bpy.data.meshes['Cube'].vertices[0].select = True

#change to back to EDIT mode
bpy.ops.object.mode_set(mode="EDIT")

selected vertex

Deselect works very similarly:

bpy.ops.object.mode_set(mode="OBJECT")

#deselect the 0th vertex
bpy.data.meshes['Cube'].vertices[0].select = False

bpy.ops.object.mode_set(mode="EDIT")

And we’re back to the start.

start box

Selecting an edge uses the same principle:

bpy.ops.object.mode_set(mode="OBJECT")

#select the 0th edge
bpy.data.meshes['Cube'].edge[0].select = True

bpy.ops.object.mode_set(mode="EDIT")

selected edge

Deselecting that edge is quite a bit different. You can’t just use:

bpy.data.meshes['Cube'].edge[0].select =False

You have to deselect the vertices of an edge first, and then deselect the edge.

bpy.ops.object.mode_set(mode="OBJECT")

bpy.data.meshes['Cube'].vertices[0].select = False
bpy.data.meshes['Cube'].vertices[1].select = False
bpy.data.meshes['Cube'].edges[0].select = False

bpy.ops.object.mode_set(mode="EDIT")

Occasionally, when switching the mode to deselect doesn’t work (like if you have non-manifold edges selected), or if you want to stay in edit mode, you can use bmesh.

Let’s start with a box with once face removed and non-manifold edges selected
( bpy.ops.mesh.select_non_manifold())

non manifold edges

bpy.ops.object.mode_set(mode="EDIT")
mesh = bmesh.from_edit_mesh(bpy.context.object.data)
mesh.verts[2].select = False #the vertices are indexed differently
mesh.verts[3].select = False
mesh.edges[0].select = False

deselected edge for non manifold

Ta da! The bottom edge is deselected.

Blender 2.71

Last day!

I didn’t attend as many talks as I did yesterday, mostly ’cause I’m feeling under the weather.

Sniffles

Those that I did go to were AMAZING!

Favorite quotes from the conference:

There is a special place in hell for women who don’t help other women. ~ Madeleine Albright

Heads up to all the employers: there is a legion of women who *will* be negotiating their salaries, so budget accordingly. ~ Ruthe Farmer

Every time you don’t ask, you make it harder for every other woman to ask. ~ Matt Wallaert

I absolutely loved Grace Hopper. It’s probably my favorite of out the ones I’ve been to this year.

Hope I get to come back next year!

Leaving this here for inspiration and nostalgia:

The day started out SO GOOD!

Shafi Goldwasser presented on crypto. All those zero knowledge interactive proofs and homomorphic encryption made me really miss computer science.

Adversay

I loved how she used the Count to represent the computationally bounded adversary.

I then went to a presentation by Jamika and Rachel and a workshop by Denise, both of which were AMAZING.

Denise

Denise

Next up is dinner with Google for all their travel grant winners.

nom nom nom

Usually I’m super exhausted by the first day of conferences, but not so for Grace Hopper. I’m still super energetic/excited for tomorrow!