DesignScript For Loop

I was following this post about Design Script for loops but my code continues to fail and I’m trying to track down the cause. I’m not sure if this is a dynamo version issue or if I’m doing something wrong. I’m on REVIT 2018.3 on Dynamo 2.0.2. It’s frustrating because this is straightforward in other programming languages but it hasn’t been easy in Design Script. The function is suppose to loop a surface by perimeter points over the number of points. The part that’s cut off reads “Surface.ByPerimeterPoints([ends[i], starts[i], starts[i+1], ends[i+1]]);” I’m assuming I need to amend the list with a function? Or is it how I listed the points with brackets?

temphelp%20march

I always try to avoid to use loops, 99% of the times you can do it without it in Dynamo.
I guess you need to create surfaces between lines, taking the start/end points of them.

Here both ways :wink:

start;
ends;

[Imperative]
{
	srf = [];
	for (i in 0..(List.Count(ends)-2))
	{
		srf[i] = Surface.ByPerimeterPoints([start[i],ends[i],ends[i+1],start[i+1]]);
	}
	return = srf;
};

SurfaceLines

7 Likes

Thanks for taking the time to write both out. It’s a good resource for the forums.