printLen in api?

I mistakenly thought pathLen was printLen but can’t find the method for the length of a curve.

The only sign of the curve length I found is here:
http://projects.blender.org/pipermail/bf-python/2005-January/002234.html
In jan. 2005, Campbell Barton posted this patch, but it doesn’t seem to be in version 2.43. Is it under a different name? He calls it “getLen” in the patch. If not, is there a workaround?

This may not be the right place to post this, but this forum seems most connected.

OOps, google didn’t pick it up, but this thread:
http://blenderartists.org/forum/showthread.php?t=69156&highlight=printlen
explains that the patch (maybe the one above?) doesn’t work right? Seems like it should be doable since the printLen button works? Converting to a mesh won’t give as accurate results…

Two thoughts on the patch. If the path doesn’t exist it should be calculated?

+			if(!cu->path)
+				calc_curvepath(amd->curve_ob);

printLen returns local results, so as explained in another thread, ctrl-a = “Apply scale/rotation” must be done first.

Thanks,
F.

very bad way is to get the curve as a mesh and add up its edge lengths.

I wrote this function into python a long time ago but it wasnt always relyable, not sure why. but thats why it didnt get in.

The patch looks good to me, it sure would be useful.

I wonder if accessing “self->curve->path->totdist” without checking it’s existence might not be the cause of the problem - might result in a seg. fault? It seems it’s possible this “path” object isn’t always created?

+	if( strcmp( name, "len" ) == 0 )
+		attr = PyFloat_FromDouble( self->curve->path->totdist );

I’d be willing to test a version with this patch, but I don’t think I’m up to recompiling all of blender to test it.

Thanks for the quick reply!
F.