def PsimIsSubcircuit(self, schFilePath_or_Obj):
if not self.IsValid():
print("PSIM object was not loaded.")
return 0;
sch_closeFile = False
schHandle = 0
if isinstance(schFilePath_or_Obj, PSIM_schematic):
schHandle = schFilePath_or_Obj.value
elif isinstance(schFilePath_or_Obj, str):
schFilePath = schFilePath_or_Obj
SimOpenSchematicFileW = getattr(self.psimHandle, "SimOpenSchematicFileW")
if not SimOpenSchematicFileW:
raise AttributeError(self.VersionErrorMessage)
SimOpenSchematicFileW.restype = ctypes.c_int
schHandle = SimOpenSchematicFileW(ctypes.c_wchar_p(schFilePath), ctypes.c_int (1));
if schHandle == 0 :
print("Unable to open schematic file " + schFilePath)
return 0;
sch_closeFile =True
elif schFilePath_or_Obj is None:
print("in PsimIsSubcircuit function, schFilePath_or_Obj is None")
else:
print("in PsimIsSubcircuit function, schFilePath_or_Obj is of an unknown type")
IsSub = getattr(self.psimHandle, "SimIsSubcircuit")
if not IsSub:
raise AttributeError(self.VersionErrorMessage)
res = IsSub(schHandle)
if sch_closeFile:
CloseSchematicFile = getattr(self.psimHandle, "SimCloseSchematicFile")
if not CloseSchematicFile:
raise AttributeError(self.VersionErrorMessage)
CloseSchematicFile.restype = ctypes.c_int
CloseSchematicFile(schHandle);
return res