Python script to align object to edge or two vertex coordinates I want to align an object to an edge via Python.
I have an edge in the 3D space, the edge has a rotation, euler or quaternion, like a 3d object, but this edge is part of an object.
I want to copy the rotation of the edge to a external object (like a cylinder).

This seams like what I want, but the result doesn't work.
Align Object to Vector using python
I've found the solution. To align to edge direction, you can use the script in this link: Align Object to Vector using python

But for the vector you must use Vector = Vector2 - Vector1 where the Vector1 e Vector2 are the coordinates in vector of the verts of the edge.