2
$\begingroup$

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)

enter image description here

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)

$\endgroup$
7
  • 1
    $\begingroup$ Perhaps you're adding duplicate vertices, where the v2 of one edge is also the v1 of the next one? $\endgroup$ Commented Apr 1, 2020 at 11:37
  • $\begingroup$ @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? $\endgroup$ Commented Apr 1, 2020 at 11:45
  • 1
    $\begingroup$ That can be overlapping meshes. But the provided code can't run properly and you provide too few information about the input lines. $\endgroup$
    – lemon
    Commented Apr 1, 2020 at 13:03
  • 3
    $\begingroup$ 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? $\endgroup$
    – Bruno
    Commented Apr 1, 2020 at 14:18
  • $\begingroup$ @Bruno I think you've got it. Rookie mistake, really. $\endgroup$ Commented Apr 1, 2020 at 16:27

1 Answer 1

3
+50
$\begingroup$

Look like you are creating 2 new vertices per line, that's creating disjointed segments. Instead, just create a new vertex, then the new edge between the previous vertex and the new one, etc...

$\endgroup$

You must log in to answer this question.

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