Object templates enable you to build and configure your model using the object-oriented principle of inheritance, by creating template instances of objects in your model. A template instance is like any other object in FlexSim, except that it has a special link to its template, enabling several useful features:
Using this flexible inheritance functionality can make building and configuring models much faster. You can configure object properties on a few key objects in your model, and those properties will be inherited automatically by many other objects.
Almost any 3D object in FlexSim can be a template. You make an object into a template simply by creating template instances of that object. To do this:
This will create a template instance of the object.
Blue bezier lines are drawn to indicate inheritance relationships. They protrude out of the bottom of template objects and into the top of instance objects.
When you create a template instance, most properties of that instance will be inherited. The text styling of properties distinguishes inherited versus overridden values.
Properties that are displayed in italics are inherited properties, whereas properties that are displayed in bold signify an overridden property.
As soon as you change an inherited property on an instance, its display will change from italics to bold, signifying that the property is now overridden. Subsequent changes to the property on the template will no longer be reflected on the instance.
You can also directly view and edit the list of overridden properties:
A popup window will appear with a list of the object's overriden properties. You can add to, remove from, and reorder this list as needed. You can also select an override and press . This will remove the override from the instance, but apply its value to the template, asserting the instance's current value on the template and all sibling instances.
You can also make any object in your model into a global template. A global template creates a draggable icon in the library. When you drag this object into your model, it automatically creates an instance of that global template. To do this:
The object will appear in the library on the left. You can then drag instances of the object into your model.
When you have made an object a global template, that object will also appear in the Toolbox. If you double-click on the template in the Toolbox, it will center that object in the 3D view and highlight it so that you can edit its properties. You can also right-click on the object and add it, as a global template, to a user library. This enables reuse of the object in other models.
Global templates added to a user library through the toolbox are different than standard objects added to the user library. When you drop a global template from a user library into a model, then if there is a global template with the same name in the model, it will update that global template, instead of just adding a new object to the model. Consequently, it will also update all of the template instances of that global template. This enables easier updates from user libraries to objects in your model. It is like re-installing the new object into the model, with all of its updated behavior.
Template inheritance is enabled through object properties. When you set a property on an object that has template instances, it will propagate the change to instances by effectively calling Object.setProperty() on each of the object's instances. Further, it overrides a property by storing the property's unique name in an override list on the object. The important point here is that the set of inputs that can be inherited are determined by the set of named properties that an object supports. If a certain piece of object data does not have a corresponding named property, then that data cannot be inherited. Also, supported properties are generally confined to object inputs, i.e. data that you define on the object when you are building your model. Data such as statistics, state values, etc. do not support properties and therefore cannot be inherited. That said, most object inputs do support inheritance.
3D object inputs that are not inheritable as of FlexSim version 21.2 are:
There are also some named properties which inherently do not support inheritance, mostly because inheritance does not make sense for those properties. These are:
FlexSim's object template mechanism uses a prototype-based modeling style instead of a class-based one. Templates are themselves objects in your model, and as such, can be integrated in with the model as you define them. This design enables a more cohesive model-building process, where you are defining the object and building the model at the same time, instead of switching between two phases of class building then instantiation/model building. On the other hand, if you prefer a more class-based model-building approach, you can easily set your templates apart in an area of the model where you can define them separately, then use just template instances to actually build the model.