[SALOME platform 0013410]: SubMesh not taken into account with Netgen 1D-2D et 1D-2D-3D

//================================================================================
 /*!
+ * \brief Return name of the algorithm that does not support submeshes and makes
+ * submesh creation useless
+ *  \retval char* - string is to be deleted!!!
+ */
+//================================================================================
+
+char* SMESHGUI_MeshOp::isSubmeshIgnored() const
This commit is contained in:
eap 2008-09-16 14:49:49 +00:00
parent 2bc1c40f58
commit 8e7cd4625d
2 changed files with 61 additions and 1 deletions

View File

@ -340,6 +340,53 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
return false; return false;
} }
//================================================================================
/*!
* \brief Return name of the algorithm that does not support submeshes and makes
* submesh creation useless
* \retval char* - string is to be deleted!!!
*/
//================================================================================
char* SMESHGUI_MeshOp::isSubmeshIgnored() const
{
if ( myToCreate && !myIsMesh ) {
QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
_PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.latin1() );
if ( pMesh ) {
QStringList algoNames;
THypList algoList;
existingHyps(3, Algo, pMesh, algoNames, algoList);
if (!algoList.empty()) {
HypothesisData* algo = SMESH::GetHypothesisData( algoList[0].first->GetName() );
if ( algo &&
algo->InputTypes.empty() && // builds all dimensions it-self
!algo->IsSupportSubmeshes )
return CORBA::string_dup( algoNames[0].latin1() );
}
// GEOM::GEOM_Object_var geom;
// if (_PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() ))
// geom = SMESH::SObjectToInterface<GEOM::GEOM_Object>( pGeom );
// if ( !geom->_is_nil() && geom->GetShapeType() >= GEOM::FACE ) { // WIRE, EDGE as well
existingHyps(2, Algo, pMesh, algoNames, algoList);
if (!algoList.empty()) {
HypothesisData* algo = SMESH::GetHypothesisData( algoList[0].first->GetName() );
if ( algo &&
algo->InputTypes.empty() && // builds all dimensions it-self
!algo->IsSupportSubmeshes )
return CORBA::string_dup( algoNames[0].latin1() );
}
// }
}
}
return 0;
}
//================================================================================ //================================================================================
/*! /*!
* \brief find an existing submesh by the selected shape * \brief find an existing submesh by the selected shape
@ -526,8 +573,20 @@ void SMESHGUI_MeshOp::selectionDone()
myDlg->selectObject( "", SMESHGUI_MeshDlg::Geom, "" ); myDlg->selectObject( "", SMESHGUI_MeshDlg::Geom, "" );
selectObject( _PTR(SObject)() ); selectObject( _PTR(SObject)() );
selectionDone(); selectionDone();
return;
} }
} }
// discard selected mesh if submesh creation not allowed because of
// a global algorithm that does not support submeshes
if ( char* algoName = isSubmeshIgnored() ) {
SUIT_MessageBox::warn1( myDlg, tr( "SMESH_ERROR" ),
tr("SUBMESH_NOT_ALLOWED").arg(algoName), tr( "SMESH_BUT_OK" ));
CORBA::string_free( algoName );
myDlg->selectObject( "", SMESHGUI_MeshDlg::Mesh, "" );
selectObject( _PTR(SObject)() );
selectionDone();
return;
}
// enable/disable popup for choice of geom selection way // enable/disable popup for choice of geom selection way
bool enable = false; bool enable = false;

View File

@ -100,7 +100,7 @@ private:
QStringList& theHyps, QStringList& theHyps,
THypDataList& theDataList, THypDataList& theDataList,
HypothesisData* theAlgoData = 0 ) const; HypothesisData* theAlgoData = 0 ) const;
void existingHyps( const int theDim, static void existingHyps( const int theDim,
const int theHypType, const int theHypType,
_PTR(SObject) theFather, _PTR(SObject) theFather,
QStringList& theHyps, QStringList& theHyps,
@ -129,6 +129,7 @@ private:
SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString& aHypType, SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString& aHypType,
const QString& aServerLib ) const; const QString& aServerLib ) const;
bool isSubshapeOk() const; bool isSubshapeOk() const;
char* isSubmeshIgnored() const;
_PTR(SObject) getSubmeshByGeom() const; _PTR(SObject) getSubmeshByGeom() const;
void selectObject( _PTR(SObject) ) const; void selectObject( _PTR(SObject) ) const;