# Update Edge Info when using script in Edit Mode

I'm editing a mesh using a script, while in Edit Mode. I need to display the Edge Angles while editing, but these don't get updated until I leave and re-enter Edit Mode.

Is there a function I can call to force updating the displayed Edge Angles while staying in Edit Mode?

Minimal example (slightly edited from "Bmesh Simple Editmode":

# This example assumes we have a mesh object in edit-mode

import bpy
import bmesh

# Get the active mesh
obj = bpy.context.edit_object
me = obj.data

# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)

bm.faces.active = None

# Modify the BMesh, can do anything here...
bm.verts[0].co.x -= 1.0

# Show the updates in the viewport
# and recalculate n-gon tessellation.
bmesh.update_edit_mesh(me, True)


• 2.78.5 2.79 - in this versions I haven't this problem. Maybe you need to update Blender? – Crantisz Jan 22 '18 at 14:58
• @batFINGER have you tried official blender build from blender.org? – Crantisz Jan 23 '18 at 9:53
• @Crantisz no I haven't, I choose to build from source. Prepared to assume there is a possibility Jake has official version, and if so, would be tempted to file a bug report. – batFINGER Jan 23 '18 at 10:09
• @batFinger: Thanks for the info. I'm currently using an official Blender 2.78c build on Linux 64bit. I'll give the official 2.79 version a shot tonight, and file a bug report if the behaviour is still there. – Jake Jan 23 '18 at 10:19
• @batFINGER for bug report you need to know what versions has this. Now I have no idea about that. – Crantisz Jan 23 '18 at 11:06

Need to update the normals.

Thanks to the information in the invalid bug report the angle info needed requires the face normals. This can be achieved by calling Bmesh.normal_update()

# This example assumes we have a mesh object in edit-mode

import bpy
import bmesh

# Get the active mesh
obj = bpy.context.edit_object
me = obj.data

# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)

bm.faces.active = None

# Modify the BMesh, can do anything here...
bm.verts[0].co.x -= 1.0

# recalculate normals.
bm.normal_update()
bmesh.update_edit_mesh(me, True)


or by calling BMFace.normal_update() for each affected face. Simple example on all faces.

# recalculate normals.
for f in bm.faces:
f.normal_update()


PS. not the normal avenue to come to a solution, and apologies for suggesting the dud bug report. (Another Doh moment on reading bug report lol)

I'm trying to guess why you need to stay in edit mode. If it isn't critical you can add,

bpy.ops.object.editmode_toggle()
bpy.ops.object.editmode_toggle()


(both lines) before the call to update. This is essentially doing in code what you do manually in the gif - flipping from object back to edit mode to update the display of length values.

Updating the 3d view is also covered in this answer here