Skip to content
  • There are no suggestions because the search field is empty.

Create a Template Module

Create a Template Module

To create a new Template Module, access the Advanced Settings overview page and select the Edit Template Modules option in the left menu.

The Manage Template Module page is displayed:

Click on the plus icon to create a Template Module:

The Create New Template side panel window is opened:

 

Fill in the following information:

  1. Template Type: Select the Template Type.
    1. You can choose to:
      • Add code before the template

      • Replace the template (default)

      • Add code after the related template


  2. Model Object Type: Template Model Object Type
    1. Select the Model Object Type for which the Template will be applied:
  3. Part per Model Object Type: Depending on the selected Model Object Type, the list of its parts is displayed.
    1. Select the Part for which the Template will be applied as follows, with Hub selected as Model Object Type:
  4. Use for all future Model Objects: if you check the box, the Template will be automatically applied for all future Model Objects of the Type defined in Step 2
  5. Model Objects list: the list of Model Objects for the selected Model Object Type is displayed
    1. Select the Model Objects to which the Template will be applied, as shown in the example (with Hub selected as the Model Object Type)
    2. A search box allows you to filter the list of Model Objects.
  6. Editor: The Template code should be written in C# within the method WriteOutput(TargetObject targetObject, ITemplateContext templateContext)
    1. An IntelliSense editor (based on the Generator methods and classes) is available, for example:
    2. Some code snippets are available by typing bigenius:
       
      1. Select a snippet, such as "iterator through terms", and the corresponding code will be inserted.
  7. Click the API Documentation link to open the documentation and access guidance for developing a custom template.
  8. Click the Validate button to compile the Template code. Any compilation errors or warnings will be displayed below the code.
  9. Blecting the PREVIEW tab, you can preview the generation result of the Template Module
  10. By selecting the ARCHITECTURE MODEL VIEW tab, you can display the Architecture Model for a Model Object in a Template Module 

A complete example of a Template Module can be found in the following article: Avoid to load all data in development.


Click on the SAVE button.

A notification confirms the correct creation:

Demonstration video