How to get the distance from one vertex to other vertex along the normal polygon?

I need to get a distance from the vertex to the vertex along the normal of the polygon. Look, I've got a polygon that I want to move to its normal to any too. In this case, I move the polygon with index 36 to the vertex with index 31 to the normals. I just include snapping to the vertex with the closest parameter. I get the distance of 0.3568. How can I reach the distance of 0.3568 between the 30 and 31 vertex using Python?

Use a dot product between the normal and the distance vector for the distance along normal.

import bpy
import numpy as np
from mathutils import Vector

# Use active object and active face in its mesh
ob = bpy.context.object
mesh = ob.data
normal = mesh.polygons[mesh.polygons.active].normal

# v1 is the origin point and v2 is moved to v1 along the active face normal
v1 = mesh.vertices
v2 = mesh.vertices

dvec = v1.co-v2.co
dnormal = np.dot(dvec, normal)

v2.co += Vector(dnormal*normal)
• Thenk very much! Oct 20 '17 at 20:29