Breakdown of Lauf um die Grube herum, nicht an dem Bagger vorbei!
nicht
not
an
at, on (vertical) / to (addressee) / of (in quantity/stock expressions)
laufen
to walk / to run (steady pace, jog)
um
around
Questions & Answers about Lauf um die Grube herum, nicht an dem Bagger vorbei!
Why do we need both um and herum in the first half of the sentence?
In German, directional movements often use a two-part preposition. While um alone can mean "around", adding herum at the end of the phrase emphasizes the physical, continuous path of moving in a circle around the object (die Grube).
Why does die Grube stay in the accusative case, but der Bagger changes to the dative case (dem Bagger)? Don't both actions involve movement?
They do both involve movement, but the specific preposition dictates the case. The preposition um always requires the accusative case. However, the two-part preposition an ... vorbei always requires the dative case, which is why the masculine noun der Bagger becomes dem Bagger.
Why is the object sandwiched in the middle of an ... vorbei? Can I just say vorbei dem Bagger?
No, you cannot. To say you are going "past" something, German uses the two-part phrase an [something] vorbei. The object you are passing must always go between an and vorbei.
Could I combine an dem into am in this sentence?
Yes! It is very common and completely natural to say nicht am Bagger vorbei. Keeping them separate as an dem is also perfectly correct and might just be used to slightly emphasize that specific excavator.