Standard Methods

Note: To view an example, import the V6 R2014 EKL Enhancements.3dxml file located in win_b64\startup\Knowledgeware\EKL Samples\Sample1 in the installation folder. This file shows you examples of use of the SetAttributeInteger, GetAttributeInteger, SetAttributeString, GetAttributeString methods.

This page discusses:

Feature.Access()

Method used to return an object from a path. You must indicate the location of what you are looking for.

Signature

Feature.Access(Path: String, Type: String) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
Path In Yes String
Type In Yes String

ReturnType

UndefinedType

Feature.AccessFederatedExtension()

Feature.AccessFederatedExtension()

Signature

Feature.AccessFederatedExtension(typeName : String) : UndefinedType

Arguments

Name Input/Output Required? Type Comment
typeName In String -

ReturnType

UndefinedType

Example

			

Feature.ActivateInactivateFeature()

Feature.ActivateInactivateFeature()

Signature

Feature.ActivateInactivateFeature(activate : Boolean)

Arguments

Name Input/Output Required? Type Comment
activate In Boolean -

Example

			

Feature.AddExtension()

Method used to add a Know-how Apps Components type or customer extensions to all mechanical features and products.

Signature

Feature.AddExtension(type: String) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
type In Yes String Type or extension name. This name is the internal type or extension name (not the NLS name.)

ReturnType

UndefinedType

Example

P : Part
set t = p -> AddExtension("MyType")
if (t == NULL)
{
Message ("Cannot Add 'MyType'")
}
else
{
Message ("Type 'MyType' Added")
}

Feature.AttributeType()

Method used to return the attribute type in the form of a string.

Signature

Feature.AttributeType(AttributeName: String) : String

Arguments

Name Input / Output Required? Type Comment
AttributeName In Yes String

ReturnType

String

Example

let s=""
s= feat->AttributeType("MyAttribute")

Feature.ActivateInactivateFeature()

Feature.ActivateInactivateFeature()

Signature

Feature.CheckProjDistAndNormVectDiff(OffsetFeature : Feature, ThickFeature : Feature, projectionDistance : Real, differenceAngle : Real) : Real

Arguments

Name Input/Output Required? Type Comment
OffsetFeature In Feature -
ThickFeature In Feature -
projectionDistance In Real -
differenceAngle In Real -

ReturnType

Real

Example

			

Feature.Delete()

Method used to delete an object when possible (for example, a point in a part). After the deletion, the variable that referenced the feature becomes Unset (NULL). The deletion may fail. In this case an error message is raised. The deletion may be not allowed in some cases (in business rules for example).

Important: The Delete method cannot be used on all Knowledge artefacts. In this case, the control is performed at runtime and an error message is raised. It can be used in Quality Rules Reuse rules, and in Know-how Apps Components operations. It is not available in standard Engineering Rules Capture rules, checks, reactions, and actions.

Signature

Feature.Delete()

Feature.Find()

Method used to find an object that is a child or a parent, that is of a given type, and that fulfills a condition. It stops when it finds the first object.

Signature

Feature.Find(Type: String, Condition: String, Down: Boolean) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
Type In Yes String
Condition In Yes String
Down In Yes Boolean Asks if you are interested in the children or the fathers. When going up, the scan stops at the document border. Starting from a mechanical feature, it stops at the PartFeature. Starting from an product instance, it does not go upper than the product that owns it. Starting from a product reference, it means nothing.

When going down, all the children in the tree are scanned and in the case of a product, it crosses the instance/reference border.

ReturnType

UndefinedType

Feature.GSDGetSurfaceOrientation()

Feature.GSDGetSurfaceOrientation()

Signature

Feature.GSDGetSurfaceOrientation() : Real

ReturnType

Real

Example

			

Feature.GetAttributeBoolean()

