"Decompound wall layers

Hi guys.
I have i question, ¿is it possible to “decompound” wall layers from the original wall?
What im trying to do is to convert wall layers into walls from the original one, NOT to create new walls and NOt to create parts, so my doors and windows wont be deleted.
This script creates a new walls from layers but when i delete the original wall (element) doors and windows are also deleted so this affects doors and walls quiantiiies, any ideas?