Object Type

Attributes

ID:String

Owner:Feature

Name:String

NamedURLs:List

UserInfoComment:String

Layer

ListAttributeNames

AddExtension

RemoveExtension

Delete

Id:String

Defines the object identifier, i.e. the name primarily assigned to the object at creation before any renaming has been done. This attribute cannot be modified.

Owner:Feature

Defines the parent (in the tree) of the object. This attribute cannot be modified. It can be NULL if the object has no parent.

Name:String

Defines the feature name. This name can be read or written. It usually corresponds to the name in the tree.

NamedURLs:List

Describes the URL that the user can add to an object by clicking the Comment and URLs icon in the Knowledge Advisor workbench.It can also be modified. Not all the objects are supporting this capability.

UserInfoComment:String

Describes the comment that the user can add in the Comment and URLs dialog box when adding a URL to an object in the Knowledge Advisor workbench. This comment can be modified in the rule. Not all the objects are supporting this capability.

Children:List

Lists the objects aggregated under an object (usually the objects in the tree). It doesn’t return the parameters aggregated under an object. This attribute cannot be modified. The list can be empty.

Feature       >       Layer

Method allowing you to get/set the layer associated with a feature.

Example

  1. Create a part with several holes.

  2. Add a real type parameter ("Real.1" for example) to one of the hole features. To do this, use the Parameter Explorer in the Knowledge Advisor product.

  3. Create the rule below:

    /* This rule resets the diameter of the hole */
    /*Hole is the type*/
    /* which has "Real.1" as its parameter to the Real.1 value */
    (for all) H:Hole
    if H      >      HasAttribute("Real.1")
    H.Diameter = 1mm*(H      >      GetAttributeReal("Real.1"))

Methods   

The available objects methods are displayed in the table below:

AbsoluteId Method AttributeType Method GetAttributeBoolean Method
GetAttributeInteger Method GetAttributeObject Method GetAttributeReal Method
GetAttributeString Method HasAttribute Method ID Method
IsOwnedBy Method IsSupporting Method Name Method
Query Method SetAttributeBoolean Method SetAttributeDimension Method
SetAttributeInteger Method SetAttributeObject Method SetAttributeReal Method
SetAttributeString Method Update ListAttributeNames

AbsoluteId Method  

Retrieves the path of a feature. Note that this feature is not NLS (it will not be translated into your language and remains in english.)

Syntax

feature       >       AbsoluteId(): String

Example

String.2=PartBody\Pad.1.Id() + PartBody\Pad.1       >       AbsoluteId()

Sample

KwrTopology.CATPart 

AttributeType Method  

Returns the attribute type in the form of a string.

AttributeDelete Method  

Deletes 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).

Note: The Delete method cannot be used on all Knowledge artifacts. In this case, the control is performed at runtime and an error message is raised. It can be used in Knowledge expert rules, and in Business Process Knowledge template behaviors. It is not available in standard Knowledge advisor rules, reactions, and actions.

Syntax

Feature.Delete()

GetAttributeBoolean Method  

