tichy
(tichy)
June 24, 2022, 7:10pm
1
Hi, The DOC here - https://docs.blender.org/api/current/bpy.types.Curve.html - says:
eval_time
Parametric position along the length of the curve that Objects ‘following’ it should be at >(position is evaluated by dividing by the ‘Path Length’ value)
So it is evaluating the evaltime by dividing by the ‘Path Length’ … Who and Where is getting the Path Length from?
I am desperatly in th need of the Path length for a script…
Any Clues?
Spline length perhaps?
import bpy
OBJ = bpy.data.objects["NurbsPath"]
for s in OBJ.data.splines:
print(s.calc_length())
tichy
(tichy)
June 25, 2022, 8:41pm
3
Ok, this is something. However, I am under the Impression this is not incorperating the curvature of the path.
Might this be the case?
But thank so far, this is a huge step!
tichy
(tichy)
June 25, 2022, 9:47pm
5
here is the code, it works.
Select a Path and run the script.
It will print the Path´s length in the console.
import bpy
import bmesh
context = bpy.context
baseObject = context.active_object
copy = bpy.ops.object.duplicate(linked=False)
bpy.ops.object.convert(target='MESH')
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.select_all(action='SELECT')
me = context.active_object.data
bm = bmesh.from_edit_mesh(me)
path_length = 0
for e in bm.edges:
if e.select:
path_length = path_length + e.calc_length()
print("length",path_length)
bpy.ops.object.editmode_toggle()
bpy.ops.object.delete()
bpy.context.view_layer.objects.active = baseObject
baseObject.select_set(True)