Moves the cursor if there's an intersection, else prints message.
import bpy import bmesh from mathutils.geometry import intersect_line_line as LineIntersect class CAD_prefs: VTX_PRECISION = 1.0e-5 VTX_DOUBLES_THRSHLD = 0.0001 def coords_tuple_from_edge_idx(bm, idx): ''' bm is a bmesh representation ''' return tuple(v.co for v in bm.edges[idx].verts) def get_intersection_from_idxs(bm, idx1, ixd2): ''' > takes reference to bm and 2 indices < returns intersection or None ''' p1, p2 = coords_tuple_from_edge_idx(bm, idx1) p3, p4 = coords_tuple_from_edge_idx(bm, idx2) a, b = LineIntersect(p1, p2, p3, p4) if (a-b).length < CAD_prefs.VTX_PRECISION: return a obj = bpy.context.active_object me = obj.data bm = bmesh.from_edit_mesh(me) me.update() edges = [e for e in bm.edges if e.select] idx1, idx2 = [edge.index for edge in edges] pt = get_intersection_from_idxs(bm, idx1, idx2) if pt: print(pt) bpy.context.scene.cursor_location = pt else: print("no intersection")