Measuring total length and width of building

Hi specialists!

I am currently attempting to make a dynamo script where I need to measure the length and width of the whole building. However, being a somewhat Dynamo greenhorn, I have no idea how to do this.

I tried to search Google, without luck.

Do you have any suggestions?

Kind regards,

Peter