I have a list of viewport widths (coincidentally the same value here) which I would like to sum one-by-one until it exceeds the max x-coordinate of my sheet.
I would like the results of: xList[0] + xList[1] xList[1] + xList[2] xList[i] + …
to be output as a list as I intend to use these values to move different viewports up by the iterated distances once I get the loop to work, but currently its giving me an output “Empty Dictionary”
while (viewportW < SheetUMaxX) doesn’t work because viewportW is a list. You need to have a single value to compare which is provided here by currentWidth which is added to with each iteration.
viewportW;
sheetUMaxX = 413.5;
[Imperative]
{
xList = {};
i = 0;
currentWidth = 0;
while (currentWidth < sheetUMaxX)
{
currentWidth = currentWidth + viewportW[i];
xList[i] = currentWidth;
i = i + 1;
}
return xList;
};
You can achieve this in nodes as well…albeit in a slightly more convoluted way.