is it possible to get access to a bezier curve with python in blender to get the length of the curve?
I think for some modifiers Blender knows (or calculates) the lenght of the curve, so the length of the curve should be somewhere.
The question is now how to get this information?
import mathutils
>>> mathutils.geometry.interpolate_bezier(
interpolate_bezier(knot1, handle1, handle2, knot2, resolution)
.. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution)
Interpolate a bezier spline segment.
:arg knot1: First bezier spline point.
:type knot1: :class:`mathutils.Vector`
:arg handle1: First bezier spline handle.
:type handle1: :class:`mathutils.Vector`
:arg handle2: Second bezier spline handle.
:type handle2: :class:`mathutils.Vector`
:arg knot2: Second bezier spline point.
:type knot2: :class:`mathutils.Vector`
:arg resolution: Number of points to return.
:type resolution: int
:return: The interpolated points
:rtype: list of :class:`mathutils.Vector`'s
depending on the resolution you decide, it will return that number of points on the curve. More points is higher accuracy. Then stick something like this in there.
# takes interpolated points as an argument
def get_combined_length(p_list):
edge_length = 0
for idx in range(len(p_list)-1):
edge_length += (p_list[idx] - p_list[idx+1]).length
return edge_length
maybe you can figure the rest out
>>> bpy.data.curves['BezierCurve'].splines[0].bezier_points[0]. (ctrl+space to autocomplete)
will give you enough information, but it might end up looking something like this
Thanks for this Information, ist Looks a Little bit more complicated than i thought.
I was more hoping, that the length is already given some where… Something like: