THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/03/2012 at 13:54, xxxxxxxx wrote:
For a bit of trivia in the matter, using the following
in a Py Generator (Optimize Cache Off) will animate
an animated object per frame and generate a spline of the path
and read the total length :)
Cheers
Lennart
import c4d
from c4d.utils import SplineLengthData
def main() :
fps = doc.GetFps()
doctime = doc.GetTime()
currentframe = doctime.GetFrame(fps)
start = doc.GetMinTime().GetFrame(fps)
end = doc.GetMaxTime().GetFrame(fps)
pspline = c4d.BaseObject(c4d.Ospline)
pspline.ResizeObject(end,0)
obj = doc.SearchObject('Cube')# <- Animated Object
for i in xrange(end) :
doc.AnimateObject(obj,c4d.BaseTime(i, fps),c4d.ANIMATEFLAGS_0)
pspline.SetPoint(i,obj.GetAbsPos())
pspline.Message(c4d.MSG_UPDATE)
sld = SplineLengthData()
sld.Init(pspline,0)
tot = sld.GetLength()
print tot
sld.Free()
# Place obj back on track again
doc.AnimateObject(obj,c4d.BaseTime(currentframe,fps),c4d.ANIMATEFLAGS_0)
return pspline