4
$\begingroup$

There is an operator to select sharp edges, and an operator to select edges marked as sharp if you have already an edge marked as sharp selected, but is there a way to select edges marked as sharp when you have nothing selected?

Maybe add a temporary edge, mark it as sharp, select similar, delete temporary edge? I don't know how to do that though.

I can see that bmesh.types.BMEdge has a seam attribute, but no sharp(?). So I guess it's not possible to loop through edges selecting the ones marked as sharp...

$\endgroup$
6
$\begingroup$

There isn't a single command for this, but a script to do this is quite simple:

Note that with BMesh, the same smooth option is used for faces and edges (not smooth == sharp).

import bpy
import bmesh

obj = bpy.context.edit_object
me = obj.data

bm = bmesh.from_edit_mesh(me)
for e in bm.edges:
    if not e.smooth:
        e.select = True

bmesh.update_edit_mesh(me, False)
$\endgroup$
  • $\begingroup$ I like this because it doesn't seem to require the weird mode changing of my answer. $\endgroup$ – MrFlamey Nov 10 '15 at 15:39
2
$\begingroup$

You can use the 'use_edge_sharp' parameter of the Mesh type like this:

import bpy

def select_sharp_edges():
    bpy.ops.object.mode_set(mode='OBJECT')
    me = bpy.context.object.data

    for e in me.edges:
        if e.use_edge_sharp:
            e.select = True

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

select_sharp_edges()

Oddly, this doesn't select the edges unless you are in object mode, which is quite annoying. I guess object.data changes depending on the current mode. You should also be able to easily get the edges by something like:

sharp_edges = [e for e in me.edges if e.use_edge_sharp]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.