How to import/export pfd files by a Script?

Category:
Scripting
Answer

For this task of importing and exporting of projects, you can use CompfdImport and CompfdExport command objects.

Python example of importing a PowerFactory pfd project direct under user location:

import powerfactory
app=powerfactory.GetApplication()
script=app.GetCurrentScript()
importObj=script.CreateObject('CompfdImport','Import')

importObj.SetAttribute("e:g_file",r"C:\Users\...\projectToImport.pfd")

location=app.GetCurrentUser()
importObj.g_target=location

importObj.Execute()

Back