From d3b334a73713797de29993bc5fae82725e07f499 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 12 Apr 2006 14:13:59 +0000 Subject: [PATCH] PAL12147. make different mesh_editors for different meshes in DumpPython file; remove repeated mesh.GetMeshEditor() of the same mesh --- src/SMESH_I/SMESH_2smeshpy.cxx | 20 +++++++++++++++++--- src/SMESH_I/SMESH_2smeshpy.hxx | 3 ++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 326015f26..2405ec721 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -186,7 +186,7 @@ void _pyGen::AddCommand( const TCollection_AsciiString& theCommand) // Mesh provides SMESH_IDSource interface used in SMESH_MeshEditor. // Add access to wrapped mesh - if ( objID == TPythonDump::MeshEditorName() ) { + if ( objID.Location( TPythonDump::MeshEditorName(), 1, objID.Length() )) { // in all SMESH_MeshEditor's commands, a SMESH_IDSource is the first arg id_mesh = myMeshes.find( aCommand->GetArg( 1 )); if ( id_mesh != myMeshes.end() ) @@ -431,7 +431,8 @@ static bool sameGroupType( const _pyID& grpID, */ //================================================================================ -_pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd): _pyObject(theCreationCmd) +_pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd): + _pyObject(theCreationCmd), myHasEditor(false) { // convert my creation command Handle(_pyCommand) creationCmd = GetCreationCmd(); @@ -528,7 +529,20 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) theCommand->SetArg( 2, theCommand->GetArg( 2 ) + ".GetAlgorithm()" ); } } - else { // apply theCommand to the mesh wrapped by smeshpy mesh + + // leave only one mesh_editor_ = mesh.GetMeshEditor() + else if ( theCommand->GetMethod() == "GetMeshEditor") + { + if ( myHasEditor ) + theCommand->Clear(); + else + AddMeshAccess( theCommand ); + myHasEditor = true; + } + + // apply theCommand to the mesh wrapped by smeshpy mesh + else + { AddMeshAccess( theCommand ); } } diff --git a/src/SMESH_I/SMESH_2smeshpy.hxx b/src/SMESH_I/SMESH_2smeshpy.hxx index 78117eaa3..7f24f3a20 100644 --- a/src/SMESH_I/SMESH_2smeshpy.hxx +++ b/src/SMESH_I/SMESH_2smeshpy.hxx @@ -181,7 +181,8 @@ private: class _pyMesh: public _pyObject { std::list< Handle(_pyCommand) > myAddHypCmds; - std::list< Handle(_pyCommand) > mySubmeshes; + std::list< Handle(_pyCommand) > mySubmeshes; + bool myHasEditor; public: _pyMesh(const Handle(_pyCommand) theCreationCmd); const _pyID& GetGeom() { return GetCreationCmd()->GetArg(1); } -- 2.39.2