Creating a Knowledge Pattern Feature
You can create a Knowledge Pattern object by clicking Create Pattern a Knowledge Pattern Feature.
.
The objects that are supported by this feature are the:
-
User features.
-
Datums (Points, Lines, Curves, Circles, Surfaces, Planes, Volumes).
The Knowledge Pattern feature is aggregated to the Relations node from the specification tree, into a part. The Knowledge Pattern feature is very similar to the Action feature. Like the Action feature, it contains an expressional part that allows you to specify what actions you want to perform usually using loops and the for keyword. The main differences between both features are the following:
- When creating a Knowledge Pattern feature, you can create lists which are aggregated to Knowledge Pattern features. These lists contain links to the created objects, and the Knowledge Pattern feature controls the life cycle of the created objects through the content of these lists.
Note:
It can be useful to create several lists to handle different kind of objects. It provides an easy access to the results that have different semantics.
- You can use methods available in the dictionary to handle the instantiation and the modification of Knowledge Templates, and to create or modify datum objects.
- You can specify the update behavior of the Knowledge Pattern feature: Automatic update before the document root feature ( part, product, …) update, Manual update, Object update (the pattern can be updated through a reaction: In this case, make sure that you do not select the Automatic update mode).
- You can specify what happens if the controlled objects are pointed by other objects, when the pattern is executed another time.

Knowledge Pattern Specific Functions
You can instantiate a template by using the Knowledge Pattern feature.
The Knowledge Pattern allows to conditionally instantiate a template or another depending on some specifications (if … then instantiate A else instantiate B). The index in Knowledge Pattern lists enables you to identify the template. If a call is made to instantiate with index i in list L, the application looks for an instance in the list at this position.
- If no instance is found, an instance is created and inserted into the list L at the position i.
- If an instance is found, the application compares the identifier given as first argument with the one that was used for the previous instance. If this identifier is different, the system instantiates the new template and replaces the previous instance with a new one. This replace operation reroutes links from the old instance to the new one. Naming is copied from the previous instance.
The generative functions specific to Knowledge Pattern enable you to work with the Knowledge Pattern feature:
- CreateOrModifyTemplate: This method enables you to instantiate a user feature. You can access and modify the inputs of this user feature by using the type attributes (xxx.input name or xxx. output name) and the published name.
- TemplateId: Either the name of the resource in the resource table or the name of the local user feature. - Destination: Indicates the destination object (PartBody, ...). - PatternList: Indicates the pattern list. - IndexInPatternList: Indicates the index number in the pattern list. The function usually waits for contiguous indexes from 1 to n. 0 index is accepted but has the meaning of systematically appending created object at the end of the list, so 0 index should not be used in conjunction with non null indexes. If an object is removed from the list before the end of the pattern, or is replaced by another one at its index, it is deleted at the end of the pattern execution. The syntax here has to be the following: udf = CreateOrModifyTemplate("BoxUDF", PartBody, Boxes, i)
udf = CreateOrModifyTemplate("UserFeature1", `Geometrical Set.1` , Boxes, i)
- EndModifyTemplate: Enables you to trigger the update of the instantiated Object after modifying its inputs.
- Feature: object returned by the CreateOrModifyTemplate function. The EndModifyTemplate function can only be used together with the CreateOrModifyTemplate and the InstantiateTemplate ones. The Syntax is the following: EndModifyTemplate(udf)
- IsPatternInstanceLocked: This method enables you to ask if an instance is locked.
- Feature: if the answer is true, the instance is locked. If the answer is false, the instance is not locked.
- LockPatternInstance: This method enables you to lock the instance instantiated by the CreateOrModifyTemplate or CreateOrModifyDatum functions hence avoiding the modification of this instance. A new affectation or an attribute modification does not modify the instance.
- patterninstance: Indicates the pattern. - doLock: If set to true, the instance is locked. If set to false, the instance is not locked.
- CreateOrModifyDatum: This method enables you to create or modify a datum.
- datumType: Indicates the datum type (Point, Line, Curve, Circle, Surface, Plane, Volume). - Destination: Indicates the destination Object (PartBody, ...). - PatternList: Indicates the pattern list. - IndexInPatternList: Indicates the index number in the pattern list.
Note:
You can handle attributes using the Type view (if the type was properly generated and referenced in the Knowledge Environment tab) or using the SetAttributeObject function.

Concerning Associativity
and Lists
The Knowledge Pattern ensures the associativity of created objects.
This associativity is ensured with respect to:
- The parameters values of these objects. As an example, the templates publish parameters and a value change can impact the geometry of the instances.
- The number of objects to generate.
- The templates themselves. Depending on some expressional conditions or input changes, the templates to instantiate can change.
- The inputs of the expressional object defining the Knowledge pattern.
- The Inputs of these objects. The inputs can be geometrical inputs or parametric ones. The inputs of the expression are the objects that are not used as l-values (that are not set by an affectation operation).
To manage associativity, the Knowledge Pattern uses:
- The Engineering Knowledge Language (EKL) which contains loop structures and conditional expressions and that allows to instantiate and modify templates. It also allows to instantiate datums and templates and modify created instances using the Generative Knowledge functions.
- Lists that contain all objects and identify them in a unique way. These lists contain the Knowledge Pattern instantiated objects. They are published, enabling you to access the objects in other expressional objects. The Knowledge Pattern feature controls the life cycle of the objects grouped in these lists.
The List features is aggregated under the Knowledge Pattern feature (including the list containing locked objects).
|