Global Constants

The following global constants are available:

Global constants

Use

Version As String

Returns the application version string

HomeDirectory As String

Returns the application home directory string

RegistryHome As String

Returns the application registry home path string

cls_... As Long

Identifies the class of an object. This value is used when you need to specify an object kind in creation method for example. This value is also used by IsKindOf method available on all PowerDesigner objects

Classes Ids Constants

Constants are unique within a model and are used to identify object classes in each library. All classes Ids start with "cls_" followed by the public name of the object. For example cls_Process identifies the Process object class using the public name of the object.

However, when dealing with several models, some constants may be common, for example cls_Package.

To avoid confusion in code, you must prefix the constant name with the name of the module, for example PdOOM.cls_Package. Same, when you want to create a model, you need to prefix the cls_Model constant with the name of the module.

IsKindOf Method

You can use the IsKindOf (ByVal Kind As Long) As Boolean method together with a class constant in order to check if an object inherits from a given class kind.

Example:

You can have a script with a loop that browses the Classifiers collection of an OOM and wants to check the type of encountered objects (in this case interfaces or classes) in order to perform different actions according to their type.

'Assuming the Activemodel is an OOM model
For each c in Activemodel.Classifiers
If c.IsKindOf(cls_Class) then
Output "Class " & c.name
ElsIf c.IsKindOf(cls_Interface) then
Output "Interface" & c.name
End If
Next

Example:

All the collections under a model can contain objects of a certain type but also shortcuts for objects of the same type. You can have a script with a loop that browses the Tables collection of a PDM and want to check the type of encountered objects (in this case tables or shortcuts) in order to perform different actions according to their type.

For each t in Activemodel.Tables
If t.IsKindOf(cls_Table) then
Output t.name
End If
Next