# Preserve SystemModeler generated source files?

**URL:** <https://community.wolfram.com/t/preserve-systemmodeler-generated-source-files/12340>\
**Category:** Questions\
**Tags:** import-and-export, system-modeler\
**Created:** [April 18, 2018, 12:51pm UTC](https://community.wolfram.com/t/preserve-systemmodeler-generated-source-files/12340 "2018-04-18T12:51:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![natehollis](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@natehollis](https://community.wolfram.com/u/natehollis)\
**Post date:** [April 18, 2018, 12:51pm UTC](https://community.wolfram.com/t/preserve-systemmodeler-generated-source-files/12340/1 "2018-04-18T12:51:23Z")

</div>

Is it possible to configure SystemModeler to preserve the output source files? By default it generates the source and then purges the files after compilation.

---

<div class="post-metadata">

**Author:** ![neils](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/neils/32/20595_2.png) [@neils](https://community.wolfram.com/u/neils)\
**Post date:** [April 22, 2018, 7:41am UTC](https://community.wolfram.com/t/preserve-systemmodeler-generated-source-files/12340/2 "2018-04-22T07:41:35Z")

</div>

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
