This commit is contained in:
Anthony Geay 2021-02-01 15:15:38 +01:00
parent e56eefbad3
commit 87c2149a58
10 changed files with 108 additions and 102 deletions

View File

@ -18,7 +18,7 @@
// //
#include "SMESH_Gen_No_Session_i.hxx" #include "SMESH_Gen_No_Session_i.hxx"
#include "SALOMEDS_Study_i.hxx"
#include "SALOME_KernelServices.hxx" #include "SALOME_KernelServices.hxx"
SMESH_Gen_No_Session_i::SMESH_Gen_No_Session_i( CORBA::ORB_ptr orb, SMESH_Gen_No_Session_i::SMESH_Gen_No_Session_i( CORBA::ORB_ptr orb,
@ -36,3 +36,8 @@ GEOM::GEOM_Gen_var SMESH_Gen_No_Session_i::GetGeomEngine( bool isShaper )
myGeomGen = GEOM::GEOM_Gen::_narrow( temp ); myGeomGen = GEOM::GEOM_Gen::_narrow( temp );
return myGeomGen; return myGeomGen;
} }
SALOMEDS::Study_var SMESH_Gen_No_Session_i::getStudyServant() const
{
return SALOMEDS::Study::_duplicate(KERNEL::getStudyServantSA());
}

View File

@ -30,4 +30,5 @@ public:
const char* instanceName, const char* instanceName,
const char* interfaceName); const char* interfaceName);
GEOM::GEOM_Gen_var GetGeomEngine( bool isShaper ) override; GEOM::GEOM_Gen_var GetGeomEngine( bool isShaper ) override;
SALOMEDS::Study_var getStudyServant() const override;
}; };

View File

@ -18,7 +18,7 @@
// //
#include "SMESH_Gen_Session_i.hxx" #include "SMESH_Gen_Session_i.hxx"
#include "SALOME_KernelServices.hxx"
#include "SALOME_LifeCycleCORBA.hxx" #include "SALOME_LifeCycleCORBA.hxx"
@ -38,6 +38,11 @@ GEOM::GEOM_Gen_var SMESH_Gen_Session_i::GetGeomEngine( bool isShaper )
return myGeomGen; return myGeomGen;
} }
SALOMEDS::Study_var SMESH_Gen_Session_i::getStudyServant() const
{
return SALOMEDS::Study::_duplicate(KERNEL::getStudyServant());
}
extern "C" extern "C"
{ SMESH_I_EXPORT { SMESH_I_EXPORT
PortableServer::ObjectId* SMESHEngine_factory( CORBA::ORB_ptr orb, PortableServer::ObjectId* SMESHEngine_factory( CORBA::ORB_ptr orb,

View File

@ -30,4 +30,6 @@ public:
const char* instanceName, const char* instanceName,
const char* interfaceName); const char* interfaceName);
GEOM::GEOM_Gen_var GetGeomEngine( bool isShaper ) override; GEOM::GEOM_Gen_var GetGeomEngine( bool isShaper ) override;
// Get the SALOMEDS::Study from naming service
SALOMEDS::Study_var getStudyServant() const override;
}; };

View File

