Hi,
I cant understand why its throwing this exception.I understand the index is too high, for my tree, thats why I was checking it with the pathExists methode.
It has to be very simple, I am already spending too much time without understanding.
maybe someone could point it out for me. I would be really grateful.
private void RunScript(DataTree<Mesh> x, ref object A)
{
var tBases = new DataTree<Mesh>();
for (var i = 0; i < 151; i++)
{
var path = new GH_Path(i);
if (x.PathExists(path))
tBases.AddRange(x.Branch(path));
}
A = tBases;
}
My guess is that PathExists expects a path, but you are giving an index, so it is a method that find for DataTree.Paths[i] and call PathExists(path) inside its body. In your case, āiā is not a path, is a index of a path, and it can be out of range if your index is larger that the size of the collection. You are expecting to get new GH_Path(index) but you are getting DataTree.Paths[index].