* \param theRemovedObjIDs - entries of objects whose created commands were removed
* \param theHistoricalDump - true means to keep all commands, false means
* to exclude commands relating to objects removed from study
- * \retval TCollection_AsciiString - Convertion result
+ * \retval TCollection_AsciiString - Conversion result
*/
//================================================================================
_AString indent = aCommand->GetIndentation();
_AString tryStr = indent + "try:";
_AString newCmd = indent + tab + ( aCommand->GetString().ToCString() + indent.Length() );
+ _AString pasCmd = indent + tab + "pass"; // to keep valid if newCmd is erased
_AString excStr = indent + "except:";
_AString msgStr = indent + "\tprint '"; msgStr += method + "() failed. Invalid file name?'";
aCommand->Clear();
aCommand->GetString() = newCmd;
aCommand->SetOrderNb( ++myNbCommands );
+ myCommands.push_back( new _pyCommand( pasCmd, ++myNbCommands ));
myCommands.push_back( new _pyCommand( excStr, ++myNbCommands ));
myCommands.push_back( new _pyCommand( msgStr, ++myNbCommands ));
}
* \brief Find algorithm able to create a hypothesis
* \param theGeom - The shape ID the algorithm was created on
* \param theMesh - The mesh ID that created the algorithm
- * \param theHypothesis - The hypothesis the algorithm sould be able to create
+ * \param theHypothesis - The hypothesis the algorithm should be able to create
* \retval Handle(_pyHypothesis) - The found algo
*/
//================================================================================
{
addCmd = *cmd;
cmd = addHypCmds.erase( cmd );
- if ( !theGen->IsToKeepAllCommands() && CanClear() ) {
+ if ( !theGen->IsToKeepAllCommands() /*&& CanClear()*/ ) {
addCmd->Clear();
theCommand->Clear();
}
for ( ; m != fatherMeshes.end(); ++m )
addFatherMesh( *m );
// if ( removedGeom )
- // SetRemovedFromStudy(); // as reffered geometry not in study
+ // SetRemovedFromStudy(); // as referred geometry not in study
}
if ( myGeomNotInStudy )
return;
//================================================================================
/*!
- * \brief clear creation, arg and unkown commands
+ * \brief clear creation, arg and unknown commands
*/
//================================================================================
* \brief additionally to Addition2Creation, clears SetDistrType() command
* \param theCmd - AddHypothesis() command
* \param theMesh - mesh to which a hypothesis is added
- * \retval bool - convertion result
+ * \retval bool - conversion result
*/
//================================================================================
_pyID vertex = theCmd->GetArg( 1 );
- // the problem here is that segment algo will not be found
+ // the problem here is that segment algo can be not found
// by pyHypothesis::Addition2Creation() for <vertex>, so we try to find
// geometry where segment algorithm is assigned
- Handle(_pyHypothesis) algo;
_pyID geom = vertex;
+ Handle(_pyHypothesis) algo = theGen->FindAlgo( geom, theMeshID, this );
while ( algo.IsNull() && !geom.IsEmpty()) {
// try to find geom as a father of <vertex>
geom = FatherID( geom );
algo = theGen->FindAlgo( geom, theMeshID, this );
}
- if ( algo.IsNull() )
+ if ( algo.IsNull() || geom.IsEmpty() )
return false; // also possible to find geom as brother of veretex...
+
// set geom instead of vertex
theCmd->SetArg( 1, geom );
- // set vertex as a second arg
- if ( myCurCrMethod->myArgs.size() < 1) setCreationArg( 1, "1" ); // :(
- setCreationArg( 2, vertex );
-
// mesh.AddHypothesis(vertex, SegmentLengthAroundVertex) -->
- // theMeshID.LengthNearVertex( length, vertex )
- return _pyHypothesis::Addition2Creation( theCmd, theMeshID );
+ // SegmentLengthAroundVertex = Regular_1D.LengthNearVertex( length )
+ if ( _pyHypothesis::Addition2Creation( theCmd, theMeshID ))
+ {
+ // set vertex as a second arg
+ theCmd->SetArg( 2, vertex );
+
+ return true;
+ }
}
return false;
}