If node ignores test results

Any idea why the if return as True no matter what the test result is?

The IF node expects equal number of arguments fed into each input port

Thanks Vikram,

So I’ve tried to overcome this by passing a list with my points as sub-lists but still no good!?

Your test list is not as long as the lists fed into true and false

Let me try to explain this. Consider you have…

  • A list (A) of 5 points fed into the true port

  • Another list (B) of 5 points fed into the false port

Then you will need a list of 5 booleans to be fed into the test port

If the boolean list is {true,true,true,false,false}

Then the resulting list will be a list comprising of the first 3 elements from list (A) and the next 2 elements from list (B)

I think I understood that, therefore I did create a single lists fed into the true and false but it seems that it is still recognizes the length of the sub-lists as not equal!

Note the use of curly braces and the list structure in the example below…

In your case you can introduce a List.Create node

20160512-4a

Thanks Vikram, I twisted my mind differently and it worked!

My case was that I need to reduce the number of a curve point, which is given and I don’t know how many, by removing even indices but keeping the last item if the total count is even!

I don’t know if this this the best solution but it worked.

 

The If node works in an extremely specific (and sometimes very annoying) way. As Vikram tried to explain, it works on a single object level.

If you feed in lists of different length, the logic behind it breaks down and the result is limited to the shortest list. If you’re trying to work on a list level and are trying to pass lists of varying length, you might be better served by a python node or an imperative function.

2016-05-13_11-52-55

Thanks you guys for helping!

Unfortunately I don’t know much either python or imperative functions! however I tried the imperative code block method and it worked although I managed to use the IF node but at a later stage where I pass single curve products out of my two points lists.

You could also try the scopeif-node, but that node has it’s limitations too. Looks like they are looking into this: https://github.com/DynamoDS/Dynamo/issues/6258