# Is there a way to clear sharp edges using bmesh in python?

I'm trying to speed up an addon that had to toggle into Edit Mode for sometimes thousands of object by staying at the object level using bmesh instead of object.editmode_toggle().

Is there any operation to clear sharp edges without having to enter Edit Mode for each object?

• – kheetor May 2 '18 at 8:37

You can set use_edge_sharp flag per edge on MeshData.edges in Object Mode:

import bpy

obj = bpy.context.object

# Clear sharp state for all edges
for edge in obj.data.edges:
edge.use_edge_sharp = False


If there is no way around Bmesh for whatever reason, you can set the smooth state of all edges to True in Edit Mode:

import bpy
import bmesh

obj = bpy.context.object
me = obj.data
bm = bmesh.from_edit_mesh(me)

# Clear sharp state for all edges
for edge in bm.edges:
edge.smooth = True

# Update the mesh
bmesh.update_edit_mesh(me, False, False)

• While this is not the requested bmesh solution, this should be faster due to not requiring the bmesh conversion. If your workflow has bmesh conversion anyway, you can use this before or after the bmesh part, not during. – kheetor May 2 '18 at 8:40
• Yeah, absolutely right, should be indeed way faster without the conversion... Thanks @kheetor – brockmann May 2 '18 at 9:10
• Thanks. I'm going to experiment with different methods and see which combination of approaches works the fastest. The main method that I could only get with bmesh or toggling into edit mode was limited dissolve. I think there are other ways to do this as well, since I think it is mostly removing/merging colinear edges and coplanar faces. – dpdp May 2 '18 at 13:22