Skip to main content

PsimFileOpen

Usage

psim.PsimFileOpen();

Python Help

py.help(psim.PsimFileOpen)

Python def

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

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

SimOpenSchematicFileW.restype = ctypes.c_int
# int SimOpenSchematicFileW(const wchar_t * szFileName, UINT nFlag)

if (SchematicFilePath is None) or (SchematicFilePath == ""):
return PSIM.PsimFileNew(self);

SchematicID = SimOpenSchematicFileW(ctypes.c_wchar_p(SchematicFilePath), ctypes.c_int (0X00001000)); #returns 0 on error
if SchematicID == 0 :
print("Unable to open schematic file " + SchematicFilePath)
return None;
sch = PSIM_schematic(self, SchematicID)
return sch
# try:
# yield sch
# finally:
# # This will be executed when the context is exited
# sch.free()