You can manipulate the contents of a model by creating or opening it
and then descending from the model root through collections of objects. A number of global
properties, functions, and constants are available in any context and provide entry points
for your scripts.
The following global properties provide access to the Workspace and
models it contains:
- ActiveWorkspace - Retrieves
the current Workspace.
- ActiveModel, ActivePackage, and ActiveDiagram - Retrieves the model, package, or diagram with
current focus.
- ActiveSelection - Read-only
collection of the objects selected in the active diagram.
- Models - Read-only
collection of models open in the current Workspace.
- RepositoryConnection -
Retrieves the current repository connection (see Manipulating the Repository (Scripting)).
The following global functions are commonly used to create or open models and perform
actions upon them:
- CreateModel() and OpenModel() - Create and
open a model (see Creating and Opening Models (Scripting)).
- Output() - Prints text to the Script
tab of PowerDesigner's Output window.
- IsKindOf() - Tests the metaclass of the object.
- ExecuteCommand() - Launches an external application
- EvaluateNamedPath() and MapToNamedPath() -
Manage named paths in model files.
- BeginTransaction(), CancelTransaction(),
and EndTransaction() - Start, cancel, and commit
transactions.
The following global constants provide information about the instance of PowerDesigner:
- UserName - Retrieves the user login name.
- Version - Returns the PowerDesigner version.
- HomeDirectory - Returns the application home
directory.
- RegistryHome - Returns the application registry home
path.
- Viewer - Returns True if the running application is a
Viewer version that has limited features.
- ValidationMode - By default, PowerDesigner performs various
checks to validate your actions and gives an error in the case of a
forbidden action. You can set ValidationMode = False (which
turns off validation rules such as name uniqueness or link extremities) to
improve performance or if your algorithm temporarily requires an invalid
state.
- InteractiveMode - Specifies the level of interaction
required. You can choose between:
-
im_Batch [default] - Suppresses dialog boxes and
always uses default values. For example, if your model contains
external shortcuts and the target model for the shortcuts is
closed, this mode will automatically open the model without user
interaction.
-
im_Dialog - Displays information and
confirmation dialog boxes that require user interaction for the
execution to keep running.
-
im_Abort - Suppresses dialog boxes and aborts
execution if a dialog is encountered.
- ShowMode [OLE-specific] - Checks or changes the visibility
status of the main application window. Returns True if the
application main window is visible and not minimized.
- Locked [OLE-specific] - When set to True,
ensures that PowerDesigner continues to run even after an OLE client
disconnects.
For detailed information about all the global properties, constants, and functions,
select and navigate to Basic Elements.