[Bf-extensions-cvs] [63ec844] master: Fix T49533: Archimesh does not display all dimensions when last wall closes room

Antonioya noreply at git.blender.org
Sun Oct 2 20:14:26 CEST 2016


Commit: 63ec8445d1b320f8e26dd16bfff0798ffd6ee8cb
Author: Antonioya
Date:   Sun Oct 2 20:13:59 2016 +0200
Branches: master
https://developer.blender.org/rBA63ec8445d1b320f8e26dd16bfff0798ffd6ee8cb

Fix T49533: Archimesh does not display all dimensions when last wall closes room

When the end of the last wall was equal to the close wall, the
dimensions were not displayed.

The problem was related with the precision in the point calculation.

Some code cleanup was done too.

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

M	archimesh/achm_gltools.py
M	archimesh/achm_room_maker.py

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

diff --git a/archimesh/achm_gltools.py b/archimesh/achm_gltools.py
index aaddbea..89e2954 100644
--- a/archimesh/achm_gltools.py
+++ b/archimesh/achm_gltools.py
@@ -155,7 +155,7 @@ def draw_line(v1, v2):
 # -------------------------------------------------------------
 def draw_room_data(myobj, op, region, rv3d, rgb, rgbw, fsize, wfsize, space, measure, dspname):
 
-    verts, activefaces, activenormals = get_wall_points(myobj)
+    verts, activefaces, activenormals = get_wall_points(myobj, op)
 
     # --------------------------
     # Get line points and draw
@@ -175,7 +175,7 @@ def draw_room_data(myobj, op, region, rv3d, rgb, rgbw, fsize, wfsize, space, mea
         # Top
         for e in face:
             if verts[e][2] != 0:
-                if verts[a1][0] == verts[e][0] and verts[a1][1] == verts[e][1]:
+                if round(verts[a1][0], 5) == round(verts[e][0], 5) and round(verts[a1][1], 5) == round(verts[e][1], 5):
                     a2 = e
                 else:
                     b2 = e
diff --git a/archimesh/achm_room_maker.py b/archimesh/achm_room_maker.py
index e0206d8..92f3c55 100644
--- a/archimesh/achm_room_maker.py
+++ b/archimesh/achm_room_maker.py
@@ -970,7 +970,7 @@ def get_hight(verts, faces_4, faces_3, face_index, face_num):
 # ------------------------------------
 # Sort list of faces
 # ------------------------------------
-def sort_facelist(activefaces, activenormals):
+def sort_facelist(activefaces, activenormals, merge):
     totfaces = len(activefaces)
     newlist = []
     newnormal = []
@@ -985,42 +985,33 @@ def sort_facelist(activefaces, activenormals):
     # -----------------------
     # Look for first element
     # -----------------------
-    flag = False
-    for x in range(1, totfaces):
-        if flag is False:
-            idx = 0
-            for face in activefaces:
-                c = 0
-                for i in face:
-                    if i == 0 or i == 1:
-                        c += 1
-                    # avoid close
-                    if i > 3:
-                        c -= 1
-
-                if c >= 2 and face not in newlist:
-                    newlist.append(face)
-                    newnormal.append(activenormals[idx])
-                    flag = True
-                idx += 1
+    idx = 0
+    for face in activefaces:
+        c = 0
+        for i in face:
+            if i == 0 or i == 1:
+                c += 1
+
+        if c >= 2 and face not in newlist:
+            newlist.append(face)
+            newnormal.append(activenormals[idx])
+            break
+        idx += 1
 
     # -----------------------
     # Look for second element
     # -----------------------
-    flag = False
-    for x in range(1, totfaces):
-        if flag is False:
-            idx = 0
-            for face in activefaces:
-                c = 0
-                for i in face:
-                    if i == 2 or i == 3:
-                        c += 1
-                if c >= 2 and face not in newlist:
-                    newlist.append(face)
-                    newnormal.append(activenormals[idx])
-                    flag = True
-                idx += 1
+    idx = 0
+    for face in activefaces:
+        c = 0
+        for i in face:
+            if i == 2 or i == 3:
+                c += 1
+        if c >= 2 and face not in newlist:
+            newlist.append(face)
+            newnormal.append(activenormals[idx])
+            break
+        idx += 1
 
     # -----------------------
     # Add next faces
@@ -1043,8 +1034,9 @@ def sort_facelist(activefaces, activenormals):
 # ------------------------------------
 # Get points of the walls
 # selobject: room
+# rp: roomproperties
 # ------------------------------------
-def get_wall_points(selobject):
+def get_wall_points(selobject, rp):
     obverts = selobject.data.vertices
     obfaces = selobject.data.polygons
 
@@ -1096,7 +1088,8 @@ def get_wall_points(selobject):
     # ------------------------
     # Sort faces
     # ------------------------
-    newlist, newnormal = sort_facelist(activefaces, activenormals)
+    newlist, newnormal = sort_facelist(activefaces, activenormals, rp.merge)
+
     return verts, newlist, newnormal
 
 
@@ -1111,7 +1104,7 @@ def add_shell(selobject, objname, rp):
     myvertex = []
     myfaces = []
 
-    verts, activefaces, activenormals = get_wall_points(selobject)
+    verts, activefaces, activenormals = get_wall_points(selobject, rp)
 
     # --------------------------
     # Get line points



More information about the Bf-extensions-cvs mailing list