Hi,
I am trying to retrieve a segment of a shattered curve following a basic set of rules,
The code seams to work, and all the if statement do get triggered, but it only outputs the segment itself in one of the cases.
Is it something related to the curve being a reference type?
I wrote the same logic in python and it behaves the same way…
Maybe the mistake is so obvious, I’ll add it here, otherwise there is a gh file in annex,
Thanks in advance for helping,
private void RunScript(
List<Curve> Crvs,
List<object> t,
ref object Crv,
ref object i)
{
// Write your logic here
Console.WriteLine(Crvs.Count());
if (Crvs.Count() == 3)
{
Console.WriteLine("Case 3 triggered");
Crv = Crvs[1];
i = 1;
Console.WriteLine(Crv.GetType());
}
if (Crvs.Count() == 2)
{
if (t[0] == null)
{
Crv = Crvs[0];
i = 0;
}
else
{
Crv = Crvs[1];
i = 1;
}
}
else
{
Crv = null;
i = null;
}
}
Output segment from Curve list.gh (29.7 KB)