Returns the value of a boolean type parameter added to a given object by using the Knowledge Advisor product. parameterName is the name of the boolean type parameter. It must be put between quotation marks (").This method enables you to read:

Unless you know perfectly that your feature has an attribute xxx, use before the HasAttribute method.

Syntax

feature       >       GetAttributeBoolean(String): Boolean where the argument  is name of the attribute.

Example

Message ("The value of the Boolean.1 attribute of # is #",
PartBody\Pad.1.Name(),
PartBody\Pad.1       >       GetAttributeBoolean("Boolean.1"))

Sample

KwrObject.CATPart 

GetAttributeInteger Method  

Returns the value of an integer type parameter added to a given object by using the Knowledge Advisor product. parameterName is the name of the string type parameter. It must be put between quotation marks ("). This method enables you to read:

Syntax

feature       >       GetAttributeInteger(String): Integer where String is name of the attribute. This name must be put between double-quotes.

Example

Integer.3=PartBody\Hole.1        >       GetAttributeInteger("Integer.2")

Sample

KwrObject.CATPart 

GetAttributeReal Method  

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

Syntax

feature       >       GetAttributeReal(String): String where String is name of the attribute. This name must be put between double-quotes.

GetAttributeString Method  

Returns the value of a string type parameter added to a given object by using the Knowledge Advisor product. parameterName is the name of the string type parameter. This method enables you to read:

Syntax

feature       >       GetAttributeString(String): String where String is name of the attribute. This name must be put between double-quotes.

Example

String.2 =PartBody\Pad.1       >       GetAttributeString("String.1")

Sample

KwrObject.CATPart 

GetAttributeObject Method    

Reads the attribute "attributeName" of the object and returns an object. This method is also used to return List attributes and parameters.

Note that this method can return an object of any type. It operates like the List  >  GetItem method. As a consequence, you can put the result of this method in a variable of any kind of type. But when the rule is executed, if the object types are not compatible, the variable will be Unset.
 

Syntax

feature       >       GetAttributeObject(String): Feature

where String is name of the attribute. This name must be put between double-quotes.

Example

Let L(List)

L= PartBody\Pad.1       >       GetAttributeObject("List.1")

 

HasAttribute Method    

Determines whether the attribute specified in the argument belongs to the object to which the method is applied.

Syntax

feature       >       HasAttribute(String): Boolean

where String is name of the attribute. This name must be put between double-quotes.

Example

Boolean.2 =
PartBody\Hole.1       >       HasAttribute("Real.1")

Sample

KwrObject.CATPart 

Id Method  

Obsolete. You can now use the Id attribute.

IsOwnedBy Method    

Determines 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 (").

Syntax

feature       >       IsOwnedBy(): Boolean

Example

Boolean.1=PartBody\Hole.1       >       IsOwnedBy(PartBody)

Sample

Topology.CATPart 

IsSupporting    

Function indicating if the object passed in argument implements a given type.

Syntax

Feature       >       IsSupporting(type : String): Boolean

Example

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

Name Method  

Obsolete. You can now use the Name attribute.

SetAttributeBoolean Method    

Assigns 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.

Syntax

feature       >       SetAttributeBoolean(String, Boolean): Void where the first argument  is name of the attribute and the second is the value to be assigned to it.

Example

if PartBody\Pad.1\Boolean.1 <> true
PartBody\Pad.1       >       SetAttributeBoolean("Boolean.1", true)

Sample

KwrObject.CATPart 

SetAttributeReal Method    

Assigns 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 (").

Syntax

feature       >       SetAttributeReal(String, Real): Void

where String is name of the attribute and Real the value to be assigned to the parameter (MKS dimensions).

Example

if PartBody\Hole.1\Real.1 <> 3
PartBody\Hole.1       >       SetAttributeReal("Real.1",3)

Sample

KwrObject.CATPart 

SetAttributeString Method    

Assigns 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 (").

Syntax

feature       >       SetAttributeString(String, String): Void where the first argument  is name of the attribute and the second is the value to be assigned to it.

Example

if PartBody\Pad.1       >       GetAttributeString("String.1") <> "String1"
PartBody\Pad.1       >       SetAttributeString("String.1","This is a test")

Another syntax for the same rule is:

if PartBody\Pad.1\String.1 <> "String1"
PartBody\Pad.1       >       SetAttributeString("String.1","This is a test")

Sample

KwrObject.CATPart 

SetAttributeInteger Method    

Assigns 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.  parameterName must be put between quotation marks (").

Syntax

feature       >       SetAttributeInteger(String, Integer): Void where the first argument  is name of the attribute and the second is the value to be assigned to it.

Example

if PartBody\Hole.1\Integer.1 <> 3
PartBody\Hole.1       >       SetAttributeInteger("Integer.1", 3)

Sample

KwrObject.CATPart 

SetAttributeDimension Method  

Assigns 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.

Syntax

feature       >       SetAttributeDimension(String, Real, String): Void Type where the first argument  is name of the attribute, the second is the value to be assigned to it and the third is the type.

SetAttributeObject Method  

Writes the attribute "attributeName" of the object with what is referenced by the pointer o It will allow to pass 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.

Syntax

feature       >       SetAttributeObject(String, Feature): VoidType

Update Method   

Performs the update of 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.

Syntax

feature       >       Update(): VoidType

Example

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

ListAttributeNames 

It returns 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 on the object, either trough the Parameter Explorer command or through the SetAttribute methods.

Syntax

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

Example

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

AddExtension  

 

Make sure that you have the BK2 license to use the method here below.

Enables you to add a BKT type on all mechanical features and products.

Syntax

Feature      >      AddExtension (type: String): UndefinedType Package: CATPackageMethodObject

Example

P : Part

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

RemoveExtension  

Make sure that you have the BK2 license to use the method here below.

Enables you to remove a BKT type on all mechanical features and products.

Syntax

Feature        >        RemoveExtension (type: String) IntegerPackage: TechnologicalObjectsLibraryFunctions

Example

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

Delete

Enables you to remove a n object. Be very careful. It does not work on all objects.

Syntax

Feature        >        Delete (): Void

Example

p        >        Delete()
/* p is unset afterwards */