Defining a Generated File

You are going to define the generated file in order to list the messages of each communication diagram existing in your model. To do so, you have to define the generated file in the BasePackage metaclass. This metaclass is the common class for all packages and models, it owns objects, diagrams and other packages.

The generated file will contain the result of the evaluation of the template description defined on the CommunicationDiagram metaclass. The code of the generated file also contains a foreach_item macro in order to loop on the different communication diagrams of the model.

  1. Right-click the Profile category and select Add Metaclasses.

    The Metaclass Selection dialog box is displayed.

  2. Click the Modify Metaclass Filter tool, select Show Abstract Modeling Metaclasses, and click the PdCommon tab.
  3. Select BasePackage in the list of metaclasses and click OK.

    The BasePackage category is displayed under Profile.

  4. Right-click the BasePackage category and select New > Generated File.

    A new generated file is created.

  5. Type Communications Textual Descriptions in the Name box.

    This name is used in the resource editor.

  6. Type %Name% Communication Description.txt in the File Name box.

    This is the name of the file that will be generated. It will be a .txt file, and it will contain the name of the current model thanks to variable %Name%.

  7. Keep the Encoding value to ANSI.
  8. (optional) Type a comment in the Comment box.
  9. Deselect the check box Use Package Hierarchy as file path because you do not need the hierarchy of files to be generated.
  10. Type the following code in the text box:
    .foreach_item(CommunicationDiagrams)
     %description%
    .next(\n\n) 


  11. Click OK and accept to save the extended model definition.
  12. Click OK to close the List of Extended Model Definitions.