mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-15 18:01:22 +05:00
Issue 0013373: EDF PAL 273 : Option Single/Multi file dump
This commit is contained in:
parent
723f0c59fb
commit
c3caa78045
@ -561,6 +561,7 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
std::vector<TObjectData>& theObjectData,
|
std::vector<TObjectData>& theObjectData,
|
||||||
TVariablesList theVariables,
|
TVariablesList theVariables,
|
||||||
bool isPublished,
|
bool isPublished,
|
||||||
|
bool isMultiFile,
|
||||||
bool& aValidScript)
|
bool& aValidScript)
|
||||||
{
|
{
|
||||||
// Set "C" numeric locale to save numbers correctly
|
// Set "C" numeric locale to save numbers correctly
|
||||||
@ -569,13 +570,22 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
TCollection_AsciiString aScript;
|
TCollection_AsciiString aScript;
|
||||||
Handle(TDocStd_Document) aDoc = GetDocument(theDocID);
|
Handle(TDocStd_Document) aDoc = GetDocument(theDocID);
|
||||||
|
|
||||||
if (aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n");
|
if (aDoc.IsNull())
|
||||||
|
{
|
||||||
|
TCollection_AsciiString anEmptyScript;
|
||||||
|
if( isMultiFile )
|
||||||
|
anEmptyScript = "def RebuildData(theStudy): pass\n";
|
||||||
|
return anEmptyScript;
|
||||||
|
}
|
||||||
|
|
||||||
aScript = "import GEOM\n";
|
aScript = "import GEOM\n";
|
||||||
aScript += "import geompy\n";
|
aScript += "import geompy\n";
|
||||||
aScript += "import math\n";
|
aScript += "import math\n";
|
||||||
aScript += "import SALOMEDS\n\n";
|
aScript += "import SALOMEDS\n\n";
|
||||||
aScript += "def RebuildData(theStudy):";
|
if( isMultiFile )
|
||||||
|
aScript += "def RebuildData(theStudy):";
|
||||||
|
else
|
||||||
|
aScript += "theStudy = salome.myStudy";
|
||||||
aScript += "\n\tgeompy.init_geom(theStudy)\n";
|
aScript += "\n\tgeompy.init_geom(theStudy)\n";
|
||||||
|
|
||||||
AddTextures(theDocID, aScript);
|
AddTextures(theDocID, aScript);
|
||||||
|
@ -139,6 +139,7 @@ class GEOM_Engine
|
|||||||
std::vector<TObjectData>& theObjectData,
|
std::vector<TObjectData>& theObjectData,
|
||||||
TVariablesList theVariables,
|
TVariablesList theVariables,
|
||||||
bool isPublished,
|
bool isPublished,
|
||||||
|
bool isMultiFile,
|
||||||
bool& aValidScript);
|
bool& aValidScript);
|
||||||
|
|
||||||
Standard_EXPORT const char* GetDumpName (const char* theStudyEntry) const;
|
Standard_EXPORT const char* GetDumpName (const char* theStudyEntry) const;
|
||||||
|
@ -36,6 +36,25 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : RemoveTabulation
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void RemoveTabulation( TCollection_AsciiString& theScript )
|
||||||
|
{
|
||||||
|
std::string aString( theScript.ToCString() );
|
||||||
|
std::string::size_type aPos = 0;
|
||||||
|
while( aPos < aString.length() )
|
||||||
|
{
|
||||||
|
aPos = aString.find( "\n\t", aPos );
|
||||||
|
if( aPos == std::string::npos )
|
||||||
|
break;
|
||||||
|
aString.replace( aPos, 2, "\n" );
|
||||||
|
aPos++;
|
||||||
|
}
|
||||||
|
theScript = aString.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : DumpPython
|
//function : DumpPython
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -43,7 +62,8 @@
|
|||||||
|
|
||||||
Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
|
Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
|
||||||
CORBA::Boolean isPublished,
|
CORBA::Boolean isPublished,
|
||||||
CORBA::Boolean& isValidScript)
|
CORBA::Boolean isMultiFile,
|
||||||
|
CORBA::Boolean& isValidScript)
|
||||||
{
|
{
|
||||||
SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
|
SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
|
||||||
if(CORBA::is_nil(aStudy))
|
if(CORBA::is_nil(aStudy))
|
||||||
@ -98,7 +118,7 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
TCollection_AsciiString aScript;
|
TCollection_AsciiString aScript;
|
||||||
aScript += _impl->DumpPython(aStudy->StudyId(), objectDataVec, aVariableMap, isPublished, isValidScript);
|
aScript += _impl->DumpPython(aStudy->StudyId(), objectDataVec, aVariableMap, isPublished, isMultiFile, isValidScript);
|
||||||
|
|
||||||
if (isPublished)
|
if (isPublished)
|
||||||
{
|
{
|
||||||
@ -111,7 +131,12 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aScript += "\n\tpass\n";
|
if( isMultiFile )
|
||||||
|
aScript += "\n\tpass";
|
||||||
|
aScript += "\n";
|
||||||
|
|
||||||
|
if( !isMultiFile ) // remove unnecessary tabulation
|
||||||
|
RemoveTabulation( aScript );
|
||||||
|
|
||||||
int aLen = aScript.Length();
|
int aLen = aScript.Length();
|
||||||
unsigned char* aBuffer = new unsigned char[aLen+1];
|
unsigned char* aBuffer = new unsigned char[aLen+1];
|
||||||
|
@ -252,6 +252,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
|
|
||||||
virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
|
virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
|
||||||
CORBA::Boolean isPublished,
|
CORBA::Boolean isPublished,
|
||||||
|
CORBA::Boolean isMultiFile,
|
||||||
CORBA::Boolean& isValidScript);
|
CORBA::Boolean& isValidScript);
|
||||||
|
|
||||||
char* GetDumpName (const char* theStudyEntry);
|
char* GetDumpName (const char* theStudyEntry);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user