Skip to main content
edited tags
Link
Ray Mairlot
  • 29.4k
  • 12
  • 105
  • 126
added code
Source Link

I would like to bevel some of the edges of my object. I tried this code (works but is not consistent)

bm.edges.ensure_lookup_table()
ebd = [
        {'idx': 20, 'profile': 0.5, 'offset': 0.005, 'segments': 10},
    ]

# first get the edges
for i in range(len(ebd)):
    ebd[i]['edge'] = bm.edges[ebd[i]['idx']]

# bevel each edge
for i in range(len(ebd)):
    e = ebd[i]['edge']
    bev_geom = [e.verts[0], e.verts[1], e]
    p = ebd[i]['profile']
    o = ebd[i]['offset']
    s = ebd[i]['segments']
bmesh.ops.bevel(bm, geom=bev_geom, offset=o, segments=s, profile=p)

I noticed that the index number of the edges changes. So every time I run this code another edge is bevelled. maybe I do something wrong idk. What I did noticed is that the vertex number is the same every time I insert the object. So I was wondering and could not find any on the forum so far that shows me how to select an edge based on 2 vertices. Or how I can select the edges I want and then bevel them so that every time I insert the object the correct edges are bevelled.

Another code I tried is

    indices1 = [3, 15]
    vertices = [e for e in bm.verts]
    v_edges = []
    for vert in vertices:
        if vert.index in indices1:
            vert.select = True
            v_edges = v_edges + [vert]         
        else:
            vert.select = False 

bmesh.ops.bevel(bm, 
                #bev_geom=v_edges,
                geom = v_edges,
                offset=0.005, 
                segments=10, 
                profile=0.5
                )

This will obviously select 2 vertices. Can Can i use these 2 vertices to select the edge between them?

Regards

I would like to bevel some of the edges of my object. I tried this code (works but is not consistent)

bm.edges.ensure_lookup_table()
ebd = [
        {'idx': 20, 'profile': 0.5, 'offset': 0.005, 'segments': 10},
    ]

# first get the edges
for i in range(len(ebd)):
    ebd[i]['edge'] = bm.edges[ebd[i]['idx']]

# bevel each edge
for i in range(len(ebd)):
    e = ebd[i]['edge']
    bev_geom = [e.verts[0], e.verts[1], e]
    p = ebd[i]['profile']
    o = ebd[i]['offset']
    s = ebd[i]['segments']
bmesh.ops.bevel(bm, geom=bev_geom, offset=o, segments=s, profile=p)

I noticed that the index number of the edges changes. So every time I run this code another edge is bevelled. maybe I do something wrong idk. What I did noticed is that the vertex number is the same every time I insert the object. So I was wondering and could not find any on the forum so far that shows me how to select an edge based on 2 vertices. Or how I can select the edges I want and then bevel them so that every time I insert the object the correct edges are bevelled.

Another code I tried is

    indices1 = [3, 15]
    vertices = [e for e in bm.verts]
    v_edges = []
    for vert in vertices:
        if vert.index in indices1:
            vert.select = True
            v_edges = v_edges + [vert]         
        else:
            vert.select = False

This will obviously select 2 vertices. Can i use these 2 vertices to select the edge between them?

Regards

I would like to bevel some of the edges of my object. I tried this code (works but is not consistent)

bm.edges.ensure_lookup_table()
ebd = [
        {'idx': 20, 'profile': 0.5, 'offset': 0.005, 'segments': 10},
    ]

# first get the edges
for i in range(len(ebd)):
    ebd[i]['edge'] = bm.edges[ebd[i]['idx']]

# bevel each edge
for i in range(len(ebd)):
    e = ebd[i]['edge']
    bev_geom = [e.verts[0], e.verts[1], e]
    p = ebd[i]['profile']
    o = ebd[i]['offset']
    s = ebd[i]['segments']
bmesh.ops.bevel(bm, geom=bev_geom, offset=o, segments=s, profile=p)

I noticed that the index number of the edges changes. So every time I run this code another edge is bevelled. maybe I do something wrong idk. What I did noticed is that the vertex number is the same every time I insert the object. So I was wondering and could not find any on the forum so far that shows me how to select an edge based on 2 vertices. Or how I can select the edges I want and then bevel them so that every time I insert the object the correct edges are bevelled.

Another code I tried is

    indices1 = [3, 15]
    vertices = [e for e in bm.verts]
    v_edges = []
    for vert in vertices:
        if vert.index in indices1:
            vert.select = True
            v_edges = v_edges + [vert]         
        else:
            vert.select = False 

bmesh.ops.bevel(bm, 
                #bev_geom=v_edges,
                geom = v_edges,
                offset=0.005, 
                segments=10, 
                profile=0.5
                )

This will obviously select 2 vertices. Can i use these 2 vertices to select the edge between them?

Regards

Source Link

best way to select edge to use bmesh.ops.bevel

I would like to bevel some of the edges of my object. I tried this code (works but is not consistent)

bm.edges.ensure_lookup_table()
ebd = [
        {'idx': 20, 'profile': 0.5, 'offset': 0.005, 'segments': 10},
    ]

# first get the edges
for i in range(len(ebd)):
    ebd[i]['edge'] = bm.edges[ebd[i]['idx']]

# bevel each edge
for i in range(len(ebd)):
    e = ebd[i]['edge']
    bev_geom = [e.verts[0], e.verts[1], e]
    p = ebd[i]['profile']
    o = ebd[i]['offset']
    s = ebd[i]['segments']
bmesh.ops.bevel(bm, geom=bev_geom, offset=o, segments=s, profile=p)

I noticed that the index number of the edges changes. So every time I run this code another edge is bevelled. maybe I do something wrong idk. What I did noticed is that the vertex number is the same every time I insert the object. So I was wondering and could not find any on the forum so far that shows me how to select an edge based on 2 vertices. Or how I can select the edges I want and then bevel them so that every time I insert the object the correct edges are bevelled.

Another code I tried is

    indices1 = [3, 15]
    vertices = [e for e in bm.verts]
    v_edges = []
    for vert in vertices:
        if vert.index in indices1:
            vert.select = True
            v_edges = v_edges + [vert]         
        else:
            vert.select = False

This will obviously select 2 vertices. Can i use these 2 vertices to select the edge between them?

Regards