IF Condition!

Hello,

I am having some bad time using “IF” node, I get to it two lists of points, the first is with “Six points inside” and the other is “four points only” and I used Boolean to use true and false, and both cases the IF statement give me four points only (true or false i choose same result - four points!!)

If you want to return one of the two lists, why not try something like this?

test ? [a,b][0] : [a,b][1] ;

Idea is to run the test, and then perform the function of getting the first list from the combined set of options if true, or the second list from the combined set of options of false.

Thanks Jacob, it still giving me 4 items both cases, I need in case of True to return the list with four items, and if it is false to return the list of 6 items? see images dear and thanks in advance

and why when I tried that in Dynamo 1.33 it was not working dear Jacob, Do I tried to replace the aquare brackets with curly ones but not luck?

thanks

this is on Dynamo 1.33, as i thought it need curly brackets, but yet not giving me the 6 points list any way :slight_smile:IN Dynamo 1

Ah - my bad. You need to do this in separate lines.

Try this:

Test ? indx = 0 : indx = 1;
lst = [a,b][indx];
1 Like

ToF = IN[0] # a boolean
List1 = IN[1]
List2 = IN[2]

Result =

if ToF == True:
Result.append(List1)
else:
Result.append(List2)

flattened1 = [item for sublist in Result for item in sublist]

I used Python instead, even the script was giving me errors
error
is because I use Dynamo 1? I tried it in Dynamo 2 and was OK, the IF condition is always a head ache in Dynamo wish they gonna fix it specially when it complex to complex geo or listing.

Any way thanks Jacob, you are a great gentleman!! thanks
Firas S. Noori
Instructor - Department of Architecture - Ajman University
UAE

Try this:
https://forum.dynamobim.com/t/if-then-run-tools/33681.
I think then, you should be good to go.
Instead of an empty list, you can just input the other one.

1 Like