This should read the level and type and set them accordingly:
I know Andreas has a nice node to read the host element of a window or door. Not sure if the API has a call for picking a new host… You might need to recreate the windows and doors just like the walls.
Edit: You’re lucky :p. There’s a really easy way to re-host all those windows and doors:
-Select all the windows and doors from the Revit UI
-Copy them all
-Delete the original walls. That will delete the doors and windows but don’t worry - you have them saved in your clipboard.
-Do a “Paste:Aligned to Same Place”(the one from the arrow under paste). That will place the doors and the windows and they will automatically assume the new walls as hosts.