I’ve got yet another zerotouch question: how can I first flatten my incoming data and then execute my code for all data at once?
I worked out I could use DSCore.List.Flatten(); to flatten some data, but I don’t know how to implement it. I think I need to flatten my data before executing the code?
Also, could you not rely on the OOTB lacing that the nodes do instead of hard coding the flatten? Or is this not working? The problem with flattening is that the OUT data will not be in the same structure as the data that went in… It will be a flat list.
The goal is to always flatten all outgoing data, because I have no need for those list structures. Even worse: because I use an external API I would that called multiple times, which leads to undesirable behavior (more time consumed, improper functionality, etc.).
What seems to happen (correct me if I’m wrong) is that for each nested list, my code runs the full method:
//Nested list enters here:
public static List<object> TestNode(List<Autodesk.DesignScript.Geometry.Point> DynamoPointList)
{
//do some code
List<object> Return_objects = new List<object>();
return Return_objects;
//Now only the nested list is returned and the method is started over again
}
So I get this behavior if I do not flatten the list manually (either before or after the ‘Elements.Node’ Dynamonode:
Ah, you only have one output for all inputs (regardless of data structure)? in this case, just use the link I sent earlier, this flattens a list (your input list) and you can then operate on the whole of that and return the result.