Monthly Archives: September 2014

selection in Blender

I’d wanted to select a certain mesh object and then edit it, but was getting weird errors, like:

RuntimeError: Operator bpy.ops.mesh.select_all.poll() failed, context is incorrect


RuntimeError: Operator bpy.ops.object.mode_set(mode='EDIT').poll() failed, context is incorrect

I couldn’t find my actual initial code, so here’s me trying to replicate it. All I’m doing is selecting the first cube.

my_object = bpy.context.scene.objects['Cube'] = True

>>> RuntimeError: Operator bpy.ops.mesh.select_all.poll() failed, context is incorrect

Turns out I needed to set the object as the active object and deselect any other object. If the originally selected object was in EDIT mode, I needed to toggle to OBJECT mode before toggling back EDIT mode. Otherwise, bpy.ops.object.mode_set(mode='EDIT') will appear finished but actually fail.

other_object = bpy.context.scene.objects['Cube.002'] = False

my_object = bpy.context.scene.objects['Cube'] = True = my_object




Hope this helps!

*My example snippet can replicate the select_all error, if the original object was in EDIT mode, but I can’t seem to reproduce the edit_mode error. However, I haven’t had any problems after deselecting all other objects and toggling to OBJECT mode before any further operations.

Blender 2.72

It’s been a while since I’ve been this excited about 3D printing news!

Formlabs just posted a blog post yesterday about how they 3D printed a lens for a monocle.

Formlabs Monocle

Monocle frame and lens printed on Form 1+ 3D Printer. Photo by Formlabs.

I’m really curious about its optical resolution. We might be really close to being able to print lenses for glasses!

Time to get back on my 3D Print Your Own Glasses project.