Shape-shifting of polymer beams and shells due to oil extraction