Object Functions

This package deals with the object functions.

This page discusses:

ExecuteVBResource

This function executes a VBScript macro or a VBA macro stored in the database. The macros are referenced through a Resource Table or a Data Setup table.

Note: In the function, you can pass input parameters by reference by prefixing the parameter's name with the ByRef keyword. This methodology returns the modified parameters from a VBA macro back to the initial EKL code where this macro is called. This methodolgy is not available for VBScript macros.

Signature

ExecuteVBResource(iARMPath : String, iFunctionToExecute : String, oReturnedValue : ObjectType [, iParameters : ObjectType, ..])

Arguments

Name Input/Output Required? Type Comment
iARMPath In Yes String -
iFunctionToExecute In Yes String -
oReturnedValue In Yes ObjectType -
iParameters In No ObjectType -

Example

Let stringArg1 (String)
Let stringArg2(String)

stringArg1 = "Test-String-1"
Message("Initial value of stringArg1 :  # ", stringArg1)

stringArg2 = "Test-String-2"
Message("Initial value of stringArg2 :  # ", stringArg2)

// Execute VB Macro  
// "Macro_Function_ResourceTable" – Name of VB Macro resource as mentioned in Resource Table
//  MacroFunction – Name of Function in VB Macro
//  Modify stringArg1 and stringArg2 inside VB Macro  
ExecuteVBResource("Macro_Function_ResourceTable", "MacroFunction", "" , stringArg1, "stringArg1", stringArg2, "ByRef stringArg2")


// Display "Test-String-1", as stringArg1 argument was passed by Value
// Hence argument modified in VB Macro is not returned
Message("Final value of stringArg1 :  # ", stringArg1)

// Display " Modified Test-String-2" as stringArg2 argument was passed by Reference
// Hence argument modified in VB Macro is returned back
Message("Final value of stringArg2 :  # ", stringArg2)

NewFunctionCheckPreexisting

This function modifies the default behavior of the new function in EKL.

The new function takes a type, name, and an owner as the first, second, and third arguments. When executed, it tries to retrieve an existing object in the owner with the right name and type. If this object is found, it is returned.

This has a cost and it can be convenient to deactivate this built-in search behavior by using NewFunctionCheckPreexisting(False). You can later on reactivate the check (NewFunctionCheckPreexisting(True). This deactivation is local to the expression.

Signature

NewFunctionCheckPreexisting(val : Boolean)

Arguments

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

RetrieveNamingParameters

Signature

RetrieveNamingParameters(Type : String, Prefix : String, Interfix : String, Suffix : String)

Arguments

Name Input/Output Required? Type Comment
Type In Yes String -
Prefix Out Yes String -
Interfix Out Yes String -
Suffix Out Yes String -

RetrieveNamingParametersWithSeparator

In a baseline environment, when an object is created, the Name attribute is automatically defined based on the following predefined format: Prefix-Interfix-Counter-Suffix. The Prefix, Interfix, Suffix, and separator (-) fields are characters string defined as installed that can be configured using the Configuration console (Manage People and Content). Prefix and Suffix are specific to a given type whereas Interfix and separator apply to all types of a given platform. The separator can have the following values:

  • "-"
  • "_"
  • "."
  • "/"
  • "+"
  • no separator at all.
The RetriveNamingParametersWithSeparator() function allows retrieving the different items of the naming scheme for an object type.

Signature

RetrieveNamingParametersWithSeparator(ModelingTypeName : String, NamingTypePrefix : String, SiteAffix : String, NamingTypeSuffix : String, Separator : String, AbbreviatedBaseType : String)

Arguments

Name Input/Output Required? Type Comment
ModelingTypeName In Yes String The type (input) whose naming elements are sought.
NamingTypePrefix Out Yes String The first field of the naming format, specific to a given type. Notice that this prefix is initialized with the abbreviation defined for a given type (for example “prd” for type “Physical Product”).
SiteAffix Out Yes String common to all business types.
NamingTypeSuffix Out Yes String The end of the naming format, specific to a given type
Separator Out Yes String Character separating the various Naming Elements, common to all business types.
AbbreviatedBaseTypeName Out Yes String The base type for which an abbreviation is first defined in the inheritance path of the Modeling Type (see details below).

Example

Let ModelingTypeName(String)
Let AbbreviatedBaseTypeName(String)
Let Separator(String) 
Let NamingTypePrefix(STRING)
Let SiteAffix(STRING)
Let NamingTypeSuffix(STRING)
...

RetrieveNamingParametersWithSeparator(ModelingTypeName,NamingTypePrefix,SiteAffix,NamingTypeSuffix,Separator,AbbreviatedBaseTypeName)

...

FindType

Returns an object representing the type name passed in argument.

Signature

FindType(TypeName: String) : Type

Arguments

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

ReturnType

Type

new

Creates objects based on the object's type name. It enables you to create a limited list of Applicative Objects:

  • 3D Part, 3D Shape, Product Reference, Drawing in Product Structure domain
  • Functional Reference, Logical Reference, and Logical Port in the functional/logical domain
  • Geometric datum of the following types (Curve, Surface, Point, Plane, Line, Circle)
  • VolatileInstance: an object that is local to the rule (with no persistency) enabling to hold attributes added dynamically with SetAttribute methods
Note: This function works at runtime, only with a DPX license. The license corresponding to the application is also necessary.

Signature

new(type: String, name: String, father: ObjectType [, freeArguments: ObjectType, ..]) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
type In Yes String Defines what kind of object must be created. It is a mandatory argument. The list of possible values is the following:
  • 3D part, 3D shape, VPMReference, Drawing
  • RFLVPMLogicalReference, RFLPLMFunctionalReference, RFLVPMLogicalPort
  • Curve, Surface, Point, Plane, Line, Circle
  • VolatileInstance
Note: If you provide a wrong type name, an evaluation error is raised (Error in the function new: first argument <type> is not an existing type) and the function returns a NULL value. If you provide a type that cannot be instantiated, an evaluation error is raised (Error in the function new: first argument <type> is not a type that can be instantiated) and the function returns a NULL value. If you do not have the DPX license, an evaluation is raised (Error in the function new: you do not have the runtime license to operate a new from the language).
name In Yes String Specifies the name of the created object. If this area is left blank, the system automatically computes a default name.
father In Yes ObjectType Object where the new object is to be aggregated. It is not always mandatory. When a Father is defined, the result of the New is an Instance for PLM objects. When the father is undefined, the result of the New is a Reference for PLM objects.
Note: If a Father is specified, and if it already aggregates an object with the same name, the New method does not create another object. It returns the object.

Important: In case you try to aggregate a child object under a parent that does not support it, an evaluation error is raised (Error in the function new: impossible to create an object of type <type>under the object <father> of type <fatherType>).

This function returns a NULL value.

Important: Important: In the case you try to aggregate a child object under a parent that does not support it, an evaluation error is raised (Error in the function new: impossible to create an object of type <type>under the object <father> of type <fatherType>). This function returns a NULL value.
freeArguments In No ObjectType -

ReturnType

UndefinedType

Example

let x(VPMReference)
x = new ("VPMReference","MyReference",NULL) /* creates a new VPMReference */