From d448969fe8020a2ab7fb585240a94746ad664ef9 Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 30 Mar 2005 04:55:33 +0000 Subject: [PATCH] PythonDump for SMESH Controls / Filter --- src/SMESH_I/SMESH_DumpPython.cxx | 17 +++++++++++++---- src/SMESH_I/SMESH_Filter_i.cxx | 27 +++++++++++++++++++++++++-- src/SMESH_I/SMESH_PythonDump.hxx | 2 ++ 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index 73223beb7..5a5d3c25a 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -180,13 +180,22 @@ namespace SMESH return theString; } + size_t TPythonDump::myCounter = 0; + + TPythonDump:: + TPythonDump() + { + ++myCounter; + } TPythonDump:: ~TPythonDump() { - SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); - SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy(); - if(!aStudy->_is_nil()){ - aSMESHGen->AddToPythonScript(aStudy->StudyId(),myString); + if(--myCounter == 0){ + SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); + SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy(); + if(!aStudy->_is_nil()){ + aSMESHGen->AddToPythonScript(aStudy->StudyId(),myString); + } } } } diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx index b37020f4e..c62a96a1b 100644 --- a/src/SMESH_I/SMESH_Filter_i.cxx +++ b/src/SMESH_I/SMESH_Filter_i.cxx @@ -1278,6 +1278,7 @@ MinimumAngle_ptr FilterManager_i::CreateMinimumAngle() { SMESH::MinimumAngle_i* aServant = new SMESH::MinimumAngle_i(); SMESH::MinimumAngle_var anObj = aServant->_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<SetMesh( theMesh ); + TPythonDump()<GetPredicate(),theSequence); } -SMESH::long_array* Filter_i::GetElementsId( SMESH_Mesh_ptr theMesh ) +SMESH::long_array* +Filter_i:: +GetElementsId( SMESH_Mesh_ptr theMesh ) { Controls::Filter::TIdSequence aSequence; GetElementsId(myPredicate,theMesh,aSequence); diff --git a/src/SMESH_I/SMESH_PythonDump.hxx b/src/SMESH_I/SMESH_PythonDump.hxx index 07eea60f7..4894c7159 100644 --- a/src/SMESH_I/SMESH_PythonDump.hxx +++ b/src/SMESH_I/SMESH_PythonDump.hxx @@ -70,7 +70,9 @@ namespace SMESH class TPythonDump { TCollection_AsciiString myString; + static size_t myCounter; public: + TPythonDump(); virtual ~TPythonDump(); template