mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-12 17:50:34 +05:00
Update of CheckDone
Removed the isDone argument using cxx isComputedOK instead (now in the idl) Corrected a bug when doing multiple compute checkCompute was not properly removed.
This commit is contained in:
parent
127761db37
commit
6fe43e9346
@ -436,6 +436,12 @@ module SMESH
|
||||
void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Return True if all the submeshes are computed
|
||||
*/
|
||||
boolean IsComputedOK()
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Get the list of groups existing in the mesh
|
||||
*/
|
||||
|
@ -1016,7 +1016,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
|
||||
// Concatenate( [mesh1, ...], ... )
|
||||
// CreateHypothesis( theHypType, theLibName )
|
||||
// Compute( mesh, geom )
|
||||
// CheckCompute( mesh, isDone )
|
||||
// CheckCompute( mesh )
|
||||
// Evaluate( mesh, geom )
|
||||
// mesh creation
|
||||
TCollection_AsciiString method = theCommand->GetMethod();
|
||||
@ -1095,15 +1095,13 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
|
||||
if ( id_mesh != myMeshes.end() ) {
|
||||
theCommand->SetObject( meshID );
|
||||
theCommand->RemoveArgs();
|
||||
std::cout << "command: " << theCommand->GetString() << std::endl;
|
||||
id_mesh->second->Process( theCommand );
|
||||
id_mesh->second->AddProcessedCmd( theCommand );
|
||||
std::cout << "command processed: " << theCommand->GetString() << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// smeshgen.CheckCompute( mesh, isDone ) --> mesh.CheckCompute(isDone)
|
||||
// smeshgen.CheckCompute( mesh ) --> mesh.CheckCompute()
|
||||
if ( method == "CheckCompute" )
|
||||
{
|
||||
const _pyID& meshID = theCommand->GetArg( 1 );
|
||||
@ -1111,7 +1109,6 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
|
||||
if ( id_mesh != myMeshes.end() ) {
|
||||
theCommand->SetObject( meshID );
|
||||
theCommand->RemoveArgs();
|
||||
theCommand->SetArg(1, "isDone");
|
||||
id_mesh->second->Process( theCommand );
|
||||
id_mesh->second->AddProcessedCmd( theCommand );
|
||||
return;
|
||||
@ -1928,6 +1925,31 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
|
||||
}
|
||||
Flush();
|
||||
}
|
||||
// in snapshot mode, clear the previous CheckCompute()
|
||||
else if ( method == "CheckCompute" )
|
||||
{
|
||||
if ( !theGen->IsToKeepAllCommands() ) // !historical
|
||||
{
|
||||
if ( !myLastCheckCmd.IsNull() )
|
||||
{
|
||||
// check if the previously computed mesh has been edited,
|
||||
// if so then we do not clear the previous Compute()
|
||||
bool toClear = true;
|
||||
list< Handle(_pyMeshEditor)>::iterator e = myEditors.begin();
|
||||
for ( ; e != myEditors.end() && toClear; ++e )
|
||||
{
|
||||
list< Handle(_pyCommand)>& cmds = (*e)->GetProcessedCmds();
|
||||
list< Handle(_pyCommand) >::reverse_iterator cmd = cmds.rbegin();
|
||||
if ( cmd != cmds.rend() &&
|
||||
(*cmd)->GetOrderNb() > myLastCheckCmd->GetOrderNb() )
|
||||
toClear = false;
|
||||
}
|
||||
if ( toClear )
|
||||
myLastCheckCmd->Clear();
|
||||
}
|
||||
myLastCheckCmd = theCommand;
|
||||
}
|
||||
}
|
||||
// ----------------------------------------------------------------------
|
||||
else if ( method == "Clear" ) // in snapshot mode, clear all previous commands
|
||||
{
|
||||
|
@ -53,7 +53,7 @@
|
||||
* The creation reason is that smeshBuilder.py commands defining hypotheses encapsulate
|
||||
* several SMESH engine method calls. As well, the dependencies between smeshBuilder.py
|
||||
* classes differ from ones between corresponding SMESH IDL interfaces.
|
||||
*
|
||||
*
|
||||
* Everything here is for internal usage by SMESH_2smeshpy::ConvertScript()
|
||||
* declared in SMESH_PythonDump.hxx
|
||||
*/
|
||||
@ -350,6 +350,7 @@ class _pyMesh: public _pyObject
|
||||
std::list< Handle(_pyMesh) > myChildMeshes; // depending on me
|
||||
bool myGeomNotInStudy;
|
||||
Handle(_pyCommand) myLastComputeCmd;
|
||||
Handle(_pyCommand) myLastCheckCmd;
|
||||
public:
|
||||
_pyMesh(const Handle(_pyCommand) creationCmd);
|
||||
_pyMesh(const Handle(_pyCommand) theCreationCmd, const _pyID & id);
|
||||
@ -373,7 +374,7 @@ private:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(_pyMesh,_pyObject)
|
||||
};
|
||||
#undef _pyMesh_ACCESS_METHOD
|
||||
#undef _pyMesh_ACCESS_METHOD
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
/*!
|
||||
|
@ -2080,7 +2080,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
TPythonDump(this) << "isDone = " << this << ".Compute( "
|
||||
<< theMesh << ", " << theShapeObject << ")";
|
||||
TPythonDump(this) << this << ".CheckCompute( "
|
||||
<< theMesh << ", isDone" << ")";
|
||||
<< theMesh << ")";
|
||||
|
||||
try {
|
||||
// get mesh servant
|
||||
|
@ -5954,7 +5954,7 @@ void SMESH_Mesh_i::CreateGroupServants()
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
bool SMESH_Mesh_i::IsComputedOK()
|
||||
CORBA::Boolean SMESH_Mesh_i::IsComputedOK()
|
||||
{
|
||||
return _impl->IsComputedOK();
|
||||
}
|
||||
|
@ -424,15 +424,15 @@ public:
|
||||
*/
|
||||
void CreateGroupServants();
|
||||
|
||||
/*!
|
||||
* \brief Return true if all sub-meshes are computed OK - to update an icon
|
||||
*/
|
||||
bool IsComputedOK();
|
||||
|
||||
|
||||
// ====================================
|
||||
// SMESH_Mesh interface (continuation)
|
||||
// ====================================
|
||||
/*!
|
||||
* \brief Return true if all sub-meshes are computed OK - to update an icon
|
||||
*/
|
||||
CORBA::Boolean IsComputedOK();
|
||||
|
||||
/*!
|
||||
* \brief Return groups cantained in _mapGroups by their IDs
|
||||
|
@ -2001,11 +2001,11 @@ class Mesh(metaclass = MeshMeta):
|
||||
|
||||
return ok
|
||||
|
||||
def CheckCompute(self, isDone):
|
||||
def CheckCompute(self):
|
||||
"""
|
||||
Check if the mesh was properly compute
|
||||
"""
|
||||
if not isDone:
|
||||
if not self.mesh.IsComputedOK():
|
||||
raise Exception("Could not compute {}".format(self.GetName()))
|
||||
|
||||
def GetComputeErrors(self, shape=0 ):
|
||||
|
Loading…
Reference in New Issue
Block a user