Nudity - Autonomy
Unless disabled in settings, Sims can undress on their own when the situation allows for it.
Every so often Sim will attempt to undress by checking if they are not doing anything important and if they have high enough Naturism or Exhibitionism skill level to do it.
In addition, Sims will check for children on the lot and avoid undressing if there are any (unless the lot type is a bar or a club), as well as check for other nude Sims which will encourage them to undress.
All of this alters Sims chance of undressing from 5% to as high as 30%-40% and each failed attempt increases the chance by 1%.
Sim with a successful attempt will always try to undress the top half of the outfit first.