ApplicationObject containment
- Last UpdatedDec 17, 2024
- 2 minute read
ApplicationObjects can be contained by other ApplicationObjects. This provides context for the contained object and a naming hierarchy that provides a powerful tool for referencing objects.
Note: Base templates cannot be contained by another template, either as the container or as the template being contained. You can only use containment with derived templates.
An example of a containment hierarchy is a tank that contains the following objects:
-
Inlet Valve
-
Agitator
-
Outlet Valve
-
Level
To enable referencing and flexibility within scripting, these objects can be referenced in several different ways. Each object has a unique tag name, such as:
-
Inlet Valve = InletValve01
-
Agitator = Agitator01
-
Outlet Valve = OutletValve01
-
Level = Level01
Within the context of each hierarchy, the contained names are unique, in that the names only refer to this tank system and the contained objects.
So if the tank is named Tank01, the contained names are:
-
Tank01.InletValve
-
Tank01.Agitator01
-
Tank01.Outlet01
-
Tank01.Level01
This naming convention adds context to the instances contained by Tank01.
You can see any object's hierarchical name by opening it and looking at its Object Information page.
Additionally, you can use containment references in scripts such as:
-
Me.Outlet: Allows a script running within the parent object to generically reference its child outlet instance.
-
MyContainer.Inlet: Allows a script running in any of the children instances to reference another child instance named Inlet that belongs to the same parent.