Nesting IFs

hi everyone I’m trying to use nesting IFs to handle more conditions to change the value of parameter “b col” according to the values of parameters “GROUND HEIGHT” & “BASEMENT HEIGHT”
to be like this
if(or(BASEMENT HEIGHT>500,GROUND HEIGHT>500),30,20)))

thank you in advanced

1 Like

When getting into more complex conditional statements it is definitely a lot simpler if you use Python.

B_height = IN[0]
G_height = IN[1]

if B_height >= 470 and G_height <= 470: OUT = 20
elif B_height <= 500 or G_height <= 500: OUT = 25
elif B_height > 500 or G_height > 500: OUT = [30,20]

I’ve made an assumption that you wanted a list output on the final condition that contains 30 & 20 but feel free to change the code if that was wrong.


@janbarsoum using DS with a Code Block:


thank you so much for your help, I’m trying your solution but output is false value, I feel like I’m doing something wrong, the value is supposed to be 20 not 30

@janbarsoum what is the output of the Element.GetParameterValueByName node?
Careful to use Elements.Type node or ʳʰʸᵗʰᵐ|Elements.GetParameterValueByNameTypeOrInstance to get the type parameters value.(archilab or Rhythm pacakges)

1 Like

Hi @janbarsoum, I have replicated your code and it is returning 20 for me as expected if I input the parameter values of 470 and 300 as integers.

As @Elie.Trad mentioned it would be worthwhile you using ʳʰʸᵗʰᵐ|Elements.GetParameterValueByNameTypeOrInstance since you are trying to access Type Parameters and showing us the output of the nodes.


@Elie.Trad & @haganjake2 yes you’re right, now it works perfect
thank you so much for your help.

1 Like