//================================================================================
void SMESHGUI_MeshOp::selectionDone()
{
- if ( !dlg()->isShown() )
+ if ( !dlg()->isShown() || !myDlg->isEnabled() )
return;
SMESHGUI_SelectionOp::selectionDone();
// with values used to mesh a subshape
SMESH::SMESH_Hypothesis_var initParamHyp =
getInitParamsHypothesis(theTypeName, aData->ServerLibName);
+ myDlg->setEnabled( false );
aCreator->create(initParamHyp, myDlg);
+ myDlg->setEnabled( true );
} else {
SMESH::CreateHypothesis(theTypeName, aData->Label, false);
}
char* aTypeName = aHyp->GetName();
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( aTypeName );
- if ( aCreator )
+ if ( aCreator ) {
+ myDlg->setEnabled( false );
aCreator->edit( aHyp.in(), dlg() );
+ myDlg->setEnabled( true );
+ }
}
//================================================================================
{
int aNewHypIndex = currentHyp( dim, hypType );
int anOldHypIndex = -1;
+
+ // remove old hypotheses
if ( myObjHyps[ dim ][ hypType ].count() > 0 )
+ {
anOldHypIndex = find( myObjHyps[ dim ][ hypType ].first(),
myExistingHyps[ dim ][ hypType ] );
- if ( aNewHypIndex != anOldHypIndex )
- {
- // remove old hypotheses
- if ( anOldHypIndex >= 0 ) {
- SMESH::RemoveHypothesisOrAlgorithmOnMesh(
- pObj, myExistingHyps[ dim ][ hypType ][ anOldHypIndex ] );
+ if ( aNewHypIndex != anOldHypIndex || // different hyps
+ anOldHypIndex == -1 ) // hyps of different algos
+ {
+ SMESH::RemoveHypothesisOrAlgorithmOnMesh
+ ( pObj, myObjHyps[ dim ][ hypType ].first() );
myObjHyps[ dim ][ hypType ].clear();
}
+ }
- // assign new hypotheses
- if ( aNewHypIndex != -1 )
+ // assign new hypotheses
+ if ( aNewHypIndex != anOldHypIndex && aNewHypIndex != -1 )
+ {
+ SMESH::SMESH_Mesh_var aMeshVar =
+ SMESH::SMESH_Mesh::_narrow( _CAST(SObject,pObj)->GetObject() );
+ bool isMesh = !aMeshVar->_is_nil();
+ if ( isMesh )
{
- SMESH::SMESH_Mesh_var aMeshVar =
- SMESH::SMESH_Mesh::_narrow( _CAST(SObject,pObj)->GetObject() );
- bool isMesh = !aMeshVar->_is_nil();
- if ( isMesh )
- {
- SMESH::AddHypothesisOnMesh(
- aMeshVar, myExistingHyps[ dim ][ hypType ][ aNewHypIndex ] );
- }
- else
- {
- SMESH::SMESH_subMesh_var aVar =
- SMESH::SMESH_subMesh::_narrow( _CAST(SObject,pObj)->GetObject() );
- if ( !aVar->_is_nil() )
- SMESH::AddHypothesisOnSubMesh(
- aVar, myExistingHyps[ dim ][ hypType ][ aNewHypIndex ] );
- }
+ SMESH::AddHypothesisOnMesh
+ (aMeshVar, myExistingHyps[ dim ][ hypType ][ aNewHypIndex ] );
+ }
+ else
+ {
+ SMESH::SMESH_subMesh_var aVar =
+ SMESH::SMESH_subMesh::_narrow( _CAST(SObject,pObj)->GetObject() );
+ if ( !aVar->_is_nil() )
+ SMESH::AddHypothesisOnSubMesh
+ ( aVar, myExistingHyps[ dim ][ hypType ][ aNewHypIndex ] );
}
- // reread all hypotheses of mesh if necessary
- QStringList anExisting;
- existingHyps( dim, hypType, pObj, anExisting, myObjHyps[ dim ][ hypType ] );
}
+ // reread all hypotheses of mesh if necessary
+ QStringList anExisting;
+ existingHyps( dim, hypType, pObj, anExisting, myObjHyps[ dim ][ hypType ] );
}
}