Dynamo Point Coordinate Grafting Problem



Hello all,

New forum user here - looking forward to getting to know the community.

I have a problem that I just can’t seem to work my way around - I’m quite fluent in grasshopper but have made the switch to Dynamo and am having some problems that I think are solvable, just can’t quite find the logic to make it work.

I have a custom node written (quite large and complex) that takes 8 inputs (x and y coordinates of 4 points). I’m using optimo to optimize an objective, so the custom node is serving as a function. When I plug in a list of 8 numbers, it works great and spits out the correct results. However, when I try to input more than one “tree” of data (i.e. a list of 2 x-coord, 2 y-coord by 4 points, 16 numbers total) I get a “null” return. In grasshopper, the solution to this is just to graft the tree so it essentially runs the function for the first 8 numbers then runs it again for the next 8 numbers - no problem. I can’t get it to work out though in Dynamo, and because I’m trying to use Optimo to optimize, inputting one generation isn’t too helpful. Any advice on data manipulation to be able to get the function to run through for one list, then the next list, then the next list, etc.?

Thanks in advance!


As an example, this list plugged in is functional (8 inputs)


While this list plugged in is not functional. The input method is correct I believe, but to no avail. Any advice is greatly appreciated!


I know it’s annoying to refer to “how-to-get-help-on-the-dynamo-forums”, but this is a community relying on other users spare time, so please provide as much information and material as needed for saving as much time as possible for those who might want to help you.

From paragraph 3…
"Don’t expect that people will recreate a file based on a screen-shot"



Apologies, I tried to upload my script but it said “New users are unable to upload files”, so I thought a screenshot would be the next best thing. While it looks complex, the problem and question are rather simple and I believe can be understood through the images I provided - it seems to be related to data manipulation and proper input format, not necessarily dependent on the script I have written.


that why this paragraph was added
"There are some limitations for new users. These limitations is set up to defend the community against misusage of the community for file transfer etc. Therefore is it recommendable for new users to provide files etc. using a fileshare services (Dropbox, Google Drive…). New users are accepted to upload files if they show a real user behavior, which entail… entering at least 5 topics, reading at least 30 posts, or spend a total of 10 minutes reading posts."

problem is, that it takes some time to create graphs, and helping someone that provides the proper files, is much easier. You risk nobody takes you question serious and that is a shame for you.


I see. Apologies on the poor forum etiquette, I have not been in the community long and am not fully aware of the standard practice.

That being said, I dropped my script (Truss Optimization Script) along with all the custom nodes (Truss.Optimization is the primary custom node) in the following DropBox link:

All of the other custom nodes in the folder are used in the truss.optimization node as well.

Let me know if there is any other information you can use.


This might be worth a shot:

  1. Upgrade your Dynamo version to 1.3
  2. Change the @List level of the input to the Truss.Optimisation node to L2

In theory, this should behave no differently to your first example (i.e. feeding it a 1D list).



You’re a Godsend - I’m really close now but there’s one more issue - if I plug the list in @L2 like you mentioned I’m getting results for multiple input cases (exactly what I’m looking for), but when I try to use the Function.Apply block, it’s still giving me a null response. The screenshots below should demonstrate the results of what I’m talking about. I also have attached the updated script.

Any advice appreciated! Almost there!


Not Functioning as function input:

Latest Script:
Truss Optimization Script (Optimized).dyn (18.3 KB)


I’m not familiar with whatever package it is you are using so I’m not sure what data type the AssignFitness node takes, but I would try connecting the output from your optimisation node to the FitnessList input as-is. Your Function.Apply node isn’t being used correctly and is effectively redundant (maybe there’s a reason for it due to the package you’re using?)


The package is Optimo, so it’s generating possible lists of data within the range I dictate and evaluating the function provided (in this case Truss.Optimization) at each of those data points. It then does iterates that process several times to find the minimum of the objective - as such, I think the Function.Apply node is necessary (I’ve seen it in every example of Optimo I’ve seen) to “evaluate” your function at the inputted data point.

But what I don’t understand is why I don’t get an error if I plug the data list straight into the node but do get an error if I “evaluate” the function at those points - in my mind it’s the same thing, just evaluating the data through a function input as opposed to inputting it directly.


To clarify, the format that I need the script to work is as a function with variable input (i.e. not just plugging the list directly into the Truss.Optimization node). I need the node to be evaluated with a Function.Apply node in order to work correctly with the rest of the script - my screenshots just show me plugging the list in directly to evaluate and test the system. The problem is now that I can’t get it to run as a function.


It appears that the List.Create node features as opposed to the Function.Apply node based on screenshots here. It would therefore indicate that the fitnessList input expects a 2D list, not a function. Try connecting your List.Create node (the one in the first of your two screenshots above) to this input instead. Looks like you can discard the Function.Apply node (currently you are inputting a list of doubles into an input that expects a function)



Yeah, you’re definitely right that the FitnessList node requires a 2D list. The Fitness Function List, though, requires a function input (because it must run the genetic algorithm many, many iterations). As such, Optimo usually requires you to put your objective in a function (Truss.Optimization in this case) and “evaluate” it many times. Because of that, the Truss.Optimization node must remain a function (as shown in the screenshot below) - to get it into a 2D list, the Function.Apply node is supposed to evaluate that function at the inputs (arguments) I give it.That’s where the problem is - I’m getting null returns when trying to analyze it as a function (screenshot). Function.Apply is supposed to take the Truss.Optimization function and evaluate it, turning it into a 2D list to input into FitnessList.

This is how the script ought to look:


But the Truss.Optimization function isn’t evaluating properly at the Function.Apply node. Which doesn’t make sense to me because it evaluates just fine with direct inputs (see previous pictures).


So I’ve come to the crux of the problem - when running as a function, the function input ignores the list@level. Even if it is set on the input itself, when the actual function passes through at the apply.function command, that list@level is ignored. Because of that the function still ceases to be applied correctly. Any ideas on how to get around that lack of functionality?