I expect it will not be possible to automate that, largely because there is no differentiation between the various kinds of drawing objects and things they represent, with everything on the same Layer, some walls and furniture are drawn as Polylines but some as Lines, etc. Here, green are Lines, red are Polylines, yellow are Arcs:

Also, whether there's any hope of automating it or it must be done manually, you need to decide where the outline should really go in relation to the perimeter of a room. For example, you have it going to at least three different places within exterior walls:

to what appears to be a window sill, and what may be the wall surface, and even the face of the glass in the windows. And vertically, some are at the face of the wall, some inside it. Surely whatever the purpose of the outlines, they should be consistent about what defines the area they enclose.
Kent Cooper, AIA