How can deduct the length of door opening from the room boundary?

I’ve checked your script…the approach is valid but your are making it more complicated… i do not know whats your end goal in doing this but i assumed two things :

i hope this helps