Hello Grasshopper comunity,
I would like some help with a grasshopper script that can make this pattern between two curves.
As you can see, whenever the lines reach a length to close to the bottom curve for it to add an additional x value, these start to shorten until the length is equal again to x and ascending again and so on until the end.
Thank you,
Hello
been a bit tricky so I ended using a little C#.
it must work in 3D.
curve divide.gh (9.6 KB)
private void RunScript(List<double> lst_distances, double stepDistance, ref object A)
{
bool isGoingUp = true;//If true increment taking one at each step
double distance = stepDistance;
int increment = 1;
List<double> lst_distancesOutput = new List<double>();
for (int i = 0; i < lst_distances.Count; i++)
{
if (isGoingUp == true)
{
increment += 1;//if true = add 1
}
else
{
increment -= 1;//if true = minus 1
}
distance = stepDistance * increment;
//If difference less than 1 stepDistance => going down
if (Math.Abs(distance - lst_distances[i]) < stepDistance)
{
isGoingUp = false;
}
if (distance > lst_distances[i])//if increment is too big
{
increment -= 1;
isGoingUp = false;
}
if (increment == 1) //If reach 1 => isGoing Up = true
{
isGoingUp = true;
}
lst_distancesOutput.Add(stepDistance * increment);
}
A = lst_distancesOutput;
}
``
1 Like
Oh yeah, I forgot about the stepped pattern… I can see how looping could be very helpful with that.
Your second curve param is not internalized.
laurent_delrieu:
it must work in 3D.
What does that mean? That it should be written to require two (co-planar?) curves at any orientation?
As I use Perpendicular frame and intersection of second curve with this plane it must work in 3d. The example given by George could be simplified if first curve is always going on X direction.
And with curve internalized and some simplifications
Joseph_Oster:
not internalized.
curve divide.gh (10.4 KB)