# Set Bezier curve handles

Hi guys, I want to create a bezier curve and set the handles in a way so that the direction and length form a straight line like that with Python

I know the points of the curve, stored them in a list a Vector-objects. The bezier curve is created already and has the correct number of splits.

Here is the first idea (produces wrong size and direction):

``````# Set the points and the handles to the same vector
for index, point in enumerate(curve_shape.get_points()):

bez_points[index].co = point

bez_points[index].handle_right = bez_points[index].co

bez_points[index].handle_left = bez_points[index].co

# Find the direction of the following vector, normalize it (???) and add it to the previous vector
for index in range(len(curve_shape.get_points()) - 1):

v1 = bez_points[index].co

v2 = bez_points[index + 1].co

bez_points[index].handle_right = v1 + self.get_direction(v1, v2)

bez_points[index].handle_left = v1 + self.get_direction(v1, v2).orthogonal()

def get_direction(self, v1, v2):

dir = v2 - v1

return dir.normalized()
``````

Any idea for a solution? Thx in advance