diff options
author | Antonioya <blendergit@gmail.com> | 2016-10-02 21:13:59 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2016-10-02 21:13:59 +0300 |
commit | 63ec8445d1b320f8e26dd16bfff0798ffd6ee8cb (patch) | |
tree | d80cd3b596ea7420f7f0fd7627f197f8941a981c /archimesh/achm_room_maker.py | |
parent | fd3566473daf0c72ff87268efddc42fadba6e07d (diff) |
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.
Diffstat (limited to 'archimesh/achm_room_maker.py')
-rw-r--r-- | archimesh/achm_room_maker.py | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/archimesh/achm_room_maker.py b/archimesh/achm_room_maker.py index e0206d80..92f3c555 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 |