Align vertices along vector (Python) I have a vector and vertices, and I'm trying to align the vertices to that vector using 'Translation Matrix', unfortunately multiplying the matrix with the vertices' coordinates do not change anything.

here is the code:

import bpy
import bmesh
import mathutils
import math

msh = bpy.context.object.data
mesh = bmesh.from_edit_mesh(bpy.context.active_object.data)

vec = mathutils.Vector((0.7071, -0.7071, 0.0, 1.0))
trans = mathutils.Matrix.Translation(vec)

m1 = mesh.verts.new((1, 0, 0))
m2 = mesh.verts.new((1.5, 0, 0))
m3 = mesh.verts.new((2, 0, 0))

m1.co = m1.co * trans
m2.co = m2.co * trans
m3.co = m3.co * trans

bmesh.update_edit_mesh(msh)




Thanks in advance.
Unit direction vector. 

Suggest doing this without the transform matrix. The direction vector

&gt;&gt;&gt; d = Vector((1, -1, 0))


can be normalized, ie have a length of one, to 

&gt;&gt;&gt; d.normalize() # in place normalize
Vector((0.7071067690849304, -0.7071067690849304, 0.0))


Now, given a source location point p can move from p x units in the direction d using

new_loc = p + x * d  # x is a scalar.


In the context of your original question

import bpy
import bmesh
from mathutils import Vector

me = bpy.context.object.data
bm = bmesh.from_edit_mesh(me)

p = Vector() # using origin as source point.

vec = Vector((1, -1, 0))  # direction vector
d = vec.normalized()  # unit direction vector

newverts = [bm.verts.new(p + x * d) for x in (1, 1.5, 2)]

bmesh.update_edit_mesh(me)