method == "ExportToMEDX" ) { // ExportToMEDX() --> ExportMED()
theCommand->SetMethod( "ExportMED" );
}
- else if ( method == "ExportCGNS" )
+ else if ( method == "ExportCGNS" || method == "ExportGMF" )
{ // ExportCGNS(part, ...) -> ExportCGNS(..., part)
_pyID partID = theCommand->GetArg( 1 );
int nbArgs = theCommand->GetNbArgs();
{
_pyID hypID = theCommand->GetArg( 2 );
_pyID geomID = theCommand->GetArg( 1 );
+ bool isLocal = ( geomID != GetGeom() );
// check if this mesh still has corresponding addition command
- bool hasAddCmd = false;
- list< Handle(_pyCommand) >::iterator cmd = myAddHypCmds.begin();
- while ( cmd != myAddHypCmds.end() )
+ Handle(_pyCommand) addCmd;
+ list< Handle(_pyCommand) >::iterator cmd;
+ list< Handle(_pyCommand) >* addCmds[2] = { &myAddHypCmds, &myNotConvertedAddHypCmds };
+ for ( int i = 0; i < 2; ++i )
{
- // AddHypothesis(geom, hyp)
- if ( hypID == (*cmd)->GetArg( 2 ) &&
- geomID == (*cmd)->GetArg( 1 )) { // erase both (add and remove) commands
- theCommand->Clear();
- (*cmd)->Clear();
- cmd = myAddHypCmds.erase( cmd );
- hasAddCmd = true;
- }
- else {
- ++cmd;
+ list< Handle(_pyCommand )> & addHypCmds = *(addCmds[i]);
+ for ( cmd = addHypCmds.begin(); cmd != addHypCmds.end(); )
+ {
+ bool sameHyp = true;
+ if ( hypID != (*cmd)->GetArg( 1 ) && hypID != (*cmd)->GetArg( 2 ))
+ sameHyp = false; // other hyp
+ if ( (*cmd)->GetNbArgs() == 2 &&
+ geomID != (*cmd)->GetArg( 1 ) && geomID != (*cmd)->GetArg( 2 ))
+ sameHyp = false; // other geom
+ if ( (*cmd)->GetNbArgs() == 1 && isLocal )
+ sameHyp = false; // other geom
+ if ( sameHyp )
+ {
+ addCmd = *cmd;
+ cmd = addHypCmds.erase( cmd );
+ if ( !theGen->IsToKeepAllCommands() ) {
+ addCmd->Clear();
+ theCommand->Clear();
+ }
+ }
+ else
+ {
+ ++cmd;
+ }
}
}
Handle(_pyHypothesis) hyp = theGen->FindHyp( hypID );
- if ( ! hasAddCmd && hypID.Length() != 0 ) { // hypo addition already wrapped
+ if ( !theCommand->IsEmpty() && !hypID.IsEmpty() ) {
// RemoveHypothesis(geom, hyp) --> RemoveHypothesis( hyp, geom=0 )
_pyID geom = theCommand->GetArg( 1 );
theCommand->RemoveArgs();
addCmd->SetArg( 1, algoID );
if ( isLocalAlgo )
addCmd->SetArg( 2, geom );
+ myNotConvertedAddHypCmds.push_back( addCmd );
}
}
addCmd->SetArg( 1, hypID );
if ( geom != GetGeom() )
addCmd->SetArg( 2, geom );
+ myNotConvertedAddHypCmds.push_back( addCmd );
}
}
_pyHypothesisReader::_pyHypothesisReader()
{
- // Get paths to xml files of plugins
- vector< string > xmlPaths;
- string sep;
- if ( const char* meshersList = getenv("SMESH_MeshersList") )
- {
- string meshers = meshersList, plugin;
- string::size_type from = 0, pos;
- while ( from < meshers.size() )
- {
- // cut off plugin name
- pos = meshers.find( ':', from );
- if ( pos != string::npos )
- plugin = meshers.substr( from, pos-from );
- else
- plugin = meshers.substr( from ), pos = meshers.size();
- from = pos + 1;
-
- // get PLUGIN_ROOT_DIR path
- string rootDirVar, pluginSubDir = plugin;
- if ( plugin == "StdMeshers" )
- rootDirVar = "SMESH", pluginSubDir = "smesh";
- else
- for ( pos = 0; pos < plugin.size(); ++pos )
- rootDirVar += toupper( plugin[pos] );
- rootDirVar += "_ROOT_DIR";
-
- const char* rootDir = getenv( rootDirVar.c_str() );
- if ( !rootDir || strlen(rootDir) == 0 )
- {
- rootDirVar = plugin + "_ROOT_DIR"; // HexoticPLUGIN_ROOT_DIR
- rootDir = getenv( rootDirVar.c_str() );
- if ( !rootDir || strlen(rootDir) == 0 ) continue;
- }
-
- // get a separator from rootDir
- for ( pos = strlen( rootDir )-1; pos >= 0 && sep.empty(); --pos )
- if ( rootDir[pos] == '/' || rootDir[pos] == '\\' )
- {
- sep = rootDir[pos];
- break;
- }
-#ifdef WNT
- if (sep.empty() ) sep = "\\";
-#else
- if (sep.empty() ) sep = "/";
-#endif
-
- // get a path to resource file
- string xmlPath = rootDir;
- if ( xmlPath[ xmlPath.size()-1 ] != sep[0] )
- xmlPath += sep;
- xmlPath += "share" + sep + "salome" + sep + "resources" + sep;
- for ( pos = 0; pos < pluginSubDir.size(); ++pos )
- xmlPath += tolower( pluginSubDir[pos] );
- xmlPath += sep + plugin + ".xml";
- bool fileOK;
-#ifdef WNT
- fileOK = (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES);
-#else
- fileOK = (access(xmlPath.c_str(), F_OK) == 0);
-#endif
- if ( fileOK )
- xmlPaths.push_back( xmlPath );
- }
- }
-
// Read xml files
+ vector< string > xmlPaths = SMESH_Gen::GetPluginXMLPaths();
LDOMParser xmlParser;
for ( size_t i = 0; i < xmlPaths.size(); ++i )
{