 # Take List of Points in c#, choose some, create curves between them - How to pick the points?

Hi,

I have made a simple c# code to take a curve (my only external input) and then sample some points along that curve according to this code:

List ents = new List();
List entsParams = new List();

``````int entsCount = 4; //ents are entrances

double t0;
double t1;
double dt;

t0 = bound.Domain.Min;
t1 = bound.Domain.Max;
dt = (t1 - t0) / (double) entsCount; //domain of closed curve

for(int i = 0; i < entsCount; ++i) {
double t = dt + i * dt; //t where to place points
entsParams.Add(t);
ents.Add(bound.PointAt(t));
}

A = ents;
``````

Let’s calle Ents my entrances, since that is what they are. I now want to connect curves between my Entrance points, but I do not know how to choose the points from the list in my script and code it properly? Could someone pls help? Attached is my rhino file, and the gh script.

Curves-script.gh (14.2 KB) FinalProject_rsm278.3dm (312.7 KB)

Hello
it is not very clear. I understand you want a curve there are many methods in Rhino to make curve
Polyline pl = new Polyline(List lst_points)
Look at curve methods

I guess what I need to know is how to choose from my list of 8 points, the 2 points I want to make a curve between, in c#. I can do this in Grasshopper by sorting the list, but I cannot figure out how to code it.

If you know the order of the Points,
You can simply call the specific Point by its index like this

``````Point3d entA = ent[index1];
Point3d entB = ent[index2];
//Then You can create Line
Line entLine = new Line(entA, entB);
``````

Thank you! Ths worked. Now is there a way I can have all of my new lines go to the same output? So I do not have to keep adding an output to my component? I.e. I have 5 lines:
entA, entB = l1
entA, entD = l2
entB, entD = l3
entC, entA = l4
entD, entF = l5

I would rather not have to do something like this:
A = l1
B = l2
etc, etc

Is there a way to make them so A = l1, l2, l3, l4, l5? I get errors when I try to do this.

Make a list

``````List<Line> lines = new List<Line>{l1, l2 ...};
A = lines;
``````

or

``````List<Line> lines = new List<Line>();
lines.Add(l1);
..
A = lines;
``````

To show code put 3` (under the 7 on my Keyboard) As @laurent_delrieu Mentioned, you can add all the lines to the list and then output the list.
Also, to help with your beginner programming skills you should learn the essentials.
Use this primer

Its really good and helps you to understand the functional approach.

Thanks so much, it has been helpful today as I do this work.

I have another question. I have now gotten my base curves that you helped with earlier, and have added points on top of them that have been interpolated to make a more interesting shape around the base curve:

I now want to make curves that go through these points.

I tried Curve.CreateInterpolatedCurve(x,y,z), but I cannot figure out how to use the Points I created above.

Thanks again!

Curve.CreateInterpolatedCurve() method takes list of points. So assuming “pp” is the list of points you have, just assign that to the method like this .

``````Curve.CreateInterpolatedCurve(pp);
``````