when the bell rings, leave the building. If building is a predicate noun?

No, it's a direct object.

The verb is "leave" -- an action verb. Predicate nouns only show up after linking verbs.