From f26bf5c507a420539efd56ddaa22fc36b2f994cd Mon Sep 17 00:00:00 2001 From: srn Date: Thu, 5 May 2005 11:51:26 +0000 Subject: [PATCH] BugID IPAL8745, IPAL8744. Modified method DumpStudy, now if the components are not loaded they will be loaded when study dumps their content in the Python script. The name of the main script now coincides with that given as input parameter, without an addion a suffix _Study. --- src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 39 +++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index b2a74a8b7..a9ec0ac70 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -1246,9 +1246,9 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, } #ifdef WIN32 - TCollection_AsciiString aFileName=thePath+TCollection_AsciiString("\\")+theBaseName+TCollection_AsciiString("_Study.py"); + TCollection_AsciiString aFileName=thePath+TCollection_AsciiString("\\")+theBaseName+TCollection_AsciiString(".py"); #else - TCollection_AsciiString aFileName=thePath+TCollection_AsciiString("/")+theBaseName+TCollection_AsciiString("_Study.py"); + TCollection_AsciiString aFileName=thePath+TCollection_AsciiString("/")+theBaseName+TCollection_AsciiString(".py"); #endif //Create a file that will contain a main Study script @@ -1280,8 +1280,41 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, for(int i = 1; i <= aLength; i++) { aCompType = aSeq.Value(i); + Handle(SALOMEDSImpl_SComponent) sco = FindComponent(aCompType); + SALOMEDSImpl_Driver* aDriver = NULL; +cout << "Processing " << aCompType << endl; +cout << 1 << endl; + // if there is an associated Engine call its method for saving + TCollection_AsciiString IOREngine; + try { + if (!sco->ComponentIOR(IOREngine)) { + cout << 2 << endl; + if (!aCompType.IsEmpty()) { + + aDriver = theFactory->GetDriverByType(aCompType); + + if (aDriver != NULL) { + Handle(SALOMEDSImpl_StudyBuilder) SB = NewBuilder(); + cout << "Before SB" << endl; + if(!SB->LoadWith(sco, aDriver)) { + _errorCode = SB->GetErrorCode(); + return false; + } + cout << "After SB" << endl; + } + else continue; + } + } + else { + aDriver = theFactory->GetDriverByIOR(IOREngine); + } + } catch(...) { + _errorCode = "Can not restore information to dump it"; + return false; + } + +cout << 3 << endl; - SALOMEDSImpl_Driver* aDriver = theFactory->GetDriverByType(aSeq.Value(i)); if(aDriver == NULL) continue; bool isValidScript; -- 2.39.2