Dynamic blocks to Infraworks

I have managed to do it without python and inelegantly but i’m still learning.

Next question is how do I filter the dynamic block based on their visibility state. The block in question has 6 states, each of those states has a rotation parameter, single post is single, double post is double etc in order to extract the correct rotation i need to be able to match which rotation parameter I use. The only way I can think of doing this is with a nested if statement like:

So something like if signs (the visibility state) = single post then use single (rotation parameter) if signs - double post then use double etc.

I expect it is possible with python and loops (?) but i dont know python well enough to create the code.