0
$\begingroup$

So I made a bmesh script in python. So far it works but I am stuck at getting the edges and vertices from the face I selected.

Code so far

Make circle

bmesh.ops.create_circle(
    bm,
    #cap_ends=self.cap_ends,
    cap_ends=True,
    segments=32,
    radius=1000,
    #matrix=mat_out1,
    )
edges_circle = bm.edges[:]
faces_circle = bm.faces[:]

bmesh.ops.extrude_edge_only(
bm,
edges=edges_circle)
geom_extrude_mid = ret["geom"]

bmesh.ops.translate(
bm,
verts=verts_extrude_a,
vec=(0.0, 0.0, 150)
)

From here I get stuck

ret = bmesh.ops.inset_individual(
bm, 
faces=faces_circle, 
thickness=250, 
depth=0,
use_even_offset=False, 
use_interpolate=False, 
use_relative_offset=False
)
del ret
faces_inset_a = bm.faces[:]     
bm.faces.ensure_lookup_table()
bm.faces[32].select = True

How can I make an VAR that contains the edges and vertices?

I search google whole day already and could not find any good answer.

Since inset does not give back geom data I cant use

verts_inset_a = [ele for ele in **geom_extrude_mid**
               if isinstance(ele, bmesh.types.BMVert)]
edges_inset_a = [ele for ele in **geom_extrude_mid**
               if isinstance(ele, bmesh.types.BMEdge) and ele.is_boundary]
faces_inset_a = [ele for ele in **geom_extrude_mid**
               if isinstance(ele, bmesh.types.BMFace)
$\endgroup$

2 Answers 2

0
$\begingroup$

You might try

TEST = [v for v in bm.verts if v.select]

This will select the vertices from active selection.

Change bm.verts in bm.edges for the edges of the selected face

$\endgroup$
0
$\begingroup$

Why do you del ret? ret from bmesh.ops.inset_individual is the newly inset faces.

so:

ret = bmesh.ops.inset_individual(
bm, 
faces=faces_circle, 
thickness=250, 
depth=0,
use_even_offset=False, 
use_interpolate=False, 
use_relative_offset=False
)

faces_inset = ret["faces"]

and then:

for f in faces_inset:
   verts = f.verts
   edges = f.edges

you can push those into a list or whatever you want to do with them.

$\endgroup$
4
  • $\begingroup$ Let me try this tomorrow. What I noticed is that the outer faces are in the new bmesh.ops.inset_individual and not the inner. Maybe I was doing something wrong but that was the result I got earlier. I need to inner face and not the outer. $\endgroup$
    – Peget
    Nov 14, 2021 at 19:59
  • $\begingroup$ This way does indeed gives back the outer faces of the inset not the one that is created. Do you know how to get the inner face? See screenshot I need to get the one that is selected in the screenshot snipboard.io/UOxIsM.jpg The bpy command is bpy.ops.mesh.inset(thickness=0.135652, depth=0, use_outset=False, use_select_inset=False) $\endgroup$
    – Peget
    Nov 15, 2021 at 16:34
  • $\begingroup$ isn't the inset face the one you started with? The only new faces are the outer faces, but the inset face should be the original. $\endgroup$ Nov 16, 2021 at 4:36
  • $\begingroup$ You can prove this by running the inset twice with the same faces=faces_circle. you can see that faces_circle is the inset face. $\endgroup$ Nov 16, 2021 at 4:51

You must log in to answer this question.

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