Rate this as good.
Nate,
The easiest way to do this is to use an undocumented feature. Type
setExpertMode(true)
into the Kernel Command window and restart SystemModeler. This puts WSM into "Expert Mode". In Expert mode a new menu item will appear in the SimulationCenter: File->Export->Source Code.
Export your source code. Note that the Makefile will delete the source files after a make so I suggest editing it and removing the line:
rm -f $(SRCFILES)
or you can do a "make noclean" which will have the same affect.
Warning: Expert mode has undocumented and experimental features and changes the look of the Class Browser. The enabled features are not guaranteed to work and are not guaranteed to remain consistent in future versions. You may want to turn it off after you export your code (although I, personally, have found no harm leaving it on because I use that source code export feature periodically.) Just be aware of the experimental nature of the enabled features.
Regards,
Neil