One of the most robust functionalities supported by CATIA’s Knowledgeware is the ability to create reusable content: User Defined Features or Power Copy features, which can be instantiated within
Representations; Engineering Templates, which can be instantiated within
Physical Products. This functionality enables the encapsulation of compelx relationship and enterprise best practices; supporting Knowledge Based Engineering (KBE) workflows.
Engineering Templates Vs Regular VPMs.
We can reuse assemblies in two ways:
VPMs can be reused by inserting new instances of VPMs in an assembly. This can be done by the "Insert Existing…" command, or by simply performing a copy-paste of a set of VPMs under a parent VPM. In this case, instances (copies) will point to reference VPMs in the database. Changes made to any instance (whether source of new copy) will affect all previuosly copied instances and will be carry through to the newly made ones. This is suitable for scenarios where the goal is to populate an assemblies with instances of one VPM reference. For example, distributing Robotic arms across a factory floor assembly.
Instantiating From Engineering Templates
VPMs can be reused by creating Engineering Templates definitions, which can be used to instantiate new VPMs based on the source VPMs used to define the template. This is simialr to calling the "Duplicate" command. In this case, each created VPM instance will have its own unqiue product-id/reference in the database. Each one is independent. Changes to the Engineering Template definition will only affect newly created instances– expect when adding new unchanged components.
The main advantage of an Engineering Template is not only creating indepdent VPMs, but also the ability to pass inputs that affect the behavior of newly created instances. Inputs can be parameters, geometric features, or UDFs. This allows users to create simplified versions of a given solution for quick evaluation, then create a more complex and assembly representing a more detailed solution. Engineering Templates definitions can include Products, Parts, Drawings, Shapes, etc.
Making And Instantiating An Eng. Template
In order for Engineering Templates to keep their links, we need to make sure the following option is checked.
Here is how we can make a template definition and assign one of its features has an input ( note that defining inputs is optional) This means that we’re telling the template this input will be provided from an external source. Once provided, CATIA will instantiate a new instance from the template definition and create relationship links to the provided inputs.
Engineering Template Options:
Let’s take a look at the options available to us for setting the template’s definition.
An Engineering Templates (TPL) is a definition based on source VPMs that are grouped into Components To Process and Unchanged Components. There needs to be at least one VPM To Process for any TPL to work. Unchanged VPMs are optional.
Sources in the To Process section are instantiated as new VPMs when the template is instaniated it–each having its own unique product-id,
PLMExternal_ID. Unchanged sources are simply inserted as copies (instances) of the same VPM references in the template, pointing to the same product-id.
Options For Defining The Components To Process
TPLs can handle source VPMs based on two parameetrs: Behavior and Action.
Behavior At Instantiation
There are two behaviors: The elements can be either To Duplicate–a new instance will be created as part of the assembly. The second is To Replace: an Instance will be used as an element in the newly created assembly.
Combing both options yields the following result
|Options||Instantiation Behavior: To Duplicate||Instantiation Behavior: To Replace|
|Action To Peform: Instantiate||Instantiate a new VPM (containing all nested VPMs) based on the template||To select an item that replaces the given item in the template as per the conditions below|
|Action To Peform: Open||Open the VPM as is in a new tab *||NA|
Condition To Use The Replace Option
These specifications are provided by Dassault (from the user gudies page) to explain the condition required for using the Replace Option:
- A reference located in the engineering template can be declared as “To Replace” under the following conditions:
- All its pointing components point to it through publications.
- It is integrated to the replace mechanism.
- A reference is accepted as a replacement at instantiation if"
- Its publications are identical to those of the replaced one.
- The modeler replace mechanism could successfully reroute all links to the replacing reference.
[*] This is the only setup that allows instantiating a
Representation (Template), for example a
3DShape or a
Instantiating Templates And VPMs With EKL
TPLs are instantiated using the
InstantiateTemplatefunction, while inserting VPMs is done using the
ManageInstance method available to
VPMReference object types.
Here is the code used in the above example:
let root(VPMReference) root = GetEditorRoots("VPMReference").GetItem(1) //the instance name here has to be unique to keep creating new ones. In this case, it will be creating a new one. root.ManageInstance("MyProduct","","MyInsert") //here, we create a template instance, and set its input. let myTemplate(VPMInstance) myTemplate = InstantiateTemplate("MyTemplate", root) myTemplate.SetAttributeObject("TOP_PLANE", topPlane) EndModifyTemplate(myTemplate)
EKL, Engineering Template