From b5d9b2799bddb4bc47b05b777754a1cfc1051dd1 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 28 Feb 2013 14:28:04 +0000 Subject: [PATCH] 1) Treat GMF import/export 2) Fix RemoveArgs() not to clear the whole command if it is like "(res1,res2) = meth(arg)" --- src/SMESH_I/SMESH_2smeshpy.cxx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 57a076883..6b822f098 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -773,6 +773,14 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand ) Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue(ind+1)); myMeshes.insert( make_pair( mesh->GetID(), mesh )); } + if ( method == "CreateMeshesFromGMF" ) + { + // CreateMeshesFromGMF( theFileName, theMakeRequiredGroups ) -> + // CreateMeshesFromGMF( theFileName ) + _AString file = theCommand->GetArg(1); + theCommand->RemoveArgs(); + theCommand->SetArg( 1, file ); + } } // CreateHypothesis() @@ -1571,7 +1579,7 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) method == "ExportToMEDX" ) { // ExportToMEDX() --> ExportMED() theCommand->SetMethod( "ExportMED" ); } - else if ( method == "ExportCGNS" || method == "ExportGMF" ) + else if ( method == "ExportCGNS" ) { // ExportCGNS(part, ...) -> ExportCGNS(..., part) _pyID partID = theCommand->GetArg( 1 ); int nbArgs = theCommand->GetNbArgs(); @@ -1579,6 +1587,14 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) theCommand->SetArg( i-1, theCommand->GetArg( i )); theCommand->SetArg( nbArgs, partID ); } + else if ( method == "ExportGMF" ) + { // ExportGMF(part,file,bool) -> ExportCGNS(file, part) + _pyID partID = theCommand->GetArg( 1 ); + _AString file = theCommand->GetArg( 2 ); + theCommand->RemoveArgs(); + theCommand->SetArg( 1, file ); + theCommand->SetArg( 2, partID ); + } else if ( theCommand->MethodStartsFrom( "ExportPartTo" )) { // ExportPartTo*(part, ...) -> Export*(..., part) // @@ -3593,7 +3609,7 @@ void _pyCommand::SetArg( int index, const TCollection_AsciiString& theArg) void _pyCommand::RemoveArgs() { - if ( int pos = myString.Location( '(', 1, Length() )) + if ( int pos = myString.Location( '(', Max( 1, GetBegPos( METHOD_IND )), Length() )) myString.Trunc( pos ); myString += ")"; myArgs.Clear(); -- 2.30.2