If node not working correctly

Hello all,

So I am trying to get an If node to work correctly, however it doesn’t look like it’s working. I am writing a graph that will create floor plan and ceiling plan views automatically. The problem is that when I use an If node to determine if a ceiling plan has been selected to create as well as a floor plan, the results are not accurate. If I only select a ceiling plan, then that works fine. If I select both a ceiling and floor plan, then only the floor plans work correctly. If I only select a floor plan then the If node results in an empty list. Can anyone look it over for me and see where my logic isn’t correct? The Pink Group is where the If node is located at.

Thank you!

Create Views + Sheets.dyn (151.0 KB)

The If node functions more as a “output this list” node rather than a “do this or that” node.
The easiest way to show this is by starting a blank project and doing this:

In Dynamo the output will be based on the If test. However, in the project browser you’ll find that both plans were created anyway.

Right now the if node outputs either the list of created floor plans or the list of floor plans + ceiling plans, but it’s only serving as a logic gate to choose lists, not perform an action.

As for your three examples, they are somewhat confusing. Notably the screenshot. The filter ‘in’ output is an empty list, implying this is your ‘Only a floor plan’ example. If that is the case, the CeilingPlan.ByLevel node should have flagged yellow due to array rank reduction. The fact that it doesn’t suggests something weird is going on, but I don’t have the time at the moment to pick up the packages and run the actual dyn.

Hello @Robert_Younger,

Thanks for your input. I actually just bypassed the need to use the If node by just duplicating the rest of the graph for both ceiling plans and floor plans.

In future try the Pythonic If function maybe. I know they’re ‘fixing’ this node in 2022 soon though, saw a post the other day about if.

OUT = IN[1] if IN[0] else IN[2]

That should work for a python block where if/then/else and the first/second/third inputs. The output will be the one that passes to any length of list/structure.