algorithmic modeling for Rhino
Here's a version in C#, which assumes your inputs are "c" (a curve) and "d" (a list of double values).
double sumDist = 0;
double crvLen = c.GetLength();
List<Point3d> ptList = new List<Point3d>();
for (int i = 0; i < d.Count; i++){
sumDist += d[i];
if (sumDist > crvLen) break;
ptList.Add(c.PointAtLength(sumDist));
}
A = ptList;
Note that if you're trying to do this for a straight line, I would recommend taking a unitized vector, multiplying it by the distance you need, and adding that to a base point.
Here is the C# script for serial summation, such that the input list {1, 2, 3, 4} would result in {1, 3, 6, 10}.
private void RunScript(List<double> L, object y, ref object A)
{
List<double> Result = new List<double>();
for (int i = 0; i < L.Count; i++) {
if (i == 0) {
Result.Add(L[i]);
} else {
Result.Add(L[i] + Result[i - 1]);
}
}
A = Result;
}
Remember to set the input L as list of double.
Hi,
thank you a lot for yours help.
I will watch them with very carefull.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by