You can access and modify any PowerDesigner object and its properties by script. Objects include not only standard design objects (such as tables, classes, processes, and columns), but also diagrams and symbols and functional objects (such as a report or repository). An object belongs to a metaclass of the PowerDesigner metamodel and inherits properties, collections and methods from its metaclass.
Parameter | Description |
---|---|
Name / Code / Path | Specifies the name or code of, or the path to the object. For example, to find the column Address in the table Customer in the package Sales from the context of the model node, you could search by name Address or by path Sales/Customer/Address. |
Kind | Specifies the metaclass of the object to find in
the form cls_PublicName. For example, to find a
column, select cls_Column. These metaclass ids are unique within their model library but, in cases such as packages, which appear in multiple types of models, you must prefix the id with the name of the module (PdOOM.cls_Package). When you create a model, you must use the module prefix (for example PdPDM.cls_Model). |
OptionalParams | The following parameters are optional:
|
Dim MyModel, C, P 'Open model file Set MyModel=OpenModel(EvaluateNamedPath("%_EXAMPLES%\" & "UML2 Sample.oom")) 'Obtain class and parameter Set C=MyModel.FindChildByName("OrderManager",cls_Class) Set P=Mymodel.FindChildByPath("SecurityManager/CheckPassword/login",PdOOM.cls_Parameter) 'Print initial values Output "Initial Values:" PrintProperties C, P 'Modify values C.Comment="This class controls orders." C.SetAttributeText "Visibility", "private" P.Name="LoginName" 'Print revised values Output "Revised Values:" PrintProperties C, P 'Procedure for printing values Sub PrintProperties(MyClass, MyParam) output "Class: " & MyClass.Name output vbTab & "Comment: " & MyClass.Comment output vbTab & "Visibility: " & MyClass.GetAttributeText("Visibility") output vbTab & "Persisted as: " & MyClass.GetAttributeText("PersistentGenerationMode") output "Parameter: " & MyParam.Parent & "." & MyParam.Name output vbTab & "Data type: " & MyParam.DataType output vbTab & "Parameter type: " & MyParam.GetAttributeText("ParameterType") End Sub