From f285075263e536fba3f029d845d08378467d7f92 Mon Sep 17 00:00:00 2001 From: enk Date: Tue, 21 Mar 2006 08:08:05 +0000 Subject: [PATCH] Fix for Bug IPAL11843: Error in the python code if use Nb. Segments hypothesis with analitic density --- src/SMESH_I/SMESH_2smeshpy.cxx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 609abbe43..326015f26 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -909,12 +909,21 @@ bool _pyNumberOfSegmentsHyp::Addition2Creation( const Handle(_pyCommand)& theCmd const _pyID& theMesh) { if ( IsWrappable( theMesh ) && myArgs.Length() > 0 ) { - list::iterator cmd = myUnknownCommands.begin(); - for ( ; cmd != myUnknownCommands.end(); ++cmd ) { - // clear SetDistrType() - if ( (*cmd)->GetString().Location( "SetDistrType", 1, (*cmd)->Length() )) - (*cmd)->Clear(); + list aNewCommandsList; + list aNewList; + list::iterator aNewListIter; + + list::reverse_iterator cmd = myUnknownCommands.rbegin(); + for ( ; cmd != myUnknownCommands.rend(); ++cmd ) { + aNewListIter = find(aNewList.begin(),aNewList.end(),(*cmd)->GetMethod()); + if(aNewListIter == aNewList.end()){ + aNewList.push_front((*cmd)->GetMethod()); + aNewCommandsList.push_front((*cmd)); + } else { + (*cmd)->Clear(); + } } + myUnknownCommands = aNewCommandsList; } return _pyHypothesis::Addition2Creation( theCmd, theMesh ); } @@ -1280,8 +1289,8 @@ void _pyCommand::RemoveArgs() bool _pyCommand::SetDependentCmdsAfter() const { bool orderChanged = false; - list< Handle(_pyCommand)>::const_iterator cmd = myDependentCmds.begin(); - for ( ; cmd != myDependentCmds.end(); ++cmd ) { + list< Handle(_pyCommand)>::const_reverse_iterator cmd = myDependentCmds.rbegin(); + for ( ; cmd != myDependentCmds.rend(); ++cmd ) { if ( (*cmd)->GetOrderNb() < GetOrderNb() ) { orderChanged = true; theGen->SetCommandAfter( *cmd, this ); -- 2.39.2