# Unexpected result from “bm.faces.new(verts)”

I'm trying to use "faces.new()" to fill a hole in mesh, Strangely when I use the function the newly create face looks like this: Code:

import bpy, bmesh

obj = bpy.context.object.data
bm = bmesh.from_edit_mesh(bpy.context.active_object.data)

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

bm.faces.new(v)
bmesh.update_edit_mesh(obj)


• Check the normals and directions of the normals. Recalculate if needed with Ctrl+N whilst on edit mode – Reuben Tilahun Aug 17 '18 at 22:26
• @ReubenX Checked the normals and recalculated it, but no difference. – user48739 Aug 18 '18 at 9:03

The contextual create operator.

Rather than calculate the winding order to create face with bm.faces.new(verts) let the operator do it for you.

bmesh.ops.contextual_create

Contextual Create.

This is basically F-key, it creates new faces from vertices, makes stuff from edge nets, makes wire edges, etc. It also dissolves faces.

Three verts become a triangle, four become a quad. Two become a wire edge.

import bpy
import bmesh

ob = bpy.context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)

verts = [v for v in bm.verts if v.select]
bmesh.ops.contextual_create(bm, geom=verts)

bmesh.update_edit_mesh(me)


The order that vertices are listed when defining the face, determines the order that they are connected. This tutorial can help explain it.

Say we have four vertices to make a face, with indexes of 0,1,2,3 going clockwise.

bm.faces.new([v, v, v, v])


will give you the bowtie effect that you have, while

bm.faces.new([v, v, v, v])


will give you the square face you are expecting.

I expect the only way to automate this is to walk around the selection to determine the connected order. A vertex lists what edges it creates in link_edges, from vert an edge that includes another selected vert gives you the second vert, then that vert has an edge with another selected vert...