How to change automatically a type family in a nested family


I have a question. How can I set up a nested family to change its type family by itself according to each dimension?

For example if there is one steel beam connecting two columns. Let’s regard that the distance between two columns is 3000 mm and the I change that distance for 5000 mm instead. I’m wondering if that beam could be changed to another beam automatically according to its parameters dimension?

Thank you!