Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

Creating template definitions

  • Last UpdatedApr 24, 2024
  • 1 minute read

A template name must be unique inside the script.

Create a template definition

  1. When creating a template, write the template as a normal plain script block. Put this code block inside a deftemplate node.

  2. Identify the script elements to be parametrized.

  3. Replace the elements with placeholders.

Placeholder requirements

  • Use the %placeholder% syntax.

  • Do not include special characters or blank spaces.

  • Give each placeholder a unique name inside the deftemplate script block.

Code example

This is a code example for deftemplate.

<deftemplate name="vapore">

<animationtexture name="txt_%mesh%" texture="animt_%mesh%" clone="AnimVapore" assignToMesh="%mesh%" />

<timer name="tim_%mesh%" randomRange="8 20" loop="true" start="true"/>

<route from="tim_%mesh%.cycle" to="txt_%mesh%.restart"/>

</deftemplate>

Guidelines for developing templates

  • Put template code into separate files to be included. Ideally, each template has its own file, which helps to create libraries of templates.

  • Avoid referencing directly inside the template code node any names that are defined outside the template itself because this makes it less portable. Use placeholders to parameterize these references.

  • Assign self-explanatory names to placeholders so that you or others can quickly understand the purpose of the template.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in