Get The width and Height of a ship

Hello Everyone, First, Sorry for my English but it’s not my natal language.
So, I need your help, I wan’t to create a Hyperspace teleporter for my server (With a window like in Stargate) but to make the window to the same size of the ship, I need to get back the width and height of this ship, so How can we do that ? If my players make their own ships with SBEP Parts … I doesn’t know what are the ship size at the end. So If you know a function or has an algorithm for that, I thank you before.

Cordialy, Matspyder.