Skip to main content

PsimConvertToPython

Usage

psim.PsimConvertToPython();

Python Help

py.help(psim.PsimConvertToPython)

Python def

PSIM 2024 and above:

def PsimConvertToPython(self, SchematicFilePath, PythonFilePath) :
if not self.IsValid():
print("PSIM object was not loaded.")
return 0;

ConvertToPythonW = getattr(self.psimHandle, "ConvertToPythonW")
if not ConvertToPythonW:
raise AttributeError(self.VersionErrorMessage)

ConvertToPythonW.restype = ctypes.c_int
# BOOL ConvertToPythonW(const wchar_t* szSchematicFilePath, const wchar_t* szPythonFilePath)

res = ConvertToPythonW(ctypes.c_wchar_p(SchematicFilePath), ctypes.c_wchar_p (PythonFilePath)); #returns 0 on error
if res == 0 :
print("Unable to convert schematic file to Python script: " + SchematicFilePath)
return 0;

return 1