Appendix A – JSON Template Processor Rules

Introduction

The JSON Template Processor allows you to specify rules to apply to a Project before the Visualization is generated. 

There are currently three different rules you can create, and these require a “Pattern” which follows the path matching described in Appendix B - Rule Path Syntax.

All of these JSON rules must be provided in an array, even if there is only one rule.

ChangePropertyRule

This rule allows you to change the value of any property of any node. The JSON looks like:

Where some-pattern, property-name, newValue are set accordingly.

Example 1: Changing diffuse colour of a material

This will get all StdMaterials named ‘Material_1’ and change their Diffuse colour to green (r: 0, g:1, b:0).

Example 2: Changing smoothness of all materials in a specific library

This will change the smoothness to 1.0 for all StdMaterials in a Library named ‘MyLibrary’.

Example 3: Changing diffuse colour of all materials

This will get all StdMaterials and change their Diffuse colour to green (r: 0, g:1, b:0).

Create a New Node to Hide the Product Tree

Use this rule to create the FeaturesAvailability Metagroup with the HideProductTree metadata item to disable the tree.

Change the Camera Speed

Use this rule to set the camera base speed.

Where 6.7 m/s is the default speed you want to change.

DeleteNodesRule

Allows you to delete a node, and everything beneath it in the scene tree.

Where some-pattern is replaced with a pattern of the node(s) to delete.

Example

Deletes any Assembly nodes (and children of) called ‘RedPiece’, which are themselves a child of an Assembly called ‘LEGO’.

CreateNodeRule

Allows an entirely new node to be created. The “Pattern” specifies the parent node of the newly created node. Care must be taken that the pattern matches only a single node otherwise the rule will fail.

Defining Multiple Rules

Example


Print page
2022.2
December 16, 2021 18:07

Need more?