How to use Code Block to process a formula base on if else

Hi everyone, I am a beginner in using dynamo 1.3 for Revit 2016.
I am trying to use dynamo to relocate the tag elbow position.
But it needs to use difference formula for four quadrants.

Seems the Code Block can not process the a list of number.

I also do a Python version but still unable to input lists

Can someone please point out my error?
Thank You very much.

@JamesHYW You can try something like this with Python:

toList = lambda x : x if hasattr(x, '__iter__') else [x]

a1s = toList(IN[0])
b1s = toList(IN[1])
a2s = toList(IN[2])
b2s = toList(IN[3])
xs = toList(IN[4])
ys = toList(IN[5])

OUT = []

for a1,b1,a2,b2,x,y in zip(a1s,b1s,a2s,b2s,xs,ys):
	if a2>a1 and b2>b1 or a2<a1 and b2<b1:
1 Like

@AmolShah Thank you so much, you save my day :man_bowing:

It’s well past time to upgrade! This version of Revit hasn’t been supported for 3 years; There are multiple security vulnerabilities and limitations published which are not patched (because out of support); consulting teams will have a hard time finding a valid installer and hardware to run the tool on as licensing only goes 3 versions back (2019) and the last supported OS stopped being sold about 3 years ago; AND you’re at risk of losing data if the model corrupts as my colleagues in support may not be able to help.

Upgrading shouldn’t cost you anything as the efficiency gains will pay for the downtime. Not upgrading could cost you a LOT more.


In designscript, no need for an imperative-statement:

a2>a1 && b2>b1 || a2<a1 && b2<b1 ? x+y : y-x ;