X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_2smeshpy.cxx;h=cfa660a2c3f7882da212debfd7ff21b5f7a0176b;hp=96724a917b5d5d8b070906f614fefe60cf3399b8;hb=6eb4c261736600c952fd2f73b4d87d5ef11f522d;hpb=c243e785058d1fdbed7fb2e107f59e098909f2a8 diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 96724a917..cfa660a2c 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -893,6 +893,18 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) sameMethods.Insert( names ); } + // names of SMESH_MeshEditor methods which differ from methods of class Mesh + // only last two arguments + static TStringSet diffLastTwoArgsMethods; + if (diffLastTwoArgsMethods.empty() ){ + const char * names[] = { + "MirrorMakeGroups","MirrorObjectMakeGroups", + "TranslateMakeGroups","TranslateObjectMakeGroups", + "RotateMakeGroups","RotateObjectMakeGroups", + ""};// <- mark of the end + diffLastTwoArgsMethods.Insert( names ); + } + if ( sameMethods.Contains( theCommand->GetMethod() )) { theCommand->SetObject( myMesh ); @@ -902,11 +914,32 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) _pyMesh( new _pyCommand( theCommand->GetString(), 0 )); // for theGen->SetAccessorMethod() } else { - // editor creation command is needed only if any editor function is called - theGen->AddMeshAccessorMethod( theCommand ); // for *Object() - if ( !myCreationCmdStr.IsEmpty() ) { - GetCreationCmd()->GetString() = myCreationCmdStr; - myCreationCmdStr.Clear(); + + //Replace SMESH_MeshEditor "MakeGroups" functions on the Mesh + //functions with the flag "theMakeGroups = True" like: + //SMESH_MeshEditor.CmdMakeGroups => Mesh.Cmd(...,True) + int pos = theCommand->GetMethod().Search("MakeGroups"); + if( pos != -1) { + // 1. Remove "MakeGroups" from the Command + TCollection_AsciiString aMethod = theCommand->GetMethod(); + int nbArgsToAdd = diffLastTwoArgsMethods.Contains(aMethod) ? 2 : 1; + aMethod.Trunc(pos-1); + theCommand->SetMethod(aMethod); + + // 2. Set Mesh object instead SMESH_MeshEditor + theCommand->SetObject( myMesh ); + + // 3. And add last "True" argument + while(nbArgsToAdd--) + theCommand->SetArg(theCommand->GetNbArgs()+1,"True "); + } + else { + // editor creation command is needed only if any editor function is called + theGen->AddMeshAccessorMethod( theCommand ); // for *Object() + if ( !myCreationCmdStr.IsEmpty() ) { + GetCreationCmd()->GetString() = myCreationCmdStr; + myCreationCmdStr.Clear(); + } } } }