# edges.new - Edges Not Adding Correctly (black not solid orange)

I'm using a python script to create edges.

For some reason, my script is recognizing some edges, displayed in solid orange. Others are not recognized the same and are displayed in black. (see image)

When I manually select two of the verticies on a black line and hit f the edge is added correctly and displays orange. This is specifically a problem because I cannot face-->fill the shape until all the edges are displaying as orange.

I'm adding the edges like this:


class Graphics:

def __init__(self,bm):

def drawLoop(self, bm, lines):
for i in lines:
self.drawLine(bm, i.p1tuple(),i.p2tuple())

def drawLine(self, bm, tup1, tup2):
v1 = bm.verts.new(tup1)
v2 = bm.verts.new(tup2)
bm.edges.new((v1, v2))


My Main is like this:

import bpy
import bmesh
import sys

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

graphics = Graphics(bm)

bmesh.update_edit_mesh(obj.data)


• Perhaps you're adding duplicate vertices, where the v2 of one edge is also the v1 of the next one? – Robert Gützkow Apr 1 '20 at 11:37
• @RobertGützkow I thought that might be possible. Though I'm not sure how to test for it or how to fix it. I've tried removing doubles to no effect. I should also mention that the parts of the shape are built at different points in the program. If that makes a difference? – bigcodeszzer Apr 1 '20 at 11:45
• That can be overlapping meshes. But the provided code can't run properly and you provide too few information about the input lines. – lemon Apr 1 '20 at 13:03
• Look like you are creating 2 new vertices per line. Unless I am mistaken... you are creating disjointed segments. Instead, shouldn't you just create a new vertex, then the new edge between the previous vertex and the new one? – Bruno Apr 1 '20 at 14:18
• @Bruno I think you've got it. Rookie mistake, really. – bigcodeszzer Apr 1 '20 at 16:27