Method used to return the value of a Boolean type parameter added to a given object by using the Engineering Rules Capture product. parameterName is the name of the Boolean type parameter. It must be put between quotation marks ("). This method enables you to read:

  • The attributes added to parameters using the Parameters Explorer.
  • The real attributes added to objects.
  • The User Properties of a product.
Note: Unless you know perfectly that your feature has an attribute xxx, use before the HasAttribute method.

Signature

Feature.GetAttributeBoolean(String) : Boolean

Arguments

Name Input / Output Required? Type Comment
In Yes String

ReturnType

Boolean

Example

Message ("The value of the Boolean.1 attribute of # is #",
PartBodyPad.1.Name(),
PartBodyPad.1->GetAttributeBoolean("Boolean.1"))

Feature.GetAttributeDate()

Method used to retrieve a date.

Signature

Feature.GetAttributeDate(String) : Date

Arguments

Name Input / Output Required? Type Comment
In Yes String

ReturnType

Date

Example

Message("#",DateFormat("%d:%m: %Y",  VarName.GetAttributeDate("C_created")))

Feature.GetAttributeInteger()

Method used to return the value of an integer type parameter added to a given object using Engineering Rules Capture. parameterName is the name of the string type parameter. It must be put between quotation marks ("). This method enables you to read:

  • The attributes added to parameters using the Parameters Explorer.
  • The real attributes added to objects.
  • The User Properties of a product.

Signature

Feature.GetAttributeInteger(String) : Integer

Arguments

Name Input / Output Required? Type Comment
In Yes String

ReturnType

Integer

Example

Integer.3=PartBodyHole.1 ->GetAttributeInteger("Integer.2")

Feature.GetAttributeObject()

Method used to read the attribute attributeName of the object and returns an object.

Note: This method enables you also to manage dynamic parameters on objects that can aggregate a technological representation.

Signature

Feature.GetAttributeObject(String) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
In Yes String

ReturnType

UndefinedType

Feature.GetAttributeReal()

Method used to return the value of a real or Length (in m) type parameter added to a given object by using the Engineering Rules Capture product. parameterName is the name of the string type parameter. It must be put between quotation marks ("). This method enables you to read:

  • The attributes added to parameters using the Parameters Explorer.
  • The real attributes added to objects.
  • The User Properties of a product.

Signature

Feature.GetAttributeReal(String) : Real

Arguments

Name Input / Output Required? Type Comment
In Yes String

ReturnType

Real

Feature.GetAttributeString()

Method used to return the value of a string type parameter added to a given object by using the Engineering Rules Capture product. parameterName is the name of the string type parameter. This method enables you to read:

  • The attributes added to parameters using the Parameters Explorer.
  • The real attributes added to objects.

  • The User Properties of a product.

Signature

Feature.GetAttributeString(String) : String

Arguments

Name Input / Output Required? Type Comment
In Yes String

ReturnType

String

Example

String.2 =PartBodyPad.1 ->GetAttributeString("String.1") 
Note: To view an example, import the R2014 EKL Enhancements.3dxml file located in win_b64\startup\Knowledgeware\EKL Samples\Sample1 in the installation folder.

Feature.GetAttributeValuePointer()

Method used to point values only. It inherits from Pointer.

Signature

Feature.GetAttributeValuePointer(AttributeName: String) : ValuePointer

Arguments

Name Input / Output Required? Type Comment
AttributeName In Yes String Can be a local variable. This variable is introduced to access a parameter and read or modify its characteristics such as ranges, list of authorized values and so on.

ReturnType

ValuePointer

Example

let x (ValuePointer)
x= H  -> GetAttributeValuePointer("Diameter")

Feature.GetInputElements()

Feature.GetInputElements()

Signature

Feature.GetInputElements() : List

ReturnType

List

Example

			

Feature.GetListOfImplementingReferences()

Gets the implementing references with specification links.

Signature

Feature.GetListOfImplementingReferences(List of Implementing reference : List, List of HowToUsage attributes : List, List of specification links : List)

Arguments

Name Input/Output Required? Type Comment
List of Implementing reference Out List -
List of HowToUsage attributes Out List -
List of specification links Out List -

Example

let MyRequirement(Feature)
let Listofspecificationlinks(List)
let ListofImplementingRef(List)
set MyRequirement = MyReq // [From Argument List, Provided by User Selection]
MyRequirement->GetListOfImplementingReferencesForGlobalSpecification(ListofImplementingRef,Listofspecificationlinks)
";

Feature.GetListOfImplementingReferencesForGlobalSpecification()

Gets the implementing references with global specification links.

Signature

Feature.GetListOfImplementingReferencesForGlobalSpecification(List of Implementing reference : List, List of specification links : List)

Arguments

Name Input/Output Required? Type Comment
List of Implementing reference Out List -
List of specification links Out List -

Example

let MyRequirement(Feature)
let Listofspecificationlinks(List)
let ListofImplementingRef(List)
set MyRequirement = MyReq // [From Argument List, Provided by User Selection]
MyRequirement->GetListOfImplementingReferencesForGlobalSpecification(ListofImplementingRef,Listofspecificationlinks)
";

Feature.HasAttribute()

Method used to determine whether the attribute specified in the argument belongs to the object to which the method is applied, and if the attribute value is not NULL.

Signature

Feature.HasAttribute(String) : Boolean

Arguments

Name Input / Output Required? Type Comment
In Yes String Name of the attribute.

ReturnType

Boolean

Example

Boolean.2 = PartBodyHole.1->HasAttribute("Real.1")

Feature.IsADatumFeat()

Feature.IsADatumFeat()

Signature

Feature.IsADatumFeat() : Integer

ReturnType

Integer

Example

			

Feature.IsASortOf()

Signature

Feature.IsASortOf(typeName: String) : Boolean

Arguments

Name Input / Output Required? Type Comment
typeName In Yes String

ReturnType

Boolean

Example

H:Hole
H -> IsASortOf("TaperedHole") == true

Feature.IsOwnedBy()

Method used to determine whether the feature specified in the argument is the parent of the object to which the method is applied. featureName must be put between quotation marks (").

Signature

Feature.IsOwnedBy(owner: Feature) : Boolean

Arguments

Name Input / Output Required? Type Comment
owner In Yes Feature

ReturnType

Boolean

Example

Boolean.1=PartBodyHole.1->IsOwnedBy(PartBody)

Feature.IsSupporting()

Method used to indicate if the object passed in argument implements a given type.

Signature

Feature.IsSupporting(typeName: String) : Boolean

Arguments

Name Input / Output Required? Type Comment
typeName In Yes String

ReturnType

Boolean

Example

H:Hole
H -> IsSupporting("TaperedHole") == true

Feature.IsUpToDate()

Lets you access the update status of an object. Returns TRUE if the objects are updated, FALSE if not. This method should work on the following list of features:

  • Mechanical Features
  • Product Structure objects (References, Instances, Rep References, Rep Instances)
  • Rulebase
  • Constraint Satisfaction
  • Parameter Set
  • Relation Set
  • Optimization

Signature

Feature.IsUpToDate() : Boolean

ReturnType

Boolean

Example

Let prdToCheck(VPMReference)
prdToCheck = [...]

if (not(prdToCheck->IsUpToDate())) 
{
       Report(“Warning”,”Product was not up to date”,”Product # was not up to date”)
       prdToCheck->Update()
}

Feature.ListAttributeNames()

Method used to return a list of strings corresponding to the name of the available attributes for a given object. The generated list depends not only on the Object Type but also on the object itself. That is to say, this method may return attributes that have been added dynamically to the object, through the Parameter Explorer command or through the SetAttribute method.

When adding integer or string attributes to faces, this method returns the attributes names and the face default values: the Color, Name, UserInfoComment and the integers Layer, Transparency.

Be careful, ListAttributeNames and ListAttributesValuePointers methods are not recursive. It is required to call them from the parameter set that is the direct parent of the parameters you want to read.

Signature

Feature.ListAttributeNames(TypeFilter: String, DynamicOnly:
 Boolean) : List

Arguments

Name Input / Output Required? Type Comment
TypeFilter In Yes String
DynamicOnly In Yes Boolean

ReturnType

List

Example 1

let x(List)
let s=""
let sfinal = ""
x = Product -> ListAttributeNames ("String",false)
for s in x
{
sfinal = sfinal + Product -> GetAttributeString (s)
}

Example 2

let attributes (List)
let pad(GeometricFeature)
let faces (List)
let face (CATFace)

set pad=PartBody\Pad.1
faces = pad->GetSubElements(2) 
set face = faces[1]

/* Create 2 attributes on a pad face */
face->SetAttributeInteger("IntegerAttr",5) /* Creates an integer attribute of value 5 */
face->SetAttributeString("StringAttr","Value1") /* Creates an integer attribute of value Value1 */

/* Modify attribute values */
face->SetAttributeInteger("IntegerAttr",9) 
face->SetAttributeString("StringAttr","NewValue")

/* Read and display attribute values */
Message("IntegerAttr " , face->GetAttributeInteger("IntegerAttr")) 
Message("AttrString " , face->GetAttributeString("StringAttr"))

/* List the attributes */	
attributes=face->ListAttributeNames("String",false) 
attributes=face->ListAttributeNames("Integer",false)

Feature.ListAttributesValuePointers()

Feature.ListAttributesValuePointers()

Be careful, ListAttributeNames and ListAttributesValuePointers methods are not recursive. It is required to call them from the parameter set that is the direct parent of the parameters you want to read.

Signature

Feature.ListAttributesValuePointers(TypeFilter : String) : List

Arguments

Name Input/Output Required? Type Comment
TypeFilter In String -

ReturnType

List

Example

			

Feature.Query()

Method used to search for the features located below the feature to which it applies and that verifies the specified expression The objects found are added to the list. All the children are scanned, the direct ones and recursively in the tree.

Signature

Feature.Query(Type: String, Condition: String) :
 List

Arguments

Name Input / Output Required? Type Comment
Type In Yes String
Condition In Yes String

ReturnType

List

Example

List.1=PartBody.Query("Hole","x.Diameter>50mm")

In the example above, the result of the search will return the holes of PartBody whose diameters are greater than 50mm. Where:

  • List.1is the name of the list on which the calculation will be performed.
  • PartBodyis the body on which the search will be carried out.
  • Hole is the Type of the searched feature.
  • x.Diameter>50mm is the expression.
Note: Remember that:
  • The expression can be empty.
  • In an assembly context, if you perform a query on a type deriving from the type Product or on a type assigned to a product (such as electrical types for example), the query will return more items than expected because all the product instances (even those that are not visible) are returned as well as their references.

Feature.RemoveAttribute()

Feature.RemoveAttribute()

Signature

Feature.RemoveAttribute(String)

Arguments

Name Input/Output Required? Type Comment
In String -

Example

			

Feature.RemoveExtension()

Method used to remove a Know-how Apps Components type or a customer extension from all mechanical features and products.

Signature

Feature.RemoveExtension(type: String) : Integer

Arguments

Name Input / Output Required? Type Comment
type In Yes String Type or extension name. This name is the internal type or extension name (not the NLS name.)

ReturnType

Integer

Example

p : Part
let NBRemoved(Integer)
NBRemoved = p -> RemoveExtension("MyType")
if NBRemoved > 0 { Message ("Type removed") }

Feature.SetAttributeBoolean()

Method used to assign the value specified in the second argument to the parameter whose name is specified in the first argument. parameterName is the name of the Boolean type parameter whose value is to be modified. It must be put between quotation marks ("). Booleanvalue is either TRUE or FALSE. It is created only if it can be created using the Parameters Explorer.

Signature

Feature.SetAttributeBoolean(String, Boolean)

Arguments

Name Input / Output Required? Type Comment
In Yes String Name of the attribute
In Yes Boolean Value to be assigned to the attribute

Example

if PartBodyPad.1Boolean.1 <> true
PartBodyPad.1->SetAttributeBoolean("Boolean.1", true)

Feature.SetAttributeDate()

Method used to set a date.

Signature

Feature.SetAttributeDate(String, Date)

Arguments

Name Input / Output Required? Type Comment
In Yes String
In Yes Date

Feature.SetAttributeDimension()

Method used to assign the value specified in the second argument to the parameter whose name is specified in the first argument. parameterName is the name of the parameter whose value is to be modified. parameterName must be put between quotation marks ("). The unit used is the current one.

Signature

Feature.SetAttributeDimension(String, Real, String)

Arguments

Name Input / Output Required? Type Comment
In Yes String Name of the attribute
In Yes Real Value to be assigned to the attribute
In Yes String Type

Feature.SetAttributeInteger()

Method used to assign the value specified in the second argument to the parameter whose name is specified in the first argument. parameterName is the name of the integer type parameter whose value is to be modified. Put parameterName between quotation marks (").

Signature

Feature.SetAttributeInteger(String, Integer)

Arguments

Name Input / Output Required? Type Comment
In Yes String Name of the attribute
In Yes Integer Value assigned to the attribute

Example

if PartBodyHole.1Integer.1 <> 3
PartBodyHole.1 ->SetAttributeInteger("Integer.1", 3)

Feature.SetAttributeObject()

Method used to write the attribute attributeName of the object with what is referenced by the pointer. It will allow passing literal to an object that needs to reference it (and that does not only need the value). It is also used to valuate list parameters and attributes.

Note: This method enables you to manage dynamic parameters on objects that can aggregate a technological representation. When using this method, if there is no technological representation to be found below the object, a new one is created. If there is more than one technological representation, the first one is selected.

Signature

Feature.SetAttributeObject(String, Feature)

Arguments

Name Input / Output Required? Type Comment
In Yes String
In Yes Feature
Note: To view an example, import the Sample_extra.3dxml file located in win_b64\startup\Knowledgeware\PKT Samples\Sample1 in the installation folder.

Feature.SetAttributeReal()

Method used to assign the value specified in the second argument to the parameter whose name is specified in the first argument. parameterName is the name of the real type parameter whose value is to be modified. Put parameterName between quotation marks (").

Signature

Feature.SetAttributeReal(String, Real)

Arguments

Name Input / Output Required? Type Comment
In Yes String Name of the attribute
In Yes Real Value to be assigned to the parameter (MKS dimensions)

Feature.SetAttributeString()

Method used to assign the value specified in the second argument to the parameter whose name is specified in the first argument. parameterName is the name of the string type parameter whose value is to be modified. parameterName and stringvalue must be put between quotation marks (").

Signature

Feature.SetAttributeString(String, String)

Arguments

Name Input / Output Required? Type Comment
In Yes String Name of the attribute
In Yes String Value to be assigned to the attribute

Example

if PartBodyPad.1->GetAttributeString("String.1") <> "String1"
PartBodyPad.1 ->SetAttributeString("String.1","This is a test")

/*Another syntax for the same rule is:*/

if PartBodyPad.1String.1 <> "String1"
PartBodyPad.1->SetAttributeString("String.1","This is a test")
Note: To view an example, import the XMLInEKLSample.3dxml file located in intel_a\startup\Knowledgeware\EKL Samples\Sample3 in the installation folder.

Feature.Update()

Method used to update a feature when necessary. It is available on relations sets, parameters sets, parameters, rule bases, constraints satisfactions, optimizations, and Knowledge pattern features. It is unavailable on the objects such as geometric features.

Signature

Feature.Update()

Example

Expression1 (P: #In PartFeature)
{
/* Finding a value */ 
let L (List) L = P -> Query(Rulebase,)
L -> Apply (RuleBase,x -> Update())
}

List.AddItem()

Method used to add an item to the list. If the index is equal to 0, the new item is added at the end of the list. If the index is equal to 1, the new item is inserted into the list at the location indicated by the index, meaning that the item is replaced with the new one and is therefore removed from the list. It is recommended to use the InsertItem method.

Signature

List.AddItem(Object: ObjectType, Index: Integer)

Arguments

Name Input / Output Required? Type Comment
Object In Yes ObjectType
Index In Yes Integer

Example

let list (List) 
						list -> AddItem(PartBody\Hole.2 ,1) 
						list -> AddItem(PartBodyHole.3 ,2) 
						Message("#",list.Size())

List.AdvancedSort()

List.AdvancedSort()

Signature

List.AdvancedSort(Type : String, OperatorList : List, FormatList : List, ExpressionList : List) : List

Arguments

Name Input/Output Required? Type Comment
Type In String -
OperatorList In List -
FormatList In List -
ExpressionList In List -

ReturnType

List

Example

			

List.Append()

Method used to add an item at the end of the list.

Signature

List.Append(Object: ObjectType)

Arguments

Name Input / Output Required? Type Comment
Object In Yes ObjectType Object to insert into the list.

List.Apply()

Method used to apply a given expression to the objects of a list that are of a given type.In this expression, the element of the list is represented by a variable named x.

Signature

List.Apply(Type: String, Expression: String)

Arguments

Name Input / Output Required? Type Comment
Type In Yes String
Expression In Yes String

Example

//Finds all rule bases and executes them 
//P being Part Feature 
/* Finding a value */  
						
let L (List)
L = P  ->  Query("Rulebase","")
L   ->   Apply ("RuleBase","x -> Update()")

List.Compute()

Function used to compute the result of an operation performed all the elements of the list. It is available for Actions, Reactions and in Quality Rules Reuse. There are two usages for this method:

  • On lists of values, it simply computes an operation on the values (+, min, max)
  • On list of objects, it will compute an operation on results of expressions on the object.

Signature

List.Compute(Operation: String, Type: String, 
Expression: String, Result: UndefinedType)

Arguments

Name Input / Output Required? Type Comment
Operation In Yes String
Type In Yes String
Expression In Yes String
Result Out Yes UndefinedType

Example 1

List.1 ->Compute("+","","",Length.1)

The example above sums all the values of the list:

Where:

  • List.1 is the name of the list on which the calculation will be performed
  • + is the operator used. (Supported operators are: +, min, and max.)
  • The first string must be empty to indicate that we work on list of values.
  • The second String must also be empty when working on list of values.
  • Length.1 is the output parameter.

Example 2

List.1 -> Compute("+","Hole","x.Diameter+x.Depth",Length.1)

The example above sums all the addition of the diameter and the depth of all holes in the list. Where:

  • List.1 is the name of the list on which the calculation will be performed.
  • + is the operator used. (Supported operators are: +, min, and max.)
  • The first string contains the expected type of the objects of the list (in this case, it is a list of holes).
  • The second String contains a formula that will be computed on each element of the list (holes in this case) and that will return a value. In this expression the variable x is used to represent the element in the list. One can then access its attributes for instance.

Length.1 is the output parameter.

List.Extract()

Method used to extract the items of a given type.

Signature

List.Extract(Type: String, TypeOutput: String,
 Expression: String) : List

Arguments

Name Input / Output Required? Type Comment
Type In Yes String Knowledge types considered by the extract function meaning that the list is first filtered to take only elements of a given type into account. The type can be a value type or an object type.
TypeOutput In Yes String Type of the object produced by the Extract method. The output list contains the objects of this given type. The type can be a value type or an object type.
Expression In Yes String Knowledge rule expression with two arguments, x of type Type and y of type TypeOutput. The expression must valuates y depending on the expression computed on x. The expression can use the if, else, for, let keywords like in a rule.

ReturnType

List

Example

Let L1(List) 
						Let L2(List) 
						... 
						L2=L1 -> Extract("Hole","LENGTH","y=x.Diameter+x.Depth")

In this example, we produce a list in output that is the extraction of the sum of the diameter and the depth of the holes in the list.

List.Filter()

Method used to filter a list of objects by extracting the objects that fulfill a Boolean expression.

Signature

List.Filter(Type: String, Condition: String) : List

Arguments

Name Input / Output Required? Type Comment
Type In Yes String Type of the objects that the user wants to extract (it can be "". In this case, no filtering is done on types).
Condition In Yes String Boolean expression that must fulfill the objects of this given type. In this expression "x" is used as the variable name of type TypeName. This string can be equal to "". In this case, no expression is checked.

ReturnType

List

Example

I = (List -> Filter("Hole","x.Diameter > 3mm")).Size() 
						I = (List -> Filter("Hole","")).Size()

List.GetItem()

Method used to retrieve a value/item from the list. (Index from 1).

Important: By default, GetItem can return any object. As a consequence, it is mandatory to insert the result of the GetItem method in a local variable. This is necessary to:
  • Test if the variable is NULL i.e. the object is not of the expected type
  • Avoid uncertainties. For example, if you write length(List.GetItem(i)), the system chooses the length function either on curves or on edges.

Signature

List.GetItem(Index: Integer) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
Index In Yes Integer

ReturnType

UndefinedType

List.IndexOf()

Method used to return the first index of a list item. The item is searched for from the start index.

Signature

List.IndexOf(Element: ObjectType, StartIndex: Integer) : Integer

Arguments

Name Input / Output Required? Type Comment
Element In Yes ObjectType
StartIndex In Yes Integer

ReturnType

Integer

List.Init()

Method used to determine the content of alist. It lets you fill in the list with n identical items. This method lets you quickly fill in a list of given values. The list can be used along with any value. When using a list as value argument, it is copied each time.

Signature

List.Init(nbValues : Integer, value : ObjectType)

Arguments

Name Input/Output Required? Type Comment
nbValues In Integer Number of items of the list that is initialized with the input value.
value In ObjectType Value copied to initialize the items of the input list. All values are authorized including NULL and a list.

Example

let L1, L2 (List)
L2.Init(3, 0) // now L2 contains 0, 0, 0
L1.Init(2, L2) // now L1 contains two lists, each containing 0, 0, 0
L1[1][1] = 1 // now L1 contains 1 list with 1, 0, 0 and the other one 0, 0, 0

List.InsertItem()

Method used to insert an item into the list.

Signature

List.InsertItem(Object: ObjectType, Index: Integer)

Arguments

Name Input / Output Required? Type Comment
Object In Yes ObjectType Object to insert into the list.
Index In Yes Integer Location of the object to be inserted into the list (Starts at 1).

List.Intersect()

Method used to get the intersection of two lists of objects. Optional criteria can be used to get only objects that are in both lists and that respect the condition.

Signature

List1.Intersect(List2 : List [, Type : String, Expression : String]) : List

Arguments

Name Input / Output Required? Type Comment
List1 Out Yes List List to which the intersection is applied.
List2 In Yes List -
Type In No String Both lists are filtered to take only elements of a given type into account. The type can be a value type or an object type.
Expression In No String Boolean expression that must fulfill the objects of this given type. In this expression “x” is used as the variable name of Type type. The expression can use the following operators:
  • mathematical: +, /, etc...
  • comparison: ==, >, ...
  • logical: AND, OR, ...

This string can be equal to "". In this case, no expression is checked.

ReturnType

List

Example

Let L1, L2, L3 (List)
L3 = L1.Intersect(L2, “HOle”, “x.Diameter == 15mm”)


Note: L3 = L1.Intersect(L2) generates a result list containing {X1, X3, X6, X13, X15}. If the result is not refined using a criterion, the result is a simple intersection (with common elements) of the two lists.

List.Junction()

Method used to find elements of a list that verifies a criterion between elements of this list and elements of another list.

Signature

List1.Junction(List2 : List, TypeList1 : String, TypeList2 : String, Expression : String) : List

Arguments

Name Input / Output Required? Type Comment
List1 In Yes List List to which the junction is applied.
List2 In Yes List Second list needed to apply junction functionality on a list.
TypeList1 In Yes String First list is filtered to take only elements of a given type into account. The type can be a value type or an object type.
TypeList2 In Yes String Second list is filtered to take only elements of a given type into account. The type can be a value type or an object type.
Expression In Yes String

Knowledge rule expression with two arguments:

  • x of TypeList1 type for the first list
  • y of TypeList2 type for the second list

The expression must be valuated depending on x and y under the form x.att == y.att. The expression can use the following operators:

  • mathematical: +, /, etc...
  • comparison: ==, >, ...
  • logical: AND, OR, ...
The expression cannot be "".

TypeList3 Out Yes List Output list.

ReturnType

List

Example

Let L1, L2n L3 (List)
L3 = L1.Junction(L2, “Hole”, “Hole”, “x.Diameter == y.Depth AND y.Diameter > 10mm”)



In the above example, the result returned is a list of the Holes (Xi) of L1 whose diameter is equal to the Depth of a Hole (Ei) of L2 and only if the hole diameter is greater than 10mm.

List.RemoveAll()

Method used to empty the list.

Signature

List.RemoveAll()

List.RemoveDuplicates()

Method used to modify the content of the list by extracting the duplicated elements. When the list references objects (features and parameters), it removes the duplicated reference to the objects. When the list references volatile values, it removes the equivalent values.

Note: This method does not have the same behavior on lists of parameters and on lists of values. On Lists of parameters, it removes the parameter that are present twice in the list. On lists of values, it removes the values that have the same value.

Signature

List.RemoveDuplicates()

List.RemoveItem()

Method used to remove an item from the list.Index is the location of the object to be removed in the list. The index starts at 1.

Signature

List.RemoveItem(Index: Integer)

Arguments

Name Input / Output Required? Type Comment
Index In Yes Integer
Note: To view an example, import the Sample_extra.3dxml file located in win_b64\startup\Knowledgeware\PKT Samples\Sapmle1 in the installation folder.

List.ReorderItem()

Method used to move an element of the list referenced by its position to a new position. The position starts at 1.

Signature

List.ReorderItem(Current: Integer, Target: Integer) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
Current In Yes Integer
Target In Yes Integer

ReturnType

UndefinedType

List.SetItem()

Method used to replace an item in the list.

Signature

List.SetItem(Object: ObjectType, Index: Integer)

Arguments

Name Input / Output Required? Type Comment
Object In Yes ObjectType Object to insert into the list.
Index In Yes Integer Location of the object to be replaced in the list. In this case, the object to be replaced is deleted. Index starts at 1.

List.Size()

Method used to return the number of items contained in the list.

Signature

List.Size() : Integer

ReturnType

Integer

List.Sort()

Method used to sort lists. It operates the sort based on a criteria that corresponds to an extraction (see previous method).

Signature

List.Sort(Operator: String, Type: String, TypeOutput: String, Expression: String) : List

Arguments

Name Input / Output Required? Type Comment
Operator In Yes String Accepted values are "<", ">". These operators are used to sort the list.
Type In Yes String Type of the list objects taken into account. It can be a type of value or a type of object. The type must be indicated because it is used to validate the expression. All objects of the list should be inheriting from this type.
TypeOutput In Yes String Type of the object produced using the sort method. The output list contains objects of this given type. The type can be a value type or a list of objects. It can be a Real or a String.
Expression In Yes String Knowledge rule expression with two arguments, x of type Type and y of type TypeOutput. The expression must valuate y depending on the expression computed on x. The expression can the if, else, for, let keywords like in a rule.The expression can be empty if the list is a list of values.
Note: Remember:
  • If the operator is not equal to ">" or "<", an evaluation error is raised.
  • If Type or TypeOutput is not a recognized type, an evaluation error is raised.
  • This method does not operate on the list itself but produces the sorted list in output. As a consequence, to solve the problem, we should have created a new List and valuated it with: NewList = FilletRadius -> Sort(>,LENGTH,LENGTH,)

ReturnType

List

Example

NewList = HoleList  ->  Sort(">","LENGTH","LENGTH","y=x.Diameter")			
This example sorts a list of holes based on their diameter.

List.Split()

Method used to split a list in more than one list depending on criteria.

Signature

List.Split(Type : String, ReturnType : String, Expression : String) : List

Arguments

Name Input / Output Required? Type Comment
List1 In Yes List List to which the split is applied.
Type In Yes String The list is filtered to take only elements of a given type into account. The type can be a value type or an object type.
ReturnType In Yes String Type of the returned values. For example, a length is returned in mm.
Expression In Yes String

Knowledge rule expression with two arguments:

x of Type type of the list.

y of ReturnType type that specifies the return type of the attribute.

The expression must be valuated depending on x and y under the form: y = x.att.

Expression should not be "".

ReturnType

List

Example

Let L1, L3 (List) //we declare L3 as a list, but it is good to remember that L3 will be a list of lists.
L3 = L1.Split(“Hole”, “Length”, “y = x.Diameter”)
L1 L3
Reference Diameter (attribute of length type) 10 12 8 6
ListB ListC ListD ListE
Hole1 10 X
Hole2 12 X
Hole3 8 X
Hole4 12 X
Hole5 10 X
Hole6 6 X
Note: For understanding purposes, find below the expected result showing the contents of each list. ListA, ListB, ListC, ListD and ListE do not need to be typed in the script.
L1 = {Hole1, Hole2, Hole3, Hole4, Hole5, Hole6} 	
L3 = {ListA, ListB, ListC, ListD, ListE}
ListA = {10, 12, 8, 6}     
ListB = {Hole1, Hole5}	
ListC = {Hole2, Hole4}	    
ListD = {Hole3}	
ListE = {Hole6}
The first list of L3 (ListA) contains the values of the diameters. Its size is equal to the number of splits (the number of lists that contains elements with the same attribute value). ListA is sorted according to the split results (ListB, ListC, ListD and ListE). Other lists contain objects with the same diameter value.

List.Subtract()

Method used to remove objects from a list depending on another list.

Signature

List1.Subtract(List2 : List [, Type : String, Expression : String]) : List

Arguments

Name Input / Output Required? Type Comment
List1 In Yes List List to which the subtraction is applied.
List2 In Yes List -
Type In No String Both lists are filtered to take only elements of a given type into account. The type can be a value type or an object type.
Expression In No String Boolean expression that must fulfill the objects of this given type. In this expression "x" is used as the variable name of Type type.

The expression can use the following operators:

  • mathematical: +, /, etc...
  • comparison: ==, >, ...
  • logical: AND, OR, ...

This string can be equal to "". In this case, no expression is checked.

ReturnType

List

Example

Let L1, L2, L3 (List)
L3 = L1.Subtract(L2, “Hole”, “x.Diameter == 15mm”)


Note: The result of L3=L1.Subtract(L2) is the same as the "-" operator.

Literal.Inf()

Signature

Literal.Inf(iKeywordValue : Real, iChapter : ENOCLG_ClassReference) :
 Boolean

Arguments

Name Input / Output Required? Type Comment
iKeywordValue In Yes Real
iChapter In Yes ENOCLG_ClassReference

ReturnType

Boolean

Operator -

Operator used to remove objects from a list according to another one.

Signature

– (List1: List, List2: List): (List3: List)

Arguments

Name Input / Output Required? Type Comment
List1 In Yes String List to which the subtraction is applied.
List2 In Yes String Second list needed to apply subtraction functionality to the list.
List3 Out Yes String Output list.

Example

let L1, L2, L3 (List)
L3 = L1-L2

ReturnType

List

Literal.IsDriving()

Literal.IsDriving()

Signature

Literal.IsDriving() : Boolean

ReturnType

Boolean

Example

			

Literal.Sup()

Signature

Literal.Sup(iKeywordValue : Real, iChapter : ENOCLG_ClassReference) :
 Boolean

Arguments

Name Input / Output Required? Type Comment
iKeywordValue In Yes Real
iChapter In Yes ENOCLG_ClassReference

ReturnType

Boolean

Map.Add()

The Add method is used to insert a key-value pair in the map.

Signature

Map.Add(iKey : ObjectType, iValue : ObjectType) : Boolean

Arguments

Name Input/Output Required? Type Comment
isAdded Out Yes Boolean Denotes if the pair was successfully added to the map.
iKey In Yes String/Real/Integer/Feature Key to be added in the map.
iValue In Yes String/Real/Integer/Feature Value to be added in the map.

ReturnType

Boolean

Example

// Creates a Map
let mapObj (Map)
mapObj = CreateMap(“String”, “String”)

// Defines Key
let iKey (String)
iKey = "Dimension"

// Defines Value
let iValue (string)
iValue = “Length”

// Defines output Boolean
let isPairAdded (Boolean)

// Using Add Method
isPairAdded = mapObj -> Add(iKey, iValue)

Map.Get()

The Get method retrieves the value corresponding to the respective key present in the map.

Signature

Map.Get(iKey : ObjectType) : UndefinedType

Arguments

Name Input/Output Required? Type Comment
oValue Out Yes String/Real/Integer/Feature The corresponding value of the input key present in the map.
iKey In Yes String/Real/Integer/Feature To retrieve value.

ReturnType

UndefinedType

Get

// Creates a Map
let mapObj (Map)
mapObj = CreateMap(“String”, “String”)

// Defines Key
let iKey (String)
iKey = "Dimension"

// Defines Value
let iValue (String)
iValue = “Length”

// Defines output Boolean
let isPairAdded (Boolean)

// Defines output Value
let oValue (String)

// Using Add Method
isPairAdded = mapObj -> Add(iKey, iValue)

// Using Get Method
oValue = mapObj -> Get(iKey)

Map.Remove()

The Remove method is used to delete the entry of the key-value pair present in the map.

Signature

Map.Remove(iKey : ObjectType) : Boolean

Arguments

Name Input/Output Required? Type Comment
isRemoved Out Yes Boolean Indicates if the remove method successfully deleted the entry.
iKey In Yes String/Real/Integer/Feature Key on which the delete method has to work upon.

ReturnType

Boolean

Remove

// Creates a Map
let mapObj (Map)
mapObj = CreateMap(“String”, “String”)

// Defines Key
let iKey (String)
iKey = "Dimension"

// Defines Value
let iValue (String)
iValue = “Length”

// Defines output Boolean
let isPairAdded (Boolean)

// Defines output Value
let oValue (String)

//Defines the output if entry got removed or not
let isRemoved (Boolean)

// Using Add Method
isPairAdded = mapObj -> Add(iKey, iValue)

// Using Get Method
oValue = mapObj -> Get(iKey)

// Using Remove Method
isRemoved = mapObj ->Remove(iKey)

Map.Replace()

The Replace method updates the value of input key present in the map.

Signature

Map.Replace(iKey : ObjectType, iUpdateValue : ObjectType) : Boolean

Arguments

Name Input/Output Required? Type Comment
isReplaced Out Yes Boolean Indicates if value is successfully replaced.
iKey In Yes String/Real/Integer/Feature To make an update.
iUpdateValue In Yes String/Real/Integer/Feature New value to be updated.

ReturnType

Boolean

Example

// Creates a Map
let mapObj (Map)
mapObj = CreateMap(“String”, “String”)

// Defines Key
let iKey (String)
iKey = "Dimension"

// Defines Value
let iValue (String)
iValue = “Length”

// Defines output Boolean
let isPairAdded (Boolean)

// Defines output Value
let oValue (String)

// Defines Value to be replaced by
let iUpdateValue (String)
iUpdateValue = “Breadth”

// Defines output if replaced or not
let isReplaced (Boolean)

// Using Add Method
isPairAdded = mapObj -> Add(iKey, iValue)

// Using Get Method
oValue = mapObj -> Get(iKey)

// Using Replace Method
isReplaced = mapObj ->Replace(iKey, iUpdateValue)

Map.ToLists()

The ToLists method is used to segregate the keys and values of the map to different lists.

Signature

Map.ToLists(oKeyList : List, oValueList : List)

Arguments

Name Input/Output Required? Type Comment
oKeyList Out Yes List List containing the keys of the map.
oValueList Out Yes List List containing the values of the map.

ToLists

// Creates a Map
let mapObj (Map)
mapObj = CreateMap(“String”, “String”)

// Defines Key
let iKey (String)
iKey = "Dimension"

// Defines Value
let iValue (String)
iValue = “Length”

// Defines output Boolean
let isPairAdded (Boolean)

// Defines list to store keys of the map
let oKeyList (List)

// Defines list to store values of the map
let oValueList (List)
 
// Using Add Method
isPairAdded = mapObj -> Add(iKey, iValue)

// Using ToLists Method
mapObj -> ToLists (oKeyList, oValueList)

Pointer.SetValue()

Method used to modify the the object referenced by the pointer. A pointer is a variable referencing an object. T

Signature

Pointer.SetValue(Value: ObjectType)

Arguments

Name Input / Output Required? Type Comment
Value In Yes ObjectType

Example

x = Hole -> GetAttributeValuePointer ("Diameter")
x -> SetValue(3mm) /* values the hole diameter */

Pointer.ValuatePointer()

Pointer.ValuatePointer()

Signature

Pointer.ValuatePointer(iStartObject : ObjectType, iBind : String, type : String)

Arguments

Name Input/Output Required? Type Comment
iStartObject In ObjectType -
iBind In String -
type In String -

Example

			

String.MatchPattern()

String.MatchPattern()

Signature

String.MatchPattern(iPattern : String) : Boolean

Arguments

Name Input/Output Required? Type Comment
iPattern In String -

ReturnType

Boolean

Example

			

String.NormalizedLength()

Signature

String.NormalizedLength() : Integer

ReturnType

Integer

String.MatchPattern()

Checks if the given string matches the pattern and returns TRUE if it does, and FALSE if it does not.

Signature

String.MatchPattern(iPattern : String) : Boolean

Arguments

Name Input / Output Required? Type Comment
iPattern In Yes String Pattern name.

ReturnType

Boolean

Example

let referenceString = "testString12345678"
let patternToMatch = "test...ing[1-8]{8}"
Notify(referenceString+" matches "+ patternToMatch +" = #",referenceString.MatchPattern(patternToMatch))
patternToMatch = "test...ing[1-8]{7}"
Notify(referenceString+" matches "+ patternToMatch +" = #",referenceString.MatchPattern(patternToMatch))
patternToMatch = "test...ing[1-5]{8}"
Notify(referenceString+" matches "+ patternToMatch +" = #",referenceString.MatchPattern(patternToMatch))
patternToMatch = ".*1[2-8]*"
Notify(referenceString+" matches "+ patternToMatch +" = #",referenceString.MatchPattern(patternToMatch))

The result of the above example is the following:

testString12345678 matches ...ing[1-8]{8} = true
testString12345678 matches ...ing[1-8]{7} = false
testString12345678 matches ...ing[1-5]{8} = false
testString12345678 matches .*1[2-8]* = true

Note: In the example above:
  • The first pattern matches a string that starts with "test", and that continues with three characters (as the number of points indicates the number of characters to skip), then contains the sequence "ing" and ends with eight digits between 1 and 8. [8] means 8 times the pattern given between [], 1-8 indicates that the character to match is a digit between 1 and 8. The string “testString12345678” and “testString13213745” match this description. True is returned.
  • The second pattern does not match the reference string because it matches a String made of seven digits. The reference has eight digits.
  • The third pattern fails to match the reference string because the eight digits are the end of the string and are out of the [1-5] range.
  • The last pattern describes a string that starts with any character, repeated 0 to n times (it means that the string can start with virtually anything), then contains a "1" followed by digits between 2 and 8. The 1 located before the digits between 2 and 8 is compulsory. The reference string matches this description. True is returned.

String.SearchPattern()

Searches for an occurrence of the pattern in the string and returns it.

Signature

String.SearchPattern(iPattern : String) : String

Arguments

Name Input / Output Required? Type Comment
iPattern In Yes String Pattern name.

ReturnType

String

Example

let referenceString = "test1test2test3test4"
let patternToSearch = "....1"
Notify("Searching "+ patternToSearch +" in "+referenceString+" found #",referenceString.SearchPattern(patternToSearch))
patternToSearch = "(test[2-9]){2}"
Notify("Searching "+ patternToSearch +" in "+referenceString+" found #",referenceString.SearchPattern(patternToSearch))

The result of the above example is the following:

Searching .... 1 in test1test2test3test4 found test1
Searching (test[2-9]){2} in test1test2test3test4 found test2test3

Note: In the example above:
  • The first pattern matches any string made up of five characters ending with 1.
  • The second pattern matches any string containing "test" and a digit between 2 and 9, repeated twice. The string searched for contains "testXtestY" with X and Y between 2 and 9. Only one search is executed, but it looks for a string containing a repeated pattern.
  • List of supported characters in regular expressions. Regular expressions are a way used to describe strings used to retrieve sub-strings or to check that a given string matches the following criteria:
    / Default escaping character.
    Repetitive patterns
    • o x{n} matches n time x
    • o x{n,m} matches n to m times x
    • o x{n,} matches at least n times x
    • o x? matches 0 or 1 time x
    • o x+ matches at least one time x
    • o x* matches at least 0 time x
    Alternate Alternate operator is | ex: x|y match x pattern or y
    Support range and wildcard
    • . any character
    • /w matches any character of the ascii table (a-z, A-Z, 0-9) and the "$" character.
    • /W matches any character not matched by /w.
    • /s any space
    • /S any non space
    • /d any digit
    • /D any non digit
    • /x any hexadecimal digit
    • /X any non hexadecimal digit
    • /u matches any upper case character (works only for latin1) [A-ZÂÊÎÔÛÄËÏÖÜ...]
    • /l matches any lower case character (works only for latin1) [a-zâêîôûäëïöü...]
    • /t matches a tab
    • /f matches a form feed
    • /n matches a new line
    • /r matches a carriage return
    • range can be defined using []. "/" is usually more efficient. Example: /d is more efficient than [0-9].

String.ToDimension()

Signature

String.ToDimension(iMagnitude : String) : Magnitude

Arguments

Name Input / Output Required? Type Comment
iMagnitude In Yes String -

ReturnType

Magnitude

String.ToReal()

Signature

String.ToReal() : Real

ReturnType

Real