From: eap Date: Fri, 29 Mar 2013 13:36:15 +0000 (+0000) Subject: 0051789: TC7.2.0: NoteBook cannot update study X-Git-Tag: pluginMGCleaner~22 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=daf037da97683c701c7a60ed450ea57b988409e1;p=modules%2Fsmesh.git 0051789: TC7.2.0: NoteBook cannot update study Fix for "NumberOfSegmants" contained in "LayerDistribution" hypothesis --- diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index b3a4e1278..b8f6840b7 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -3051,18 +3051,23 @@ void _pyNumberOfSegmentsHyp::Flush() list::reverse_iterator cmd = myUnusedCommands.rbegin(); int distrTypeNb = 0; for ( ; !distrTypeNb && cmd != myUnusedCommands.rend(); ++cmd ) - if ( (*cmd)->GetMethod() == "SetDistrType" ) - distrTypeNb = (*cmd)->GetOrderNb(); - else if (IsWrapped() && (*cmd)->GetMethod() == "SetObjectEntry" ) + if ( (*cmd)->GetMethod() == "SetDistrType" ) { + if ( cmd != myUnusedCommands.rbegin() ) + distrTypeNb = (*cmd)->GetOrderNb(); + } + else if (IsWrapped() && (*cmd)->GetMethod() == "SetObjectEntry" ) { (*cmd)->Clear(); - + } // clear commands before the last SetDistrType() list * cmds[2] = { &myArgCommands, &myUnusedCommands }; + set< int > treatedCmdNbs; // avoid treating same cmd twice for ( int i = 0; i < 2; ++i ) { set uniqueMethods; list & cmdList = *cmds[i]; for ( cmd = cmdList.rbegin(); cmd != cmdList.rend(); ++cmd ) { + if ( !treatedCmdNbs.insert( (*cmd)->GetOrderNb() ).second ) + continue;// avoid treating same cmd twice bool clear = ( (*cmd)->GetOrderNb() < distrTypeNb ); const TCollection_AsciiString& method = (*cmd)->GetMethod(); if ( !clear || method == "SetNumberOfSegments" ) {