How can I automatically export all plots available in a project?

Category:
Scripting
Answer

Graphics such as plots or single line diagrams can be exported using scripts. PowerFactory supports two scripting languages Python and DPL.

The following Python script example exports all plots and network diagrams within the currently active Graphics Board.

import powerfactory
app = powerfactory.GetApplication()

SetDesktop = app.GetGraphicsBoard()

# Export network graphics
for SetDeskpage in SetDesktop.GetContents('*.SetDeskpage'):
    SetDeskpage.Show()
    file_name = f'D:\\tmp\\{SetDeskpage.GetAttribute("loc_name")}'
    SetDesktop.WriteWMF(file_name)

# Export diagrams for GrpPage in SetDesktop.GetContents('*.GrpPage'):
    GrpPage.Show()
    file_name = f'D:\\tmp\\{GrpPage.GetAttribute("loc_name")}'
    SetDesktop.WriteWMF(file_name)

Note:

For PowerFactory 2020 and earlier versions the graphic objects (GrpPage) must be exchanged with respective VI-objects (virtual instrument).

Back