Multiple translation with combination and if condition

I’ve got lots of problems with my script. I’m trying to do this:

  • There are three (or more) solids (a,b,c)
  • I calculate the distance between them (for all the possible combinations: distance ab, ac and bc)
  • I set an if condition to say: “if the distance that the node “object.distance” have calculated is <5 and >0 then translate one of the two solids (whose reciprocal distance respect the condition) in order to attach them”

For exemple:
distance ab=4
distance ac=0
distance bc= 6

for the distance ab the if node read “4” so it must transate a to b or b to a for the distance calculated (4)
for the distance bc the if node read “0” so do nothing
for the distance bc the if node read “6” so do nothing

I attach my dyn file so you can understand better. The big problem is that I don’t know how to make dynamo understand that it must move only one of the two solid whose distance is <5 and >0. Distances.dyn (56.3 KB)

Thanks to all for help!

It’s still a bit confusing what you are trying to do but you could use conditionals in a code block