mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-29 02:40:35 +05:00
PAL13073 (Submesh hypothesises do not work for NETGEN 1D-2D-3D)
add _pyCommand::GetIndentation() and addErrorTreatmentCmd() used to show status of not wrapped AddHypothesis() command
This commit is contained in:
parent
ff986a68db
commit
827169f5f3
@ -153,7 +153,7 @@ _pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod
|
|||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
void _pyGen::AddCommand( const TCollection_AsciiString& theCommand)
|
Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand)
|
||||||
{
|
{
|
||||||
// store theCommand in the sequence
|
// store theCommand in the sequence
|
||||||
myCommands.push_back( new _pyCommand( theCommand, ++myNbCommands ));
|
myCommands.push_back( new _pyCommand( theCommand, ++myNbCommands ));
|
||||||
@ -166,25 +166,25 @@ void _pyGen::AddCommand( const TCollection_AsciiString& theCommand)
|
|||||||
_pyID objID = aCommand->GetObject();
|
_pyID objID = aCommand->GetObject();
|
||||||
|
|
||||||
if ( objID.IsEmpty() )
|
if ( objID.IsEmpty() )
|
||||||
return;
|
return aCommand;
|
||||||
|
|
||||||
// SMESH_Gen method?
|
// SMESH_Gen method?
|
||||||
if ( objID == this->GetID() ) {
|
if ( objID == this->GetID() ) {
|
||||||
this->Process( aCommand );
|
this->Process( aCommand );
|
||||||
return;
|
return aCommand;
|
||||||
}
|
}
|
||||||
// SMESH_Mesh method?
|
// SMESH_Mesh method?
|
||||||
map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.find( objID );
|
map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.find( objID );
|
||||||
if ( id_mesh != myMeshes.end() ) {
|
if ( id_mesh != myMeshes.end() ) {
|
||||||
id_mesh->second->Process( aCommand );
|
id_mesh->second->Process( aCommand );
|
||||||
return;
|
return aCommand;
|
||||||
}
|
}
|
||||||
// SMESH_Hypothesis method?
|
// SMESH_Hypothesis method?
|
||||||
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
|
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
|
||||||
for ( ; hyp != myHypos.end(); ++hyp )
|
for ( ; hyp != myHypos.end(); ++hyp )
|
||||||
if ( !(*hyp)->IsAlgo() && objID == (*hyp)->GetID() ) {
|
if ( !(*hyp)->IsAlgo() && objID == (*hyp)->GetID() ) {
|
||||||
(*hyp)->Process( aCommand );
|
(*hyp)->Process( aCommand );
|
||||||
return;
|
return aCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add access to a wrapped mesh
|
// Add access to a wrapped mesh
|
||||||
@ -211,6 +211,7 @@ void _pyGen::AddCommand( const TCollection_AsciiString& theCommand)
|
|||||||
aCommand->GetString() += tmpCmd.GetString();
|
aCommand->GetString() += tmpCmd.GetString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return aCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -617,6 +618,36 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief add addition result treatement command
|
||||||
|
* \param addCmd - hypothesis addition command
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void addErrorTreatmentCmd( Handle(_pyCommand) & addCmd,
|
||||||
|
const bool isAlgo)
|
||||||
|
{
|
||||||
|
// addCmd: status = mesh.AddHypothesis( geom, hypo )
|
||||||
|
// treatement command:
|
||||||
|
// def TreatHypoStatus(status, hypName, geomName, isAlgo):
|
||||||
|
TCollection_AsciiString status = addCmd->GetResultValue();
|
||||||
|
if ( !status.IsEmpty() ) {
|
||||||
|
const _pyID& geomID = addCmd->GetArg( 1 );
|
||||||
|
const _pyID& hypoID = addCmd->GetArg( 2 );
|
||||||
|
TCollection_AsciiString cmdStr = addCmd->GetIndentation() +
|
||||||
|
SMESH_2smeshpy::SmeshpyName() + ".TreatHypoStatus( " + status + ", " +
|
||||||
|
SMESH_2smeshpy::SmeshpyName() + ".GetName(" + hypoID + "), " +
|
||||||
|
SMESH_2smeshpy::SmeshpyName() + ".GetName(" + geomID + "), " +
|
||||||
|
(char*)( isAlgo ? "True" : "False" ) + " )";
|
||||||
|
Handle(_pyCommand) cmd = theGen->AddCommand( cmdStr );
|
||||||
|
addCmd->AddDependantCmd( cmd );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Convert creation and addition of all algos and hypos
|
* \brief Convert creation and addition of all algos and hypos
|
||||||
@ -666,6 +697,8 @@ void _pyMesh::Flush()
|
|||||||
// mesh.GetMesh().AddHypothesis(geom, ALGO ) ->
|
// mesh.GetMesh().AddHypothesis(geom, ALGO ) ->
|
||||||
// mesh.GetMesh().AddHypothesis(geom, ALGO.GetAlgorithm() )
|
// mesh.GetMesh().AddHypothesis(geom, ALGO.GetAlgorithm() )
|
||||||
addCmd->SetArg( 2, addCmd->GetArg( 2 ) + ".GetAlgorithm()" );
|
addCmd->SetArg( 2, addCmd->GetArg( 2 ) + ".GetAlgorithm()" );
|
||||||
|
// add addition result treatement cmd
|
||||||
|
addErrorTreatmentCmd( addCmd, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,6 +723,8 @@ void _pyMesh::Flush()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddMeshAccess( addCmd );
|
AddMeshAccess( addCmd );
|
||||||
|
// add addition result treatement cmd
|
||||||
|
addErrorTreatmentCmd( addCmd, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1293,6 +1328,23 @@ void _pyCommand::SetBegPos( int thePartIndex, int thePosition )
|
|||||||
myBegPos( thePartIndex ) = thePosition;
|
myBegPos( thePartIndex ) = thePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Returns whitespace symbols at the line beginning
|
||||||
|
* \retval TCollection_AsciiString - result
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
TCollection_AsciiString _pyCommand::GetIndentation()
|
||||||
|
{
|
||||||
|
int end = 1;
|
||||||
|
if ( GetBegPos( RESULT_IND ) == UNKNOWN )
|
||||||
|
GetWord( myString, end, true );
|
||||||
|
else
|
||||||
|
end = GetBegPos( RESULT_IND );
|
||||||
|
return myString.SubString( 1, end - 1 );
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return substring of python command looking like ResultValue = Obj.Meth()
|
* \brief Return substring of python command looking like ResultValue = Obj.Meth()
|
||||||
|
@ -131,6 +131,7 @@ public:
|
|||||||
int Length() { return myString.Length(); }
|
int Length() { return myString.Length(); }
|
||||||
void Clear() { myString.Clear(); myBegPos.Clear(); }
|
void Clear() { myString.Clear(); myBegPos.Clear(); }
|
||||||
bool IsEmpty() const { return myString.IsEmpty(); }
|
bool IsEmpty() const { return myString.IsEmpty(); }
|
||||||
|
TCollection_AsciiString GetIndentation();
|
||||||
const TCollection_AsciiString & GetResultValue();
|
const TCollection_AsciiString & GetResultValue();
|
||||||
const TCollection_AsciiString & GetObject();
|
const TCollection_AsciiString & GetObject();
|
||||||
const TCollection_AsciiString & GetMethod();
|
const TCollection_AsciiString & GetMethod();
|
||||||
@ -191,7 +192,7 @@ class _pyGen: public _pyObject
|
|||||||
public:
|
public:
|
||||||
_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod);
|
_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod);
|
||||||
//~_pyGen();
|
//~_pyGen();
|
||||||
void AddCommand( const TCollection_AsciiString& theCommand );
|
Handle(_pyCommand) AddCommand( const TCollection_AsciiString& theCommand );
|
||||||
void Process( const Handle(_pyCommand)& theCommand );
|
void Process( const Handle(_pyCommand)& theCommand );
|
||||||
void Flush();
|
void Flush();
|
||||||
Handle(_pyHypothesis) FindHyp( const _pyID& theHypID );
|
Handle(_pyHypothesis) FindHyp( const _pyID& theHypID );
|
||||||
|
Loading…
Reference in New Issue
Block a user