title: Blender Bevel tool on selected edges scripting problem
body: <p>In Blender, my attempt (see code below) to python script BEVEL on selected edges with the BEVEL tool (not the modifier) fails: All selected and non-selected edges are beveled.</p>
  <p>What I want :
  <a href="https://i.stack.imgur.com/Ol5XS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ol5XS.png" alt="What I want" /></a></p>
  <p>What I get:
  <a href="https://i.stack.imgur.com/9IeI8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9IeI8.png" alt="What I get" /></a></p>
  <p>Question 1: why?</p>
  <p>Question 2: Is there a way to apply the beveler by script without using operators (ops) depending on the context?</p>
  <p>Thank you.</p>
  <p>Code that does not work:</p>
  <pre><code>def selectEdgesAlongX(mesh):
      &quot;&quot;&quot;Select all edges of an object directed along X&quot;&quot;&quot;
      bm = bmesh.new()
      bm.from_mesh(mesh)
      edges, verts = bm.edges, bm.verts
      verts.ensure_lookup_table()
      for edge in bm.edges:
          indices = (edge.verts[0].index, edge.verts[1].index)
          vs=[verts[index].co for index in indices]
          edge.select = abs((vs[1]-vs[0])[0])&gt;1e-4
      bm.to_mesh(mesh)
      bm.free()
      
  def printSelectedEdges(mesh):
      print([edge.select for edge in mesh.edges])
      
  # box
  dims = (depth,height, width) = (0.4,0.6,1)
  thickness, radius = 0.05, 0.05
  center =(0,0,0)
  
  bpy.ops.mesh.primitive_cube_add(size=1,enter_editmode=False, align='WORLD', location=center, scale=np.array(dims)/2-thickness)
  interior = bpy.context.view_layer.objects.active
  interior.name='interior'
  
  printSelectedEdges(interior.data)
  selectEdgesAlongX(interior.data)
  printSelectedEdges(interior.data)
  bpy.ops.object.editmode_toggle()
  bpy.ops.mesh.bevel(offset=0.03, offset_pct=0,segments=10, affect='EDGES')
  </code></pre>
  <p>print outputs:
  <a href="https://i.stack.imgur.com/j0OxV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j0OxV.png" alt="print outputs" /></a></p>