To be able to use an artifact in a model, you have to declare it in a resource file attached to your model. You must create a template called "DefaultTemplate" under an artifact stereotype or criterion bearing the name of the corresponding file type to generate.
In the C# resource file, if you expand the Artifact folder, you can see that the stereotype "Source" and the template "DefaultTemplate" are defined by default. This means that when you create a new artifact and assign the Source stereotype, this artifact inherits the default template defined below:
You define the following artifact criterion in an extension:
This criterion verifies that the last 4 characters of the artifact name are .TXT. You also need to create the default template in order to define the content of the generated file. In this example, DefaultTemplate is defined as follows:
This is a text file. .foreach_item(ProductionObjects) %ShortDescription% .next(\n)
You can now create artifacts in the model using the
command in the model contextual menu. If you create an artifact with the .TXT extension and select the correct target in the Template tab of the artifact property sheet, the default template is automatically assigned to this artifact. This means that the short description of each instance of object associated with the current artifact will be written in the generated file:You can now define instances of objects you want to include in the file generated from the current artifact: