Integrating external code using file artifacts

July 4, 2018

If you have hand written code that is not large enough to put it in a separate project, however you would like to integrate it with your RTist models, there is an easy-to-use mechanism which is called File Artifacts. A file artifact is a special model element that can be used for storing your C++ code in the model. When building the model, C++ files containing your code are generated from the file artifacts.

Here are the steps how to create a file artifact:

  1. Invoke the context menu on a model or package element and select Add UML – Artifact.
  2. Select the created artifact in the Project Explorer and add code snippets using the Code view or Code editor for the implementation and header.
  3. Configure your transformation configuration to enable generating code for file artifacts by selecting the property Enable support for file artifacts in the TC editor:
  4. Build the TC and you will get a .h and/or .cpp file generated in your target project.

When generating code for the TC, the file artifact translates to one implementation and one header file similar to e.g. regular classes or capsules. You can as usual edit the files either in the model using the Code view/editor or directly in the generated files and then synchronize back your changes to the model. You can also create dependencies from other model elements to a file artifact. They will be translated to #include directives or forward declarations as usual.

Do you want to hear more about external C++ code integration? Provide us feedback by mailing to