8
$\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$

2 Answers 2

11
$\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$
1
  • $\begingroup$ I like this because it doesn't seem to require the weird mode changing of my answer. $\endgroup$
    – MrFlamey
    Commented Nov 10, 2015 at 15:39
6
$\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$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .