Animation by adding points to a curve, with Python? I’m trying to make an animation by growing a curve.  I have a python script like this, which is based on http://blenderscripting.blogspot.fr/2011/05/blender-25-python-bezier-from-list-of.html

import bpy
from mathutils import Vector

w = 1 # weight
Scale = 0.03

def readCoords(filename):
    with open(filename, 'r') as File:
        Coords = [[float(x) * Scale for x in line.split()] for line in File]
        return list(map(Vector, Coords))

ListOfVectors = readCoords("/Volumes/Stuff/3d/Lorenz/3d-data.txt")

def makePolyLine(objname, curvename, cList):
    curvedata = bpy.data.curves.new(name=curvename, type='CURVE')
    curvedata.dimensions = '3D'

    objectdata = bpy.data.objects.new(objname, curvedata)
    objectdata.location = (0,0,0) #object origin
    bpy.context.scene.objects.link(objectdata)

    polyline = curvedata.splines.new('NURBS')

    for i in range(len(cList)):
        # bpy.context.scene.frame_set(i+1)
        if i &gt; 0:
            polyline.points.add(1)
        x, y, z = cList[i]
        polyline.points[i].co = (x, y, z, w)

makePolyLine("NameOfMyCurveObject", "NameOfMyCurve", ListOfVectors)


Basically I read the coordinates of points from a file, and add them to a curve in sequence.  My question is, how can I animate this process (eg. add 1 point per frame)?  I notice there’s a build modifier, but I want precise control on this, so that I know the exact coordinate of the end of the curve at each frame.
I had this exact same problem a couple of months ago.  The solution irc provided to me was to create a full curve and animate the End Bevel Factor.


The beginning of your curve is bevel_factor=0.  The end of your curve is 1.0.  I am pretty sure it maps from the bevel factor to the index of a control point. So if your curve has 11 points (0..10), then bevel 0.3 will include control points (0..3) .

Consider carefully if you want to animate it with a linear animation curve or the default bezier curve.