[Bf-extensions-cvs] [8df8fb0] blender-v2.78-release: bugfix for T49593: _gen_meshface removes points from a 3DFACE or SOLID if the they share the same location. This was a good a idea but it was not implemented completely. Now it is: faces with overlapping verts get imported as edges if the remaining geometry has only 2 verts. This allows the user to easily select all edges if extraction is needed to make it visible in a rendering. (e.g. select one edge and then choose Select > Select Similar > Amount of connecting edges).

Lukas Treyer noreply at git.blender.org
Wed Oct 19 14:43:07 CEST 2016


Commit: 8df8fb0342874b2c76c488df081c34d57f17c643
Author: Lukas Treyer
Date:   Tue Oct 11 11:12:27 2016 +0200
Branches: blender-v2.78-release
https://developer.blender.org/rBA8df8fb0342874b2c76c488df081c34d57f17c643

bugfix for T49593: _gen_meshface removes points from a 3DFACE or SOLID if the they share the same location. This was a good a idea but it was not implemented completely. Now it is: faces with overlapping verts get imported as edges if the remaining geometry has only 2 verts. This allows the user to easily select all edges if extraction is needed to make it visible in a rendering. (e.g. select one edge and then choose Select > Select Similar > Amount of connecting edges).

===================================================================

M	io_import_dxf/dxfimport/do.py

===================================================================

diff --git a/io_import_dxf/dxfimport/do.py b/io_import_dxf/dxfimport/do.py
index 4b73eaa..66551f5 100644
--- a/io_import_dxf/dxfimport/do.py
+++ b/io_import_dxf/dxfimport/do.py
@@ -493,21 +493,26 @@ class Do:
         verts = []
         for p in points:
             verts.append(bm.verts.new(self.proj(p)))
-        face = bm.faces.new(verts)
 
-        if len(points) == 4:
-            for i in range(2):
-                edge1 = verts[i].co
-                edge2 = verts[i + 1].co
-                opposite1 = verts[i + 2].co
-                opposite2 = verts[(i + 3) % 4].co
-                ii = geometry.intersect_line_line(edge1, edge2, opposite1, opposite2)
-                if ii is not None:
-                    if _is_on_edge(ii[0]):
-                        bm.faces.remove(face)
-                        iv = bm.verts.new(ii[0])
-                        bm.faces.new((verts[i], iv, verts[(i + 3) % 4]))
-                        bm.faces.new((verts[i + 1], iv, verts[i + 2]))
+        # add only an edge if len points < 3
+        if len(points) == 2:
+            bm.edges.new(verts)
+        elif len(points) > 2:
+            face = bm.faces.new(verts)
+
+            if len(points) == 4:
+                for i in range(2):
+                    edge1 = verts[i].co
+                    edge2 = verts[i + 1].co
+                    opposite1 = verts[i + 2].co
+                    opposite2 = verts[(i + 3) % 4].co
+                    ii = geometry.intersect_line_line(edge1, edge2, opposite1, opposite2)
+                    if ii is not None:
+                        if _is_on_edge(ii[0]):
+                            bm.faces.remove(face)
+                            iv = bm.verts.new(ii[0])
+                            bm.faces.new((verts[i], iv, verts[(i + 3) % 4]))
+                            bm.faces.new((verts[i + 1], iv, verts[i + 2]))
 
     def the3dface(self, en, bm):
         """ f: dxf entity



More information about the Bf-extensions-cvs mailing list