How to activate study case via Python?

Category:
Scripting
Answer

Method GetProjectFolder() helps you with the navigation through folders inside of the project. It returns the project folder of a given type of active project. You can use this method to access Study Case folder and that call GetContents() or GetChildren() to access the contents of the Study Case folder.

For example:

import powerfactory

app = powerfactory.GetApplication()

FolderWhereStudyCasesAreSaved= app.GetProjectFolder('study')

app.PrintPlain(FolderWhereStudyCasesAreSaved)

AllStudyCasesInProject= FolderWhereStudyCasesAreSaved.GetContents()

for StudyCase in AllStudyCasesInProject:

   app.PrintPlain(StudyCase)

   StudyCase.Activate()

Back