Hi,
I remember a topic like this before. I suggest you take a look.
Automatic Beam Dimension - #4 by Durmus_Cesur