I want to fill the holes of a mesh created from a curve programmatically, so my idea was to select the first and last edgeloop with Python
And then execute a fill.
So my question is: How to select the first and last ring of the mesh in code?
Thx
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.
Sign up to join this communityContextual Create operator
For the case given, simply finding all the boundary edges and spitting into contextual create operator ngon fills the edge loops
The edges of the returned faces are the original edge loops Use to fill other than ngon.
import bpy
import bmesh
context = bpy.context
ob = context.object
me = ob.data
bm = bmesh.from_edit_mesh(me)
ret = bmesh.ops.contextual_create(bm,
geom=[e for e in bm.edges if e.is_boundary])
# the seperate edge loops
edge_loops = [f.edges[:] for f in ret["faces"]]
# if don't like the ngon fill then do something here
# eg remove face
# grid fill edge loops,
# poke face for tri fan.
bmesh.update_edit_mesh(me)
Similarly with the edge loop fill operator
ret = bmesh.ops.edgeloop_fill(bm,
edges=[e for e in bm.edges if e.is_boundary])
edge.is_boundary
$\endgroup$