Can these nodes be simplified?

So the nodes do their job but I can’t code (why I enjoy using Dynamo) so is there a better way for creating a gate where if true it sends list 1 out the top and null out the bottom and for false sends list 2 out the bottom and null from the top.

Not quite sure what you’re after, but have a look here:


This is pretty simple, and certainly isn’t the slowest part of the graph so you may be focusing your attention on the wrong area, but…

Try reversing the null and lists in the second set of if nodes for the warnings and all elements nodes (which appear to be renamed if nodes - more on that later),and then wire your reset graphic overrides node to be the test in each, skipping the intermediate If node entirely. This will send the right info, but in the inverted result as the intermediate if node effectively inverts the value. You could also invert the initial Boolean by using an AllFalse node (Dynamo Dictionary).
Lastly you could expand into coding and try out some design script like this: test ? TrueResult : FalseResult; .
This is an if statement in design script, and the syntax is as follows:

  • test is a true/false Boolean value.
  • TrueResult is the value you want to return if the test is true (in your case ‘false’).
  • FalseResult is the value you want to return if the test was false (in your case true ).
  • The ? indicates the end of the test.
  • The : indicates the end of the true result.
  • The ; indicates the end of the line of code.
    If you go that route, you’ve actually begun writing code (congrats :slight_smile:).

As a side note, I recommend limiting the use of renaming nodes to initiating inputs (could be or are inputs of run by Dynamo Player or Refinery) and terminating watch nodes (could be or are results if run by Dynamo Player or Refinery). This will make it easier to maintain your graph. If I had just $1 for each time I’ve seen someone spend too long downloading packages looking for a node that wound up being an out of the box node that was renamed… this certainly has its place, but a well placed note (ctrl+w) allows for this same information you could capture in renaming the node, and additional logic so that when you reopen a graph 6 months later you can more readily understand what you were thinking back then.

Thank you, this is what I was looking for.

Thank you for the advice, I’ll go back over and use notes instead.

Hi @jacob.small

I’m not sure if this was changed in Dynamo 2.x but using designscript I do not quite get the expected result… (F and G are missing caused by the lacing i guess).

That isn’t been changed, though there are many alternatives which are equally efficient in design script (IE: indx = test? 0 : 1; lst = [lst1,lst2][indx];).

However in this case I read @Peter_Jenkins desire to pass two separate logic strings, one getting the list the other getting nulls and vice versa, not list A or list B (where the lists have differing lengths). :slight_smile: