From 497561723ebe6ddc64d238427307dd59e6a5fb8b Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 3 May 2012 08:40:24 +0000 Subject: [PATCH] do not clear a command creating a removed group if the command does other job like MakeBoundaryMesh() or DoubleNodeGroupNew() --- src/SMESH_I/SMESH_2smeshpy.cxx | 12 ++++++++++-- src/SMESH_I/SMESH_2smeshpy.hxx | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 9a1f356fe..dfacfd77c 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -3700,6 +3700,8 @@ _pyGroup::_pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id) if ( !id.IsEmpty() ) setID( id ); + myCanClearCreationCmd = true; + const _AString& method = theCreationCmd->GetMethod(); if ( method == "CreateGroup" ) // CreateGroup() --> CreateEmptyGroup() { @@ -3742,6 +3744,12 @@ _pyGroup::_pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id) } myFilter = filter; } + else + { + // theCreationCmd does something else apart from creation of this group + // and thus it can't be cleared if this group is removed + myCanClearCreationCmd = false; + } } //================================================================================ @@ -3829,9 +3837,9 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand) void _pyGroup::Flush() { if ( !theGen->IsToKeepAllCommands() && - myCreationCmd && myCreationCmd->MethodStartsFrom("DoubleNode") ) + myCreationCmd && !myCanClearCreationCmd ) { - myCreationCmd.Nullify(); + myCreationCmd.Nullify(); // this way myCreationCmd won't be cleared } } diff --git a/src/SMESH_I/SMESH_2smeshpy.hxx b/src/SMESH_I/SMESH_2smeshpy.hxx index 1fccb3750..b1019b72d 100644 --- a/src/SMESH_I/SMESH_2smeshpy.hxx +++ b/src/SMESH_I/SMESH_2smeshpy.hxx @@ -579,6 +579,7 @@ DEFINE_STANDARD_HANDLE (_pyFilter, _pyObject); class _pyGroup: public _pySubMesh { Handle(_pyFilter) myFilter; + bool myCanClearCreationCmd; public: _pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id=_pyID()); virtual void Process( const Handle(_pyCommand)& theCommand); -- 2.30.2