Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/04/2011 at 10:22, xxxxxxxx wrote:
Hi,
I'm testing the SplineHelper class functions. But for some reason GetSegmentCount() always returns the value of one. Even though my spline has multiple segments. Any idea what I'm doing wrong here?:
import c4d from c4d import gui def main() : sh = c4d.utils.SplineHelp() sh.InitSpline(op, rail=None, target_rail=True, use_deformed_points=True, force_update=True, use_global_space=True) segCount = sh.GetSegmentCount()#Counts the total number of segments segLength = sh.GetSegmentLength(0)#Gets the length of the first segment totalLenght = sh.GetSplineLength()#Gets the length of the entire spline print segCount print segLength print totalLenght if __name__=='__main__': main()
-ScottA
On 11/04/2011 at 11:16, xxxxxxxx wrote:
It returns '2' here which is the correct value. This is the spline I've tested:
Cheers, Niklas
On 11/04/2011 at 12:01, xxxxxxxx wrote:
Doh!
I guess I got confused about how these classes decide what a "segment" is. After looking through my Coffee notes. I realized that what I was trying to do required using the SplineLengthData class. Not the SplineHelp class.
Like this:
import c4d from c4d import gui def main() : length = c4d.utils.SplineLengthData(op[0])#Creates a new instance of the SplineLengthData class length.Init(op,0)# Initializes the spline object(op) and the first spline segment print(length.GetLength())# The Spline's Length print(length.GetSegmentLength(0,1))#The first segment's length length.Free()#free up the memory used by the new SplineClass instance if __name__=='__main__': main()