# How can I modify this Code Block to work with a group or list of curves?

Hello everyone.

I would like to ask how can I work this script for a list of curves:

``````//Base Curve
c1;
//Number of Divisions
n*10;
//Scale Wave Extent
w = 180;
//Scale Wave Height
h = 0.5;
//Points on Curve
p1 = c1.PointAtParameter(0..1..#n);
//Normal at Points
n1 = c1.NormalAtParameter(0..1..#n);
//Scale wrt Base Curve Length
s = c1.Length/(Math.PiTimes2*w);
y = Math.Sin(0..360*w..#n) * (h..0.1..#n) * s;
p2 = p1.Translate(n1,y);
//Nurbs Curve
c2 = NurbsCurve.ByPoints(p2);
``````

If I use directly the list of curves, I get an unique curve instead the curves created from each curve individually.

Thanks a lot

You have to set up lacing. Some functions require cross product lacing, but code blocks default to auto just like regular nodes. Read more about lacing in the primer:

If the link doesn’t take you there automagically, scroll down to the ‘How About Lacing?’ section.

Here is your fixed code block:

``````//Base Curve
c1;
//Number of Divisions
n*10;
//Scale Wave Extent
w = 180;
//Scale Wave Height
h = 0.5;
//Points on Curve
p1 = c1<1>.PointAtParameter(0..1..#n<1>);
//Normal at Points
n1 = c1<1>.NormalAtParameter(0..1..#n<1>);
//Scale wrt Base Curve Length
s = c1.Length/(Math.PiTimes2*w);
y = Math.Sin(0..360*w..#n<1>) * (h..0.1..#n<1>) * s<1>;
p2 = p1<1>.Translate(n1<1>,y<1>);
//Nurbs Curve
c2 = NurbsCurve.ByPoints(p2);
``````
1 Like

Great. Your answer will make my future scripts easier. Thanks a lot.

another option is wrap this in a function:

``````def coolfunc (c1:Curve, n:var, h:var){
//do stuff
return c2
}
``````