Appendix B – Rule Path Syntax

Introduction

Path matching allows the nodes of model(s) to be manipulated before being published. It can currently carry out three operations:

  1. Remove nodes (and their children).
  2. Update certain properties of a node to a different value.
  3. Remove certain properties of a node.

Use the rules and syntax examples given below to change your scene before it is published.

Path Syntax

In order to easily specify which nodes you want to manipulate, provide a path attribute in all of your requests. The path is simply a list of elements separated by a forward slash. It should start with (but not end with) a slash. In between the slashes are patterns that help match nodes with certain properties. 

The final element in the path specifies which node to act on, for example, the node that will be deleted or have its property modified. Any others before it are just used to locate it.

The operation being performed (for example, deleting a node) will be applied to all nodes that match the path, so it is important to be as specific as possible when providing a path to a node. If a car model has four wheel nodes and you only want to delete one of them, find a way to specify that particular wheel, otherwise all four will be deleted. The syntax below provides ways to do this.

Matching on Prop_name 

By default, the value you specify will be used to try and find a match on the prop_name property.

/Helicopter

This will match any nodes with a prop_name value of ‘Helicopter’. 

Please note: The matching is case-sensitive. 

Matching Nodes at the End of a Longer Path

You can chain these together to match longer paths. For example, to match a node with a prop_node value of ‘SGCapture’, directly connected to one with the same property set to ‘RotorBlade’ which itself is connected to one with a value of ‘Helicopter’, you can specify:

/Helicopter/RotorBlade/SGCapture

Matching on any Path-depth

If you are not concerned about how many nodes are between two others that you do want to specify, you can use an asterisk:

/Helicopter/*/SGCapture

That will match an SGCapture node regardless of whether it’s directly connected to the Helicopter node, or has one or more intermediary nodes (such as the RotorBlade node) between them.

Please note: A path cannot begin with this as the first element, since it defines a relationship connecting two nodes. A path such as /*/Helicopter is invalid and will result in an error being reported. 

Matching on Metanode

You can match on the node’s metanode property by adding a colon to any path element:

/:Assembly/*/:SGCapture

This will match any SGCapture metanodes (where the metanode property is ‘SGCapture’) that is in turn indirectly connected to an Assembly metanode.

Matching on Metanode and Prop_name

If you wanted to match a metanode with a certain name, you can specify the name after the metanode value (separated by a semicolon):

/:Assembly/*/:Model;Helicopter

Which will match a node like this:


Print page
2022.2
November 2, 2021 13:59

Need more?