Beispiel #1
0
 def merge(self, other):
     bmv0 = BMElemWrapper._unwrap(self)
     bmv1 = BMElemWrapper._unwrap(other)
     try:
         vert_splice(bmv1, bmv0)
         return bmv0
     except Exception as e:
         print(f'Caught Exception while trying to merge')
         print(e)
         print(f'Will try more robust merge')
         return self.merge_robust(other)
Beispiel #2
0
    def merge(self, other):
        if not (self.is_valid and other.is_valid):
            if self.is_valid: return self
            if other.is_valid: return other
            return None

        try:
            bmv0 = BMElemWrapper._unwrap(self)
            bmv1 = BMElemWrapper._unwrap(other)
            vert_splice(bmv1, bmv0)
            return RFVert(bmv0)
        except Exception as e:
            print(f'Caught Exception while trying to merge')
            print(e)
            print(f'Will try more robust merge')
            return self.merge_robust(other)
Beispiel #3
0
 def merge(self, other):
     # find vert of other that is closest to self's v0
     verts0, verts1 = list(self.bmelem.verts), list(other.bmelem.verts)
     l = len(verts0)
     assert l == len(verts1), 'RFFaces must have same vert count'
     self.rftarget.bme.faces.remove(self._unwrap(other))
     offset = min(range(l),
                  key=lambda i: (verts1[i].co - verts0[0].co).length)
     # assuming verts are in same rotational order (should be)
     for i0 in range(l):
         i1 = (i0 + offset) % l
         bme = next(
             (bme
              for bme in verts0[i0].link_edges if verts1[i1] in bme.verts),
             None)
         if bme:
             # issue #372
             # TODO: handle better
             dprint('bme: ' + str(bme))
             pass
         else:
             vert_splice(verts1[i1], verts0[i0])
Beispiel #4
0
 def merge(self, other):
     # find vert of other that is closest to self's v0
     verts0, verts1 = list(self.bmelem.verts), list(other.bmelem.verts)
     l = len(verts0)
     assert l == len(verts1), 'RFFaces must have same vert count'
     self.rftarget.bme.faces.remove(self._unwrap(other))
     offset = min(range(l), key=lambda i: (
         verts1[i].co - verts0[0].co).length)
     # assuming verts are in same rotational order (should be)
     for i0 in range(l):
         i1 = (i0 + offset) % l
         bme = next((
             bme
             for bme in verts0[i0].link_edges
             if verts1[i1] in bme.verts
         ), None)
         if bme:
             # issue #372
             # TODO: handle better
             dprint('bme: ' + str(bme))
             pass
         else:
             vert_splice(verts1[i1], verts0[i0])
Beispiel #5
0
 def merge(self, other):
     bmv0 = BMElemWrapper._unwrap(self)
     bmv1 = BMElemWrapper._unwrap(other)
     vert_splice(bmv1, bmv0)
Beispiel #6
0
 def merge(self, other):
     bmv0 = BMElemWrapper._unwrap(self)
     bmv1 = BMElemWrapper._unwrap(other)
     vert_splice(bmv1, bmv0)