@ -812,7 +812,7 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::CreateHypothesis( const char* theHypNam
SALOMEDS::SObject_wrap aSO = PublishHypothesis( hyp ); SALOMEDS::SObject_wrap aSO = PublishHypothesis( hyp );
if ( !aSO->_is_nil() ) { if ( !aSO->_is_nil() ) {
// Update Python script // Update Python script
TPythonDump() << aSO << " = " << this << ".CreateHypothesis('" TPythonDump(this) << aSO << " = " << this << ".CreateHypothesis('"
<< theHypName << "', '" << theLibName << "')"; << theHypName << "', '" << theLibName << "')";
} }
} }
@ -847,7 +847,7 @@ SMESH_Gen_i::CreateHypothesisByAverageLength( const char* theHypType,
initParams ); initParams );
SALOMEDS::SObject_wrap so = PublishHypothesis( hyp ); SALOMEDS::SObject_wrap so = PublishHypothesis( hyp );
TPythonDump() << hyp << " = " << this << ".CreateHypothesisByAverageLength( '" TPythonDump(this) << hyp << " = " << this << ".CreateHypothesisByAverageLength( '"
<< theHypType << "', '" << theHypType << "', '"
<< theLibName << "', " << theLibName << "', "
<< theAverageLength << ", " << theAverageLength << ", "
@ -1202,7 +1202,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMesh( GEOM::GEOM_Object_ptr theShapeObj
aStudyBuilder->CommitCommand(); aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) { if ( !aSO->_is_nil() ) {
// Update Python script // Update Python script
TPythonDump() << aSO << " = " << this << ".CreateMesh(" << theShapeObject << ")"; TPythonDump(this) << aSO << " = " << this << ".CreateMesh(" << theShapeObject << ")";
} }
} }
@ -1232,7 +1232,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateEmptyMesh()
aStudyBuilder->CommitCommand(); aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) { if ( !aSO->_is_nil() ) {
// Update Python script // Update Python script
TPythonDump() << aSO << " = " << this << ".CreateEmptyMesh()"; TPythonDump(this) << aSO << " = " << this << ".CreateEmptyMesh()";
} }
} }
@ -1286,7 +1286,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromUNV( const char* theFileName
aStudyBuilder->CommitCommand(); aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) { if ( !aSO->_is_nil() ) {
// Update Python script // Update Python script
TPythonDump() << aSO << " = " << this << ".CreateMeshesFromUNV(r'" << theFileName << "')"; TPythonDump(this) << aSO << " = " << this << ".CreateMeshesFromUNV(r'" << theFileName << "')";
} }
} }
@ -1333,7 +1333,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMEDorSAUV( const char* theFileNa
{ // open a new scope to make aPythonDump die before PythonDump in SMESH_Mesh::GetGroups() { // open a new scope to make aPythonDump die before PythonDump in SMESH_Mesh::GetGroups()
// Python Dump // Python Dump
TPythonDump aPythonDump; TPythonDump aPythonDump(this);
aPythonDump << "(["; aPythonDump << "([";
if (theStatus == SMESH::DRS_OK) { if (theStatus == SMESH::DRS_OK) {
@ -1483,7 +1483,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromSTL( const char* theFileName
aStudyBuilder->CommitCommand(); aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) { if ( !aSO->_is_nil() ) {
// Update Python script // Update Python script
TPythonDump() << aSO << " = " << this << ".CreateMeshesFromSTL(r'" << theFileName << "')"; TPythonDump(this) << aSO << " = " << this << ".CreateMeshesFromSTL(r'" << theFileName << "')";
} }
} }
@ -1521,7 +1521,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromCGNS( const char*
{ // open a new scope to make aPythonDump die before PythonDump in SMESH_Mesh::GetGroups() { // open a new scope to make aPythonDump die before PythonDump in SMESH_Mesh::GetGroups()
// Python Dump // Python Dump
TPythonDump aPythonDump; TPythonDump aPythonDump(this);
aPythonDump << "(["; aPythonDump << "([";
if (theStatus == SMESH::DRS_OK) if (theStatus == SMESH::DRS_OK)
@ -1609,7 +1609,7 @@ SMESH_Gen_i::CreateMeshesFromGMF( const char* theFileName,
aStudyBuilder->CommitCommand(); aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) { if ( !aSO->_is_nil() ) {
// Update Python script // Update Python script
TPythonDump() << "("<< aSO << ", error) = " << this << ".CreateMeshesFromGMF(r'" TPythonDump(this) << "("<< aSO << ", error) = " << this << ".CreateMeshesFromGMF(r'"
<< theFileName << "', " << theFileName << "', "
<< theMakeRequiredGroups << " )"; << theMakeRequiredGroups << " )";
} }
@ -1879,7 +1879,7 @@ SMESH_Gen_i::MakeGroupsOfBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
if ( SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh )) if ( SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh ))
{ {
groups = meshServant->MakeGroupsOfBadInputElements( theSubShapeID, theGroupName ); groups = meshServant->MakeGroupsOfBadInputElements( theSubShapeID, theGroupName );
TPythonDump() << groups << " = " << this TPythonDump(this) << groups << " = " << this
<< ".MakeGroupsOfBadInputElements( " << ".MakeGroupsOfBadInputElements( "
<< theMesh << ", " << theSubShapeID << ", '" << theGroupName << "' )"; << theMesh << ", " << theSubShapeID << ", '" << theGroupName << "' )";
} }
@ -2049,7 +2049,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
SALOME::BAD_PARAM ); SALOME::BAD_PARAM );
// Update Python script // Update Python script
TPythonDump() << "isDone = " << this << ".Compute( " TPythonDump(this) << "isDone = " << this << ".Compute( "
<< theMesh << ", " << theShapeObject << ")"; << theMesh << ", " << theShapeObject << ")";
try { try {
@ -2335,7 +2335,7 @@ SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
nbels[i] = 0; nbels[i] = 0;
// Update Python script // Update Python script
TPythonDump() << "theNbElems = " << this << ".Evaluate( " TPythonDump(this) << "theNbElems = " << this << ".Evaluate( "
<< theMesh << ", " << theShapeObject << ")"; << theMesh << ", " << theShapeObject << ")";
try { try {
@ -2592,7 +2592,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray,
CORBA::Boolean theCommonGroups, CORBA::Boolean theCommonGroups,
SMESH::SMESH_Mesh_ptr theMeshToAppendTo) SMESH::SMESH_Mesh_ptr theMeshToAppendTo)
{ {
std::unique_ptr< TPythonDump > pPythonDump( new TPythonDump ); std::unique_ptr< TPythonDump > pPythonDump( new TPythonDump(this) );
TPythonDump& pythonDump = *pPythonDump; // prevent dump of called methods TPythonDump& pythonDump = *pPythonDump; // prevent dump of called methods
// create mesh if theMeshToAppendTo not provided // create mesh if theMeshToAppendTo not provided
@ -2873,7 +2873,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
{ {
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
TPythonDump* pyDump = new TPythonDump; // prevent dump from CreateMesh() TPythonDump* pyDump = new TPythonDump(this); // prevent dump from CreateMesh()
std::unique_ptr<TPythonDump> pyDumpDeleter( pyDump ); std::unique_ptr<TPythonDump> pyDumpDeleter( pyDump );
// 1. Get source mesh // 1. Get source mesh
@ -3655,7 +3655,7 @@ CORBA::Boolean SMESH_Gen_i::CopyMeshWithGeom( SMESH::SMESH_Mesh_ptr theSou
bool ok = true; bool ok = true;
SMESH_TRY; SMESH_TRY;
TPythonDump pyDump; // prevent dump from CreateMesh() TPythonDump pyDump(this); // prevent dump from CreateMesh()
theNewMesh = CreateMesh( theNewGeometry ); theNewMesh = CreateMesh( theNewGeometry );
theNewGroups = new SMESH::ListOfGroups(); theNewGroups = new SMESH::ListOfGroups();
@ -4215,7 +4215,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
SMESH::SMESH_Mesh_var myMesh = SMESH::SMESH_Mesh::_narrow( anObject ) ; SMESH::SMESH_Mesh_var myMesh = SMESH::SMESH_Mesh::_narrow( anObject ) ;
if ( !myMesh->_is_nil() ) { if ( !myMesh->_is_nil() ) {
myMesh->Load(); // load from study file if not yet done myMesh->Load(); // load from study file if not yet done
TPythonDump pd; // not to dump GetGroups() TPythonDump pd(this); // not to dump GetGroups()
SMESH::ListOfGroups_var groups = myMesh->GetGroups(); SMESH::ListOfGroups_var groups = myMesh->GetGroups();
for ( CORBA::ULong i = 0; i < groups->length(); ++i ) for ( CORBA::ULong i = 0; i < groups->length(); ++i )
{ {
@ -5211,7 +5211,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
return false; return false;
} }
TPythonDump pd; // prevent dump during loading TPythonDump pd(this); // prevent dump during loading
// For PAL13473 ("Repetitive mesh") implementation. // For PAL13473 ("Repetitive mesh") implementation.
// New dependencies between SMESH objects are established: // New dependencies between SMESH objects are established:

View File

@ -109,14 +109,19 @@ public:
// Retrieve and get GEOM engine reference // Retrieve and get GEOM engine reference
virtual GEOM::GEOM_Gen_var GetGeomEngine( bool isShaper ) = 0; virtual GEOM::GEOM_Gen_var GetGeomEngine( bool isShaper ) = 0;
static GEOM::GEOM_Gen_var GetGeomEngine( GEOM::GEOM_Object_ptr ); static GEOM::GEOM_Gen_var GetGeomEngine( GEOM::GEOM_Object_ptr );
// Retrieve Study depending on Session / Standalone mode
virtual SALOMEDS::Study_var getStudyServant() const = 0;
SALOMEDS::SObject_ptr publish(CORBA::Object_ptr theIOR,
SALOMEDS::SObject_ptr theFatherObject,
const int theTag = 0,
const char* thePixMap = 0,
const bool theSelectable = true);
// Get object of the CORBA reference // Get object of the CORBA reference
static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject ); static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
// Get CORBA object corresponding to the SALOMEDS::SObject // Get CORBA object corresponding to the SALOMEDS::SObject
static CORBA::Object_var SObjectToObject( SALOMEDS::SObject_ptr theSObject ); static CORBA::Object_var SObjectToObject( SALOMEDS::SObject_ptr theSObject );
// Get the SALOMEDS::SObject corresponding to a CORBA object // Get the SALOMEDS::SObject corresponding to a CORBA object
static SALOMEDS::SObject_ptr ObjectToSObject( CORBA::Object_ptr theObject ); SALOMEDS::SObject_ptr ObjectToSObject( CORBA::Object_ptr theObject );
// Get the SALOMEDS::Study from naming service
static SALOMEDS::Study_var getStudyServant();
// Get GEOM Object corresponding to TopoDS_Shape // Get GEOM Object corresponding to TopoDS_Shape
static GEOM::GEOM_Object_ptr ShapeToGeomObject( const TopoDS_Shape& theShape ); static GEOM::GEOM_Object_ptr ShapeToGeomObject( const TopoDS_Shape& theShape );
// Get TopoDS_Shape corresponding to GEOM_Object // Get TopoDS_Shape corresponding to GEOM_Object
@ -467,7 +472,7 @@ public:
void CleanPythonTrace(); void CleanPythonTrace();
static int CountInPyDump(const TCollection_AsciiString& text); int CountInPyDump(const TCollection_AsciiString& text);
// ***************************************** // *****************************************
// Internal methods // Internal methods
@ -521,12 +526,12 @@ public:
SMESH::SMESH_Hypothesis_ptr theHyp); SMESH::SMESH_Hypothesis_ptr theHyp);
SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh, SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theShape); GEOM::GEOM_Object_ptr theShape);
static void SetName(SALOMEDS::SObject_ptr theSObject, void SetName(SALOMEDS::SObject_ptr theSObject,
const char* theName, const char* theName,
const char* theDefaultName = 0); const char* theDefaultName = 0);
static void SetPixMap(SALOMEDS::SObject_ptr theSObject, void SetPixMap(SALOMEDS::SObject_ptr theSObject, const char *thePixMap);
const char* thePixMap); void addReference (SALOMEDS::SObject_ptr theSObject, CORBA::Object_ptr theToObject, int theTag = 0);
// Get study context // Get study context
StudyContext* GetStudyContext(); StudyContext* GetStudyContext();

View File

@ -40,7 +40,6 @@
#include <Utils_ExceptHandlers.hxx> #include <Utils_ExceptHandlers.hxx>
#include <SALOMEDS_wrap.hxx> #include <SALOMEDS_wrap.hxx>
#include <SALOMEDS_Attributes_wrap.hxx> #include <SALOMEDS_Attributes_wrap.hxx>
#include "SALOMEDS_Study_i.hxx"
#include "SALOME_KernelServices.hxx" #include "SALOME_KernelServices.hxx"
#include "SALOME_ModuleCatalog_impl.hxx" #include "SALOME_ModuleCatalog_impl.hxx"
@ -211,15 +210,6 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::ObjectToSObject(CORBA::Object_ptr theObject)
return aSO._retn(); return aSO._retn();
} }
//=======================================================================
//function : GetStudyPtr
//purpose : Get study from naming service
//=======================================================================
SALOMEDS::Study_var SMESH_Gen_i::getStudyServant()
{
return SALOMEDS::Study::_duplicate(KERNEL::getStudyServantSA());
}
//======================================================================= //=======================================================================
//function : objectToServant //function : objectToServant
//purpose : //purpose :
@ -293,14 +283,14 @@ GEOM::GEOM_Object_ptr SMESH_Gen_i::GetGeomObjectByEntry( const std::string& entr
//purpose : //purpose :
//======================================================================= //=======================================================================
static SALOMEDS::SObject_ptr publish(CORBA::Object_ptr theIOR, SALOMEDS::SObject_ptr SMESH_Gen_i::publish(CORBA::Object_ptr theIOR,
SALOMEDS::SObject_ptr theFatherObject, SALOMEDS::SObject_ptr theFatherObject,
const int theTag = 0, const int theTag,
const char* thePixMap = 0, const char* thePixMap,
const bool theSelectable = true) const bool theSelectable)
{ {
SALOMEDS::Study_var theStudy = SMESH_Gen_i::getStudyServant(); SALOMEDS::Study_var theStudy = getStudyServant();
SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( theIOR ); SALOMEDS::SObject_wrap SO = ObjectToSObject( theIOR );
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = theStudy->GetUseCaseBuilder(); SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = theStudy->GetUseCaseBuilder();
bool isNewSO = false, isInUseCaseTree = false; bool isNewSO = false, isInUseCaseTree = false;
@ -441,9 +431,7 @@ void SMESH_Gen_i::SetPixMap(SALOMEDS::SObject_ptr theSObject,
//purpose : //purpose :
//======================================================================= //=======================================================================
static void addReference (SALOMEDS::SObject_ptr theSObject, void SMESH_Gen_i::addReference (SALOMEDS::SObject_ptr theSObject, CORBA::Object_ptr theToObject, int theTag)
CORBA::Object_ptr theToObject,
int theTag = 0)
{ {
SALOMEDS::Study_var aStudy = SMESH_Gen_i::getStudyServant(); SALOMEDS::Study_var aStudy = SMESH_Gen_i::getStudyServant();
SALOMEDS::SObject_wrap aToObjSO = SMESH_Gen_i::ObjectToSObject( theToObject ); SALOMEDS::SObject_wrap aToObjSO = SMESH_Gen_i::ObjectToSObject( theToObject );

View File

@ -299,7 +299,7 @@ void SMESH_Mesh_i::Clear()
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
} }
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".Clear()"; TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this()) << ".Clear()";
SMESH::SMESH_Mesh_var mesh = _this(); SMESH::SMESH_Mesh_var mesh = _this();
_gen_i->UpdateIcons( mesh ); _gen_i->UpdateIcons( mesh );
@ -325,7 +325,7 @@ void SMESH_Mesh_i::ClearSubMesh(CORBA::Long ShapeID)
} }
_impl->GetMeshDS()->Modified(); _impl->GetMeshDS()->Modified();
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ClearSubMesh( " << ShapeID << " )"; TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this()) << ".ClearSubMesh( " << ShapeID << " )";
} }
//============================================================================= //=============================================================================
@ -661,7 +661,7 @@ SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Object_ptr aSubShape,
if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status ); if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status );
// Update Python script // Update Python script
TPythonDump() << "status = " << mesh << ".AddHypothesis( " TPythonDump(_gen_i) << "status = " << mesh << ".AddHypothesis( "
<< aSubShape << ", " << anHyp << " )"; << aSubShape << ", " << anHyp << " )";
return ConvertHypothesisStatus(status); return ConvertHypothesisStatus(status);
@ -745,10 +745,10 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Object_ptr
} }
// Update Python script // Update Python script
if(_impl->HasShapeToMesh()) if(_impl->HasShapeToMesh())
TPythonDump() << "status = " << mesh << ".RemoveHypothesis( " TPythonDump(_gen_i) << "status = " << mesh << ".RemoveHypothesis( "
<< aSubShape << ", " << anHyp << " )"; << aSubShape << ", " << anHyp << " )";
else else
TPythonDump() << "status = " << mesh << ".RemoveHypothesis( " TPythonDump(_gen_i) << "status = " << mesh << ".RemoveHypothesis( "
<< anHyp << " )"; << anHyp << " )";
return ConvertHypothesisStatus(status); return ConvertHypothesisStatus(status);
@ -855,7 +855,7 @@ SMESH::submesh_array* SMESH_Mesh_i::GetSubMeshes()
SMESH::submesh_array_var aList = new SMESH::submesh_array(); SMESH::submesh_array_var aList = new SMESH::submesh_array();
// Python Dump // Python Dump
TPythonDump aPythonDump; TPythonDump aPythonDump(_gen_i);
if ( !_mapSubMeshIor.empty() ) if ( !_mapSubMeshIor.empty() )
aPythonDump << "[ "; aPythonDump << "[ ";
@ -924,7 +924,7 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Object_ptr aSubShap
_gen_i->PublishSubMesh( aMesh, subMesh, aSubShape, theName ); _gen_i->PublishSubMesh( aMesh, subMesh, aSubShape, theName );
if ( !aSO->_is_nil()) { if ( !aSO->_is_nil()) {
// Update Python script // Update Python script
TPythonDump() << aSO << " = " << aMesh << ".GetSubMesh( " TPythonDump(_gen_i) << aSO << " = " << aMesh << ".GetSubMesh( "
<< aSubShape << ", '" << theName << "' )"; << aSubShape << ", '" << theName << "' )";
} }
} }
@ -967,7 +967,7 @@ void SMESH_Mesh_i::RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
builder->RemoveObjectWithChildren( anSO ); builder->RemoveObjectWithChildren( anSO );
// Update Python script // Update Python script
TPythonDump() << SMESH::SMESH_Mesh_var( _this() ) << ".RemoveSubMesh( " << anSO << " )"; TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var( _this() ) << ".RemoveSubMesh( " << anSO << " )";
} }
if ( removeSubMesh( theSubMesh, aSubShape.in() )) if ( removeSubMesh( theSubMesh, aSubShape.in() ))
@ -1000,7 +1000,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateGroup( SMESH::ElementType theElemType
_gen_i->PublishGroup( mesh, aNewGroup, GEOM::GEOM_Object::_nil(), theName); _gen_i->PublishGroup( mesh, aNewGroup, GEOM::GEOM_Object::_nil(), theName);
if ( !aSO->_is_nil()) if ( !aSO->_is_nil())
// Update Python script // Update Python script
TPythonDump() << aSO << " = " << mesh << ".CreateGroup( " TPythonDump(_gen_i) << aSO << " = " << mesh << ".CreateGroup( "
<< theElemType << ", '" << theName << "' )"; << theElemType << ", '" << theName << "' )";
} }
return aNewGroup._retn(); return aNewGroup._retn();
@ -1035,7 +1035,7 @@ SMESH_Mesh_i::CreateGroupFromGEOM (SMESH::ElementType theElemType,
SALOMEDS::SObject_wrap aSO = SALOMEDS::SObject_wrap aSO =
_gen_i->PublishGroup( mesh, aNewGroup, theGeomObj, theName ); _gen_i->PublishGroup( mesh, aNewGroup, theGeomObj, theName );
if ( !aSO->_is_nil()) if ( !aSO->_is_nil())
TPythonDump() << aSO << " = " << mesh << ".CreateGroupFromGEOM( " TPythonDump(_gen_i) << aSO << " = " << mesh << ".CreateGroupFromGEOM( "
<< theElemType << ", '" << theName << "', " << theGeomObj << " )"; << theElemType << ", '" << theName << "', " << theGeomObj << " )";
} }
} }
@ -1072,7 +1072,7 @@ SMESH_Mesh_i::CreateGroupFromFilter(SMESH::ElementType theElemType,
SMESH::SMESH_GroupOnFilter_var aNewGroup = SMESH::SMESH_GroupOnFilter::_narrow SMESH::SMESH_GroupOnFilter_var aNewGroup = SMESH::SMESH_GroupOnFilter::_narrow
( createGroup( theElemType, theName, /*id=*/-1, TopoDS_Shape(), predicate )); ( createGroup( theElemType, theName, /*id=*/-1, TopoDS_Shape(), predicate ));
TPythonDump pd; TPythonDump pd(_gen_i);
if ( !aNewGroup->_is_nil() ) if ( !aNewGroup->_is_nil() )
aNewGroup->SetFilter( theFilter ); aNewGroup->SetFilter( theFilter );
@ -1114,10 +1114,10 @@ void SMESH_Mesh_i::RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup )
if ( !aGroupSO->_is_nil() ) if ( !aGroupSO->_is_nil() )
{ {
// Update Python script // Update Python script
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".RemoveGroup( " << aGroupSO << " )"; TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this()) << ".RemoveGroup( " << aGroupSO << " )";
// Remove group's SObject // Remove group's SObject
SALOMEDS::StudyBuilder_var builder = SMESH_Gen_i::getStudyServant()->NewBuilder(); SALOMEDS::StudyBuilder_var builder = _gen_i->getStudyServant()->NewBuilder();
builder->RemoveObjectWithChildren( aGroupSO ); builder->RemoveObjectWithChildren( aGroupSO );
} }
aGroup->Modified(/*removed=*/true); // notify dependent Filter with FT_BelongToMeshGroup criterion aGroup->Modified(/*removed=*/true); // notify dependent Filter with FT_BelongToMeshGroup criterion
@ -1165,7 +1165,7 @@ void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup
std::vector< const SMDS_MeshElement* > elems( theGroup->Size() ); std::vector< const SMDS_MeshElement* > elems( theGroup->Size() );
elems.assign( elemBeg, elemEnd ); elems.assign( elemBeg, elemEnd );
TPythonDump pyDump; // Suppress dump from RemoveGroup() TPythonDump pyDump(_gen_i); // Suppress dump from RemoveGroup()
// Remove group // Remove group
RemoveGroup( theGroup ); RemoveGroup( theGroup );
@ -1219,7 +1219,7 @@ SMESH::ListOfGroups * SMESH_Mesh_i::GetGroups()
SMESH::ListOfGroups_var aList = new SMESH::ListOfGroups(); SMESH::ListOfGroups_var aList = new SMESH::ListOfGroups();
// Python Dump // Python Dump
TPythonDump aPythonDump; TPythonDump aPythonDump(_gen_i);
if ( !_mapGroups.empty() ) if ( !_mapGroups.empty() )
{ {
aPythonDump << "[ "; aPythonDump << "[ ";
@ -1278,7 +1278,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionGroups( SMESH::SMESH_GroupBase_ptr the
if ( theGroup1->GetType() != theGroup2->GetType() ) if ( theGroup1->GetType() != theGroup2->GetType() )
THROW_SALOME_CORBA_EXCEPTION("UnionGroups(): different group types", THROW_SALOME_CORBA_EXCEPTION("UnionGroups(): different group types",
SALOME::BAD_PARAM); SALOME::BAD_PARAM);
TPythonDump pyDump; TPythonDump pyDump(_gen_i);
// Create Union // Create Union
aResGrp = CreateGroup( theGroup1->GetType(), theName ); aResGrp = CreateGroup( theGroup1->GetType(), theName );
@ -1335,7 +1335,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionListOfGroups(const SMESH::ListOfGroups
if ( aType == SMESH::ALL ) if ( aType == SMESH::ALL )
return SMESH::SMESH_Group::_nil(); return SMESH::SMESH_Group::_nil();
TPythonDump pyDump; TPythonDump pyDump(_gen_i);
// Create Union // Create Union
aResGrp = CreateGroup( aType, theName ); aResGrp = CreateGroup( aType, theName );
@ -1384,7 +1384,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::IntersectGroups( SMESH::SMESH_GroupBase_ptr
if ( theGroup1->GetType() != theGroup2->GetType() ) if ( theGroup1->GetType() != theGroup2->GetType() )
THROW_SALOME_CORBA_EXCEPTION("IntersectGroups(): different group types", THROW_SALOME_CORBA_EXCEPTION("IntersectGroups(): different group types",
SALOME::BAD_PARAM); SALOME::BAD_PARAM);
TPythonDump pyDump; TPythonDump pyDump(_gen_i);
// Create Intersection // Create Intersection
aResGrp = CreateGroup( theGroup1->GetType(), theName ); aResGrp = CreateGroup( theGroup1->GetType(), theName );
@ -1474,7 +1474,7 @@ SMESH_Mesh_i::IntersectListOfGroups(const SMESH::ListOfGroups& theGroups,
if ( aType == SMESH::ALL ) // all groups are nil if ( aType == SMESH::ALL ) // all groups are nil
return SMESH::SMESH_Group::_nil(); return SMESH::SMESH_Group::_nil();
TPythonDump pyDump; TPythonDump pyDump(_gen_i);
// Create a group // Create a group
aResGrp = CreateGroup( aType, theName ); aResGrp = CreateGroup( aType, theName );
@ -1532,7 +1532,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutGroups( SMESH::SMESH_GroupBase_ptr theGr
if ( theGroup1->GetType() != theGroup2->GetType() ) if ( theGroup1->GetType() != theGroup2->GetType() )
THROW_SALOME_CORBA_EXCEPTION("CutGroups(): different group types", THROW_SALOME_CORBA_EXCEPTION("CutGroups(): different group types",
SALOME::BAD_PARAM); SALOME::BAD_PARAM);
TPythonDump pyDump; TPythonDump pyDump(_gen_i);
aResGrp = CreateGroup( theGroup1->GetType(), theName ); aResGrp = CreateGroup( theGroup1->GetType(), theName );
if ( aResGrp->_is_nil() ) if ( aResGrp->_is_nil() )
@ -1633,7 +1633,7 @@ SMESH_Mesh_i::CutListOfGroups(const SMESH::ListOfGroups& theMainGroups,
toolGroupVec.push_back( grpDS ); toolGroupVec.push_back( grpDS );
} }
TPythonDump pyDump; TPythonDump pyDump(_gen_i);
// Create a group // Create a group
aResGrp = CreateGroup( aType, theName ); aResGrp = CreateGroup( aType, theName );
@ -1743,7 +1743,7 @@ SMESH_Mesh_i::CreateDimGroup(const SMESH::ListOfIDSources& theGroups,
// Create a group // Create a group
TPythonDump pyDump; TPythonDump pyDump(_gen_i);
aResGrp = CreateGroup( theElemType, theName ); aResGrp = CreateGroup( theElemType, theName );
if ( aResGrp->_is_nil() ) if ( aResGrp->_is_nil() )
@ -1903,7 +1903,7 @@ SMESH_Mesh_i::FaceGroupsSeparatedByEdges( CORBA::Double theSharpAngle,
SMESH::ListOfGroups_var resultGroups = new SMESH::ListOfGroups; SMESH::ListOfGroups_var resultGroups = new SMESH::ListOfGroups;
TPythonDump pyDump; TPythonDump pyDump(_gen_i);
SMESH_TRY; SMESH_TRY;
if ( _preMeshInfo ) if ( _preMeshInfo )
@ -2159,10 +2159,10 @@ void SMESH_Mesh_i::ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom)
_gen_i->UpdateIcons( SMESH::SMESH_Mesh_var( _this() )); _gen_i->UpdateIcons( SMESH::SMESH_Mesh_var( _this() ));
} }
TPythonDump() << "SHAPERSTUDY.breakLinkForSubElements(salome.ObjectToSObject(" TPythonDump(_gen_i) << "SHAPERSTUDY.breakLinkForSubElements(salome.ObjectToSObject("
<< me <<".GetMesh()), " << entry.in() << ")"; << me <<".GetMesh()), " << entry.in() << ")";
TPythonDump() << me << ".ReplaceShape( " << entry.in() << " )"; TPythonDump(_gen_i)<< me << ".ReplaceShape( " << entry.in() << " )";
} }
@ -2350,7 +2350,7 @@ void SMESH_Mesh_i::CheckGeomModif( bool theIsBreakLink )
SMESH::SMESH_Mesh_var me = _this(); SMESH::SMESH_Mesh_var me = _this();
GEOM::GEOM_Object_var mainGO = GetShapeToMesh(); GEOM::GEOM_Object_var mainGO = GetShapeToMesh();
TPythonDump dumpNothing; // prevent any dump TPythonDump dumpNothing(_gen_i); // prevent any dump
//bool removedFromClient = false; //bool removedFromClient = false;
@ -3055,7 +3055,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::ConvertToStandalone( SMESH::SMESH_GroupBase
SALOMEDS::StudyBuilder_var builder; SALOMEDS::StudyBuilder_var builder;
SALOMEDS::SObject_wrap aGroupSO; SALOMEDS::SObject_wrap aGroupSO;
SALOMEDS::Study_var aStudy = SMESH_Gen_i::getStudyServant(); SALOMEDS::Study_var aStudy = _gen_i->getStudyServant();
if ( !aStudy->_is_nil() ) { if ( !aStudy->_is_nil() ) {
builder = aStudy->NewBuilder(); builder = aStudy->NewBuilder();
aGroupSO = _gen_i->ObjectToSObject( theGroup ); aGroupSO = _gen_i->ObjectToSObject( theGroup );
@ -3070,7 +3070,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::ConvertToStandalone( SMESH::SMESH_GroupBase
builder->RemoveObject( so ); builder->RemoveObject( so );
} }
// Update Python script // Update Python script
TPythonDump() << aGroupSO << " = " << SMESH::SMESH_Mesh_var(_this()) TPythonDump(_gen_i) << aGroupSO << " = " << SMESH::SMESH_Mesh_var(_this())
<< ".ConvertToStandalone( " << aGroupSO << " )"; << ".ConvertToStandalone( " << aGroupSO << " )";
// change icon of Group on Filter // change icon of Group on Filter
@ -3510,7 +3510,7 @@ SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor()
aMeshEdVar = _editor->_this(); aMeshEdVar = _editor->_this();
// Update Python script // Update Python script
TPythonDump() << _editor << " = " TPythonDump(_gen_i) << _editor << " = "
<< SMESH::SMESH_Mesh_var(_this()) << ".GetMeshEditor()"; << SMESH::SMESH_Mesh_var(_this()) << ".GetMeshEditor()";
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
@ -3601,7 +3601,7 @@ void SMESH_Mesh_i::SetAutoColor(CORBA::Boolean theAutoColor)
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
_impl->SetAutoColor(theAutoColor); _impl->SetAutoColor(theAutoColor);
TPythonDump pyDump; // not to dump group->SetColor() from below code TPythonDump pyDump(_gen_i); // not to dump group->SetColor() from below code
pyDump << SMESH::SMESH_Mesh_var(_this()) <<".SetAutoColor( "<<theAutoColor<<" )"; pyDump << SMESH::SMESH_Mesh_var(_this()) <<".SetAutoColor( "<<theAutoColor<<" )";
std::list<SALOMEDS::Color> aReservedColors; std::list<SALOMEDS::Color> aReservedColors;
@ -3693,7 +3693,7 @@ string SMESH_Mesh_i::prepareMeshNameAndGroups(const char* file,
// Perform Export // Perform Export
PrepareForWriting(file, overwrite); PrepareForWriting(file, overwrite);
string aMeshName = "Mesh"; string aMeshName = "Mesh";
SALOMEDS::Study_var aStudy = SMESH_Gen_i::getStudyServant(); SALOMEDS::Study_var aStudy = _gen_i->getStudyServant();
if ( !aStudy->_is_nil() ) { if ( !aStudy->_is_nil() ) {
SALOMEDS::SObject_wrap aMeshSO = _gen_i->ObjectToSObject( _this() ); SALOMEDS::SObject_wrap aMeshSO = _gen_i->ObjectToSObject( _this() );
if ( !aMeshSO->_is_nil() ) { if ( !aMeshSO->_is_nil() ) {
@ -3717,7 +3717,7 @@ string SMESH_Mesh_i::prepareMeshNameAndGroups(const char* file,
} }
// Update Python script // Update Python script
// set name of mesh before export // set name of mesh before export
TPythonDump() << _gen_i << ".SetName(" TPythonDump(_gen_i) << _gen_i << ".SetName("
<< SMESH::SMESH_Mesh_var(_this()) << ", '" << aMeshName.c_str() << "')"; << SMESH::SMESH_Mesh_var(_this()) << ", '" << aMeshName.c_str() << "')";
// check names of groups // check names of groups
@ -3746,7 +3746,7 @@ void SMESH_Mesh_i::ExportMED(const char* file,
string aMeshName = prepareMeshNameAndGroups(file, overwrite); string aMeshName = prepareMeshNameAndGroups(file, overwrite);
_impl->ExportMED( file, aMeshName.c_str(), auto_groups, version, 0, autoDimension ); _impl->ExportMED( file, aMeshName.c_str(), auto_groups, version, 0, autoDimension );
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportMED( r'" TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this()) << ".ExportMED( r'"
<< file << "', " << file << "', "
<< "auto_groups=" <<auto_groups << ", " << "auto_groups=" <<auto_groups << ", "
<< "version=" << version << ", " << "version=" << version << ", "
@ -3771,7 +3771,7 @@ void SMESH_Mesh_i::ExportSAUV (const char* file,
_preMeshInfo->FullLoadFromFile(); _preMeshInfo->FullLoadFromFile();
string aMeshName = prepareMeshNameAndGroups(file, true); string aMeshName = prepareMeshNameAndGroups(file, true);
TPythonDump() << SMESH::SMESH_Mesh_var( _this()) TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var( _this())
<< ".ExportSAUV( r'" << file << "', " << auto_groups << " )"; << ".ExportSAUV( r'" << file << "', " << auto_groups << " )";
_impl->ExportSAUV(file, aMeshName.c_str(), auto_groups); _impl->ExportSAUV(file, aMeshName.c_str(), auto_groups);
} }
@ -3792,7 +3792,7 @@ void SMESH_Mesh_i::ExportDAT (const char *file)
// Update Python script // Update Python script
// check names of groups // check names of groups
checkGroupNames(); checkGroupNames();
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportDAT( r'" << file << "' )"; TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this()) << ".ExportDAT( r'" << file << "' )";
// Perform Export // Perform Export
PrepareForWriting(file); PrepareForWriting(file);
@ -3814,7 +3814,7 @@ void SMESH_Mesh_i::ExportUNV (const char *file)
// Update Python script // Update Python script
// check names of groups // check names of groups
checkGroupNames(); checkGroupNames();
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportUNV( r'" << file << "' )"; TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this()) << ".ExportUNV( r'" << file << "' )";
// Perform Export // Perform Export
PrepareForWriting(file); PrepareForWriting(file);
@ -3836,7 +3836,7 @@ void SMESH_Mesh_i::ExportSTL (const char *file, const bool isascii)
// Update Python script // Update Python script
// check names of groups // check names of groups
checkGroupNames(); checkGroupNames();
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this())
<< ".ExportSTL( r'" << file << "', " << isascii << " )"; << ".ExportSTL( r'" << file << "', " << isascii << " )";
CORBA::String_var name; CORBA::String_var name;
@ -3956,7 +3956,7 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
GEOM::GEOM_BaseObject_var gbo = GEOM::GEOM_BaseObject::_narrow( fields[i] ); GEOM::GEOM_BaseObject_var gbo = GEOM::GEOM_BaseObject::_narrow( fields[i] );
goList[i] = gbo; goList[i] = gbo;
} }
TPythonDump() << _this() << ".ExportPartToMED( " TPythonDump(_gen_i) << _this() << ".ExportPartToMED( "
<< meshPart << ", r'" << meshPart << ", r'"
<< file << "', " << file << "', "
<< auto_groups << ", " << auto_groups << ", "
@ -4258,7 +4258,7 @@ void SMESH_Mesh_i::ExportPartToDAT(::SMESH::SMESH_IDSource_ptr meshPart,
SMESH_MeshPartDS partDS( meshPart ); SMESH_MeshPartDS partDS( meshPart );
_impl->ExportDAT(file,&partDS); _impl->ExportDAT(file,&partDS);
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this())
<< ".ExportPartToDAT( " << meshPart << ", r'" << file << "' )"; << ".ExportPartToDAT( " << meshPart << ", r'" << file << "' )";
} }
//================================================================================ //================================================================================
@ -4279,7 +4279,7 @@ void SMESH_Mesh_i::ExportPartToUNV(::SMESH::SMESH_IDSource_ptr meshPart,
SMESH_MeshPartDS partDS( meshPart ); SMESH_MeshPartDS partDS( meshPart );
_impl->ExportUNV(file, &partDS); _impl->ExportUNV(file, &partDS);
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this())
<< ".ExportPartToUNV( " << meshPart<< ", r'" << file << "' )"; << ".ExportPartToUNV( " << meshPart<< ", r'" << file << "' )";
} }
//================================================================================ //================================================================================
@ -4306,7 +4306,7 @@ void SMESH_Mesh_i::ExportPartToSTL(::SMESH::SMESH_IDSource_ptr meshPart,
SMESH_MeshPartDS partDS( meshPart ); SMESH_MeshPartDS partDS( meshPart );
_impl->ExportSTL( file, isascii, name.in(), &partDS ); _impl->ExportSTL( file, isascii, name.in(), &partDS );
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportPartToSTL( " TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this()) << ".ExportPartToSTL( "
<< meshPart<< ", r'" << file << "', " << isascii << ")"; << meshPart<< ", r'" << file << "', " << isascii << ")";
} }
@ -4342,7 +4342,7 @@ void SMESH_Mesh_i::ExportCGNS(::SMESH::SMESH_IDSource_ptr meshPart,
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportCGNS( " TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this()) << ".ExportCGNS( "
<< meshPart<< ", r'" << file << "', " << overwrite << ")"; << meshPart<< ", r'" << file << "', " << overwrite << ")";
#else #else
THROW_SALOME_CORBA_EXCEPTION("CGNS library is unavailable", SALOME::INTERNAL_ERROR); THROW_SALOME_CORBA_EXCEPTION("CGNS library is unavailable", SALOME::INTERNAL_ERROR);
@ -4368,7 +4368,7 @@ void SMESH_Mesh_i::ExportGMF(::SMESH::SMESH_IDSource_ptr meshPart,
SMESH_MeshPartDS partDS( meshPart ); SMESH_MeshPartDS partDS( meshPart );
_impl->ExportGMF(file, &partDS, withRequiredGroups); _impl->ExportGMF(file, &partDS, withRequiredGroups);
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportGMF( " TPythonDump(_gen_i) << SMESH::SMESH_Mesh_var(_this()) << ".ExportGMF( "
<< meshPart<< ", r'" << meshPart<< ", r'"
<< file << "', " << file << "', "
<< withRequiredGroups << ")"; << withRequiredGroups << ")";
@ -5786,7 +5786,7 @@ void SMESH_Mesh_i::CreateGroupServants()
set<int>::iterator it = addedIDs.find( i_grp->first ); set<int>::iterator it = addedIDs.find( i_grp->first );
if ( it != addedIDs.end() ) if ( it != addedIDs.end() )
{ {
TPythonDump() << i_grp->second << " = " << aMesh << ".GetGroups()[ "<< index << " ]"; TPythonDump(_gen_i) << i_grp->second << " = " << aMesh << ".GetGroups()[ "<< index << " ]";
addedIDs.erase( it ); addedIDs.erase( it );
if ( addedIDs.empty() ) if ( addedIDs.empty() )
break; break;
@ -5904,7 +5904,7 @@ void SMESH_Mesh_i::checkGroupNames()
// avoid dump of "GetGroups" // avoid dump of "GetGroups"
{ {
// store python dump into a local variable inside local scope // store python dump into a local variable inside local scope
SMESH::TPythonDump pDump; // do not delete this line of code SMESH::TPythonDump pDump(_gen_i); // do not delete this line of code
grpList = GetGroups(); grpList = GetGroups();
} }
@ -5955,7 +5955,7 @@ SMESH::string_array* SMESH_Mesh_i::GetLastParameters()
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen(); SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
if(gen) { if(gen) {
CORBA::String_var aParameters = GetParameters(); CORBA::String_var aParameters = GetParameters();
SALOMEDS::ListOfListOfStrings_var aSections = SMESH_Gen_i::getStudyServant()->ParseVariables(aParameters); SALOMEDS::ListOfListOfStrings_var aSections = _gen_i->getStudyServant()->ParseVariables(aParameters);
if ( aSections->length() > 0 ) { if ( aSections->length() > 0 ) {
SALOMEDS::ListOfStrings aVars = aSections[ aSections->length() - 1 ]; SALOMEDS::ListOfStrings aVars = aSections[ aSections->length() - 1 ];
aResult->length( aVars.length() ); aResult->length( aVars.length() );
@ -6824,7 +6824,7 @@ TListOfListOfInt SMESH_Mesh_i::findConcurrentSubMeshes()
bool res = false; bool res = false;
::SMESH_Mesh& mesh = GetImpl(); ::SMESH_Mesh& mesh = GetImpl();
TPythonDump aPythonDump; // prevent dump of called methods TPythonDump aPythonDump(_gen_i); // prevent dump of called methods
aPythonDump << "isDone = " << SMESH::SMESH_Mesh_var(_this()) << ".SetMeshOrder( [ "; aPythonDump << "isDone = " << SMESH::SMESH_Mesh_var(_this()) << ".SetMeshOrder( [ ";
TListOfListOfInt subMeshOrder; TListOfListOfInt subMeshOrder;
@ -6886,7 +6886,7 @@ void SMESH_Mesh_i::convertMeshOrder (const TListOfListOfInt& theIdsOrder,
const bool theIsDump) const bool theIsDump)
{ {
int nbSet = theIdsOrder.size(); int nbSet = theIdsOrder.size();
TPythonDump aPythonDump; // prevent dump of called methods TPythonDump aPythonDump(_gen_i); // prevent dump of called methods
if ( theIsDump ) if ( theIsDump )
aPythonDump << "[ "; aPythonDump << "[ ";
theResOrder.length(nbSet); theResOrder.length(nbSet);

View File

@ -69,8 +69,7 @@ namespace SMESH
myVals[i] = SMESH_Comment(value[i]); myVals[i] = SMESH_Comment(value[i]);
} }
TPythonDump:: TPythonDump::TPythonDump(SMESH_Gen_i *smesh):myVarsCounter(0),mySmesh(smesh)
TPythonDump():myVarsCounter(0)
{ {
++myCounter; ++myCounter;
} }
@ -304,7 +303,7 @@ namespace SMESH
operator<<(CORBA::Object_ptr theArg) operator<<(CORBA::Object_ptr theArg)
{ {
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(theArg); SALOMEDS::SObject_wrap aSObject = mySmesh->ObjectToSObject(theArg);
if(!aSObject->_is_nil()) { if(!aSObject->_is_nil()) {
CORBA::String_var id = aSObject->GetID(); CORBA::String_var id = aSObject->GetID();
myStream << id; myStream << id;
@ -323,7 +322,7 @@ namespace SMESH
TPythonDump:: TPythonDump::
operator<<(SMESH::SMESH_Hypothesis_ptr theArg) operator<<(SMESH::SMESH_Hypothesis_ptr theArg)
{ {
SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(theArg); SALOMEDS::SObject_wrap aSObject = mySmesh->ObjectToSObject(theArg);
if(aSObject->_is_nil() && !CORBA::is_nil(theArg)) if(aSObject->_is_nil() && !CORBA::is_nil(theArg))
myStream << "hyp_" << theArg->GetId(); myStream << "hyp_" << theArg->GetId();
else else
@ -337,7 +336,7 @@ namespace SMESH
{ {
if ( CORBA::is_nil( theArg ) ) if ( CORBA::is_nil( theArg ) )
return *this << "None"; return *this << "None";
SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(theArg); SALOMEDS::SObject_wrap aSObject = mySmesh->ObjectToSObject(theArg);
if(!aSObject->_is_nil()) if(!aSObject->_is_nil())
{ {
return *this << aSObject; return *this << aSObject;
@ -352,7 +351,7 @@ namespace SMESH
SMESH::long_array_var anElementsId = theArg->GetIDs(); SMESH::long_array_var anElementsId = theArg->GetIDs();
SMESH::array_of_ElementType_var types = theArg->GetTypes(); SMESH::array_of_ElementType_var types = theArg->GetTypes();
SMESH::ElementType type = types->length() ? types[0] : SMESH::ALL; SMESH::ElementType type = types->length() ? types[0] : SMESH::ALL;
SALOMEDS::SObject_wrap meshSO = SMESH_Gen_i::ObjectToSObject(mesh); SALOMEDS::SObject_wrap meshSO = mySmesh->ObjectToSObject(mesh);
if ( meshSO->_is_nil() ) // don't waste memory for dumping not published objects if ( meshSO->_is_nil() ) // don't waste memory for dumping not published objects
return *this << mesh << ".GetIDSource([], " << type << ")"; return *this << mesh << ".GetIDSource([], " << type << ")";
else else

View File

@ -121,8 +121,9 @@ namespace SMESH
std::ostringstream myStream; std::ostringstream myStream;
static size_t myCounter; static size_t myCounter;
int myVarsCounter; // counts stored TVar's int myVarsCounter; // counts stored TVar's
SMESH_Gen_i *mySmesh = nullptr;
public: public:
TPythonDump(); TPythonDump(SMESH_Gen_i *smesh);
virtual ~TPythonDump(); virtual ~TPythonDump();
TPythonDump& TPythonDump&