I've done this. Had a blast in the carriage with two Syrian ladies, two Moroccans and a British gentleman. Not much to do in Casablanca except the Hassan Deux Mosque which should not be missed. Marrakesh was unfortunately like Tijuana with camels, the only part of Morocco I didn't like. How about a side trip from Marrakesh to Essaouira which was still enchanting in 2008? The bus is convenient and cheap and will take you right back to the train station.