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
myDlg->selectObject( "", SMESHGUI_MeshDlg::Geom, "" );
selectObject( _PTR(SObject)() );
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
bool enable = false;
QStringList& theHyps,
THypDataList& theDataList,
HypothesisData* theAlgoData = 0 ) const;
- void existingHyps( const int theDim,
+ static void existingHyps( const int theDim,
const int theHypType,
_PTR(SObject) theFather,
QStringList& theHyps,
SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString& aHypType,
const QString& aServerLib ) const;
bool isSubshapeOk() const;
+ char* isSubmeshIgnored() const;
_PTR(SObject) getSubmeshByGeom() const;
void selectObject( _PTR(SObject) ) const;