I’m getting an index out of range error at line 16.
lineLength = lineLength + charactersLength[i]
I thought that it wouldn’t get out of range because of the while loop with a break. Am I doing something wrong?
Enable Python support and load DesignScript library
import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * charactersLength = IN lineMaxLength= IN lineLength = 0.0 lineNumber = 0 i = 0 while i < len(charactersLength): if i == len(charactersLength): break while lineLength < lineMaxLength: lineLength = lineLength + charactersLength[i] i = i + 1 else: lineNumber = lineNumber + 1 lineLength = 0.0 OUT = lineNumber