Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeffii <tetha.z@gmail.com>2017-08-26 15:12:10 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-09-04 16:12:05 +0300
commit626ae77773797effa7a8a9bf44cac070a1ee179b (patch)
treedd2ee775855573071f3548189ca7c46e7be68a5b
parent2e72cfeaaca9992c94ef3343f9c8a2940c47b76e (diff)
update e2f code for non-intersection scenario
-rw-r--r--mesh_tiny_cad/E2F.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/mesh_tiny_cad/E2F.py b/mesh_tiny_cad/E2F.py
index 984d5035..8c95f126 100644
--- a/mesh_tiny_cad/E2F.py
+++ b/mesh_tiny_cad/E2F.py
@@ -27,6 +27,17 @@ from mathutils.geometry import intersect_line_plane
def failure_message(self):
self.report({"WARNING"}, 'select 1 face and 1 detached edge')
+def failure_message_on_plane(self):
+ msg2 = """\
+Edge2Face expects the edge to intersect at one point on the plane of the selected face. You're
+seeing this warning because mathutils.geometry.intersect_line_plane is being called on an edge/face
+combination that has no clear intersection point ( both points of the edge either touch the same
+plane as the face or they lie in a plane that is offset along the face's normal )"""
+ lines = msg2.split('\n')
+ for line in lines:
+ self.report({'INFO'}, line)
+ self.report({"WARNING"}, 'No intersection found, see the info panel for details')
+
def extend_vertex(self):
@@ -37,7 +48,7 @@ def extend_vertex(self):
faces = bm.faces
planes = [f for f in faces if f.select]
- if (len(planes) > 1) or (len(planes) == 0):
+ if not (len(planes) == 1):
failure_message(self)
return
@@ -60,15 +71,19 @@ def extend_vertex(self):
plane_no = plane.normal
new_co = intersect_line_plane(v1, v2, plane_co, plane_no, False)
- new_vertex = verts.new(new_co)
- A_len = (v1 - new_co).length
- B_len = (v2 - new_co).length
+ if new_co:
+ new_vertex = verts.new(new_co)
+ A_len = (v1 - new_co).length
+ B_len = (v2 - new_co).length
+
+ vertex_reference = v1_ref if (A_len < B_len) else v2_ref
+ bm.edges.new([vertex_reference, new_vertex])
+ bmesh.update_edit_mesh(me, True)
- vertex_reference = v1_ref if (A_len < B_len) else v2_ref
- bm.edges.new([vertex_reference, new_vertex])
+ else:
+ failure_message_on_plane(self)
- bmesh.update_edit_mesh(me, True)
class TCEdgeToFace(bpy.types.Operator):