<hypothesis type="MaxElementVolume"
label-id="Max. Element Volume"
icon-id="mesh_hypo_volume.png"
+ need-geom = "false"
dim="3"/>
<hypothesis type="ProjectionSource3D"
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
ret = false;;
}
+ if ((algo && !aMesh.HasShapeToMesh()))
+ {
+ if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
+ smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
+
+ if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
+ ret = false;;
+ }
}
// -----------------------------------------------
if(MYDEBUG) MESSAGE("UNVToMesh - theFileName = "<<theFileName);
if(_isShapeToMesh)
throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
- _isShapeToMesh = true;
+ _isShapeToMesh = false;
DriverUNV_R_SMDS_Mesh myReader;
myReader.SetMesh(_myMeshDS);
myReader.SetFile(theFileName);
if(MYDEBUG) MESSAGE("MEDToMesh - theFileName = "<<theFileName<<", mesh name = "<<theMeshName);
if(_isShapeToMesh)
throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
- _isShapeToMesh = true;
+ _isShapeToMesh = false;
DriverMED_R_SMESHDS_Mesh myReader;
myReader.SetMesh(_myMeshDS);
myReader.SetMeshId(-1);
if(MYDEBUG) MESSAGE("STLToMesh - theFileName = "<<theFileName);
if(_isShapeToMesh)
throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
- _isShapeToMesh = true;
+ _isShapeToMesh = false;
DriverSTL_R_SMDS_Mesh myReader;
myReader.SetMesh(_myMeshDS);
myReader.SetFile(theFileName);
return true;
}
+
+/**
+ * Check mesh without geometry for: if all elements on this shape are quadratic,
+ * quadratic elements will be created.
+ * Used then generated 3D mesh without geometry.
+ */
+SMESH_MesherHelper:: MType SMESH_MesherHelper::IsQuadraticMesh()
+{
+ int NbAllEdgsAndFaces=0;
+ int NbQuadFacesAndEdgs=0;
+ int NbFacesAndEdges=0;
+ //All faces and edges
+ NbAllEdgsAndFaces = myMesh->NbEdges() + myMesh->NbFaces();
+
+ //Quadratic faces and edges
+ NbQuadFacesAndEdgs = myMesh->NbEdges(ORDER_QUADRATIC) + myMesh->NbFaces(ORDER_QUADRATIC);
+
+ //Linear faces and edges
+ NbFacesAndEdges = myMesh->NbEdges(ORDER_LINEAR) + myMesh->NbFaces(ORDER_LINEAR);
+
+ if (NbAllEdgsAndFaces == NbQuadFacesAndEdgs) {
+ //Quadratic mesh
+ return SMESH_MesherHelper::QUADRATIC;
+ }
+ else if (NbAllEdgsAndFaces == NbFacesAndEdges) {
+ //Linear mesh
+ return SMESH_MesherHelper::LINEAR;
+ }
+ else
+ //Mesh with both type of elements
+ return SMESH_MesherHelper::COMP;
+}
+
*/
const NLinkNodeMap& GetNLinkNodeMap() const { return myNLinkNodeMap; }
+ /**
+ * Check mesh without geometry for: if all elements on this shape are quadratic,
+ * quadratic elements will be created.
+ * Used then generated 3D mesh without geometry.
+ */
+ enum MType{ LINEAR, QUADRATIC, COMP };
+ MType IsQuadraticMesh();
+
protected:
/*!
case TopAbs_SOLID:
{
//MESSAGE("solid");
- for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More();
- exp.Next())
- {
- InsertDependence(exp.Current());
+ if(_father->HasShapeToMesh()) {
+ for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More();
+ exp.Next())
+ {
+ InsertDependence(exp.Current());
+ }
}
break;
}
bool SMESH_subMesh::CanAddHypothesis(const SMESH_Hypothesis* theHypothesis) const
{
int aHypDim = theHypothesis->GetDim();
- int aShapeDim = SMESH_Gen::GetShapeDim(_subShape);
- if ( aHypDim <= aShapeDim )
- return true;
+ if(_father->HasShapeToMesh()) {
+ int aShapeDim = SMESH_Gen::GetShapeDim(_subShape);
+ if ( aHypDim <= aShapeDim )
+ return true;
+ }
+ else
+ //Only 3D hypothesis may be assigned to the mesh w/o geometry
+ return aHypDim == 3;
// if ( aHypDim < aShapeDim )
// return ( _father->IsMainShape( _subShape ));
// check if a shape needed by algo is present
// -------------------------------------------
algo = static_cast< SMESH_Algo* >( anHyp );
- if ( !_father->HasShapeToMesh() && algo->NeedShape() )
- return SMESH_Hypothesis::HYP_BAD_GEOMETRY;
+ if(_father->GetShapeToMesh() != SMESH_Mesh::PseudoShape())
+ if ( !_father->HasShapeToMesh() && algo->NeedShape() )
+ return SMESH_Hypothesis::HYP_BAD_GEOMETRY;
// ----------------------
// check mesh conformity
// ----------------------
if ( ! CanAddHypothesis( anHyp )) // check dimension
return SMESH_Hypothesis::HYP_BAD_DIM;
+ if(anHyp->GetDim() == 3 && !_father->HasShapeToMesh()
+ && event == ADD_ALGO) {
+ //Only NETGEN_3D and GHS3D_3D can be assigned to the Mesh w/o geometryy
+ bool isNetgen3D = (strcmp( "NETGEN_3D", anHyp->GetName()) == 0);
+ bool isGhs3d = (strcmp( "GHS3D_3D", anHyp->GetName()) == 0);
+ if( !isNetgen3D && !isGhs3d)
+ return SMESH_Hypothesis::HYP_BAD_DIM;
+ }
+
+
+
if ( /*!anHyp->IsAuxiliary() &&*/ GetSimilarAttached( _subShape, anHyp ) )
return SMESH_Hypothesis::HYP_ALREADY_EXIST;
MemoryReserve aMemoryReserve;
_PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh);
myMainShape = aMesh->GetShapeToMesh();
- if ( !myMainShape->_is_nil() && aMeshSObj )
+ if ( ((!myMainShape->_is_nil() && aMesh->HasShapeToMesh()) ||
+ (myMainShape->_is_nil() && !aMesh->HasShapeToMesh()))
+ && aMeshSObj )
{
myDlg->myMeshName->setText( aMeshSObj->GetName() );
SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();
myDlg->myBriefInfo->show();
myDlg->myFullInfo->hide();
myDlg->myErrorGroup->show();
-
+
+ bool hasShape = aMesh->HasShapeToMesh();
+ if ( !hasShape )
+ {
+ myDlg->myPublishBtn->hide();
+ myDlg->myShowBtn->hide();
+ }
+ else
+ {
+ myDlg->myPublishBtn->show();
+ myDlg->myShowBtn->show();
+ }
// fill table of errors
tbl->setNumRows( anErrors->length() );
- bool hasShape = aMesh->HasShapeToMesh();
if ( !hasShape ) tbl->hideColumn( COL_SHAPE );
else tbl->showColumn( COL_SHAPE );
tbl->setColumnWidth( COL_ERROR, 200 );
const QStringList& theNeededHypos,
const QStringList& theOptionalHypos,
const QStringList& theInputTypes,
- const QStringList& theOutputTypes)
+ const QStringList& theOutputTypes,
+ const bool theIsNeedGeometry = true)
: TypeName( theTypeName ),
PluginName( thePluginName ),
ServerLibName( theServerLibName ),
Dim( theDim ),
IsAux( theIsAux ),
NeededHypos( theNeededHypos ), OptionalHypos( theOptionalHypos ),
- InputTypes( theInputTypes ), OutputTypes( theOutputTypes )
+ InputTypes( theInputTypes ), OutputTypes( theOutputTypes ),
+ IsNeedGeometry( theIsNeedGeometry )
{};
QString TypeName; //!< hypothesis type name
QString IconId; //!< icon identifier
QValueList<int> Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration)
bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise
+ bool IsNeedGeometry; //!< TRUE if for given hypothesis need shape, FALSE otherwise
// for algorithm only: dependencies algo <-> algo and algo -> hypos
QStringList NeededHypos; //!< list of obligatory hypotheses
QStringList GetAvailableHypotheses( const bool isAlgo,
const int theDim,
- const bool isAux )
+ const bool isAux,
+ const bool isNeedGeometry)
{
QStringList aHypList;
// Init list of available hypotheses, if needed
InitAvailableHypotheses();
-
+ bool checkGeometry = !isNeedGeometry;
// fill list of hypotheses/algorithms
THypothesisDataMap* pMap = isAlgo ? &myAlgorithmsMap : &myHypothesesMap;
THypothesisDataMap::iterator anIter;
for ( anIter = pMap->begin(); anIter != pMap->end(); anIter++ )
{
HypothesisData* aData = (*anIter).second;
- if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux )
- aHypList.append(((*anIter).first).c_str());
+ if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux)
+ if (checkGeometry){
+ if (aData->IsNeedGeometry == isNeedGeometry)
+ aHypList.append(((*anIter).first).c_str());
+ }
+ else
+ aHypList.append(((*anIter).first).c_str());
}
return aHypList;
}
if (MorSM) {
try {
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
- if (!aShapeObject->_is_nil()) {
- SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
-
- if (!aSubMesh->_is_nil())
- aMesh = aSubMesh->GetFather();
-
- if (!aMesh->_is_nil()) {
- res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
- if (res < SMESH::HYP_UNKNOWN_FATAL) {
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
+
+ if (!aSubMesh->_is_nil())
+ aMesh = aSubMesh->GetFather();
+
+ if (!aMesh->_is_nil()) {
+ if (aMesh->HasShapeToMesh() && !aShapeObject->_is_nil()) {
+ res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
+ if (res < SMESH::HYP_UNKNOWN_FATAL) {
_PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
if (meshSO)
SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
}
- if (res > SMESH::HYP_OK) {
- wc.suspend();
- processHypothesisStatus(res, anHyp, false);
- wc.resume();
- }
- }
- }
+
+ }
+ else if(!aMesh->HasShapeToMesh()){
+ res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
+ if (res < SMESH::HYP_UNKNOWN_FATAL) {
+ _PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
+ if (meshSO)
+ SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
+ }
+ }
+ if (res > SMESH::HYP_OK) {
+ wc.suspend();
+ processHypothesisStatus(res, anHyp, false);
+ wc.resume();
+ }
+ }
} catch(const SALOME::SALOME_Exception& S_ex) {
wc.suspend();
SalomeApp_Tools::QtCatchCorbaException(S_ex);
SMESHGUI_EXPORT
QStringList GetAvailableHypotheses( const bool isAlgo,
const int theDim = -1,
- const bool isAux = false);
+ const bool isAux = false,
+ const bool isNeedGeometry = true);
SMESHGUI_EXPORT
QStringList GetHypothesesSets();
}
}
+
+//================================================================================
+/*!
+ * \brief Disable tab
+ * \param int - tab ID
+ */
+//================================================================================
+void SMESHGUI_MeshDlg::disableTab(const int theTabId) {
+ myTabWg->setTabEnabled( myTabs[ theTabId ], false );
+}
+
+//================================================================================
+/*!
+ * \brief Enable tabs
+ * \param int - tab ID
+ */
+//================================================================================
+void SMESHGUI_MeshDlg::enableTab(const int theTabId) {
+ myTabWg->setTabEnabled( myTabs[ theTabId ], true );
+}
+
void SMESHGUI_MeshDlg::onGeomSelectionButton(bool isBtnOn)
{
if ( myGeomPopup && isBtnOn )
void setMaxHypoDim( const int );
void setHypoSets( const QStringList& );
void setGeomPopupEnabled( const bool );
+ void disableTab(const int);
+ void enableTab(const int);
+
signals:
{
if ( GeometryGUI::GetGeomGen()->_is_nil() )// check that GEOM_Gen exists
GeometryGUI::InitGeomGen();
+ myIsOnGeometry = true;
}
//================================================================================
{
if ( !dlg()->isShown() || !myDlg->isEnabled() )
return;
-
+
SMESHGUI_SelectionOp::selectionDone();
-
+
try
{
- // Enable tabs according to shape dimension
-
- int shapeDim = 3;
-
- QStringList aGEOMs;
- myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- if (aGEOMs.count() > 0) {
- // one or more GEOM shape selected
- aSeq->length(aGEOMs.count());
- QStringList::const_iterator aSubShapesIter = aGEOMs.begin();
- int iSubSh = 0;
- for (; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) {
- QString aSubGeomEntry = (*aSubShapesIter);
- _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.latin1());
- GEOM::GEOM_Object_var aSubGeomVar =
- GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
- aSeq[iSubSh] = aSubGeomVar;
- }
- } else {
- // get geometry by selected sub-mesh
- QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
- _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() );
- GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
- if (!aGeomVar->_is_nil()) {
- aSeq->length(1);
- aSeq[0] = aGeomVar;
- }
+ //Check geometry for mesh
+ QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
+ _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() );
+ if ( !pObj )
+ return;
+
+ SMESH::SMESH_subMesh_var aSubMeshVar =
+ SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
+ if ( !aSubMeshVar->_is_nil() )
+ myIsOnGeometry = true;
+ else {
+ SMESH::SMESH_Mesh_var aMeshVar =
+ SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pObj )->GetObject() );
+ if ( !myToCreate && !aMeshVar->HasShapeToMesh() )
+ myIsOnGeometry = false;
+ else
+ myIsOnGeometry = true;
}
+
+ if ( myIsOnGeometry ) {
+ // Enable tabs according to shape dimension
+
+ int shapeDim = 3;
+ QStringList aGEOMs;
+ myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ if (aGEOMs.count() > 0) {
+ // one or more GEOM shape selected
+ aSeq->length(aGEOMs.count());
+ QStringList::const_iterator aSubShapesIter = aGEOMs.begin();
+ int iSubSh = 0;
+ for (; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) {
+ QString aSubGeomEntry = (*aSubShapesIter);
+ _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.latin1());
+ GEOM::GEOM_Object_var aSubGeomVar =
+ GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
+ aSeq[iSubSh] = aSubGeomVar;
+ }
+ } else {
+ // get geometry by selected sub-mesh
+ QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
+ _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() );
+ GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
+ if (!aGeomVar->_is_nil()) {
+ aSeq->length(1);
+ aSeq[0] = aGeomVar;
+ }
+ }
- if (aSeq->length() > 0) {
- shapeDim = 0;
- for (int iss = 0; iss < aSeq->length() && shapeDim < 3; iss++) {
- GEOM::GEOM_Object_var aGeomVar = aSeq[iss];
- switch ( aGeomVar->GetShapeType() ) {
- case GEOM::SOLID:
- case GEOM::SHELL: shapeDim = 3; break;
- case GEOM::FACE: shapeDim = (shapeDim < 2) ? 2 : shapeDim; break;
- case GEOM::WIRE:
- case GEOM::EDGE: shapeDim = (shapeDim < 1) ? 1 : shapeDim; break;
- case GEOM::VERTEX: break;
- default:
- TopoDS_Shape aShape;
- if ( GEOMBase::GetShape(aGeomVar, aShape)) {
- TopExp_Explorer exp( aShape, TopAbs_SHELL );
- if ( exp.More() )
- shapeDim = 3;
- else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() )
- shapeDim = (shapeDim < 2) ? 2 : shapeDim;
- else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() )
- shapeDim = (shapeDim < 1) ? 1 : shapeDim;
- else
- ;//shapeDim = 0;
+ if (aSeq->length() > 0) {
+ shapeDim = 0;
+ for (int iss = 0; iss < aSeq->length() && shapeDim < 3; iss++) {
+ GEOM::GEOM_Object_var aGeomVar = aSeq[iss];
+ switch ( aGeomVar->GetShapeType() ) {
+ case GEOM::SOLID:
+ case GEOM::SHELL: shapeDim = 3; break;
+ case GEOM::FACE: shapeDim = (shapeDim < 2) ? 2 : shapeDim; break;
+ case GEOM::WIRE:
+ case GEOM::EDGE: shapeDim = (shapeDim < 1) ? 1 : shapeDim; break;
+ case GEOM::VERTEX: break;
+ default:
+ TopoDS_Shape aShape;
+ if ( GEOMBase::GetShape(aGeomVar, aShape)) {
+ TopExp_Explorer exp( aShape, TopAbs_SHELL );
+ if ( exp.More() )
+ shapeDim = 3;
+ else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() )
+ shapeDim = (shapeDim < 2) ? 2 : shapeDim;
+ else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() )
+ shapeDim = (shapeDim < 1) ? 1 : shapeDim;
+ else
+ ;//shapeDim = 0;
+ }
}
}
}
- }
- myDlg->setMaxHypoDim( shapeDim );
+ myDlg->setMaxHypoDim( shapeDim );
-
- if ( !myToCreate ) // edition: read hypotheses
- {
- QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
- _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() );
- if ( pObj != 0 )
+
+ if ( !myToCreate ) // edition: read hypotheses
{
- SMESH::SMESH_subMesh_var aVar =
- SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
- myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !aVar->_is_nil() );
- myDlg->objectWg( SMESHGUI_MeshDlg::Mesh, SMESHGUI_MeshDlg::Btn )->hide();
- myDlg->updateGeometry();
- myDlg->adjustSize();
- readMesh();
- }
- else
- myDlg->reset();
-
- }
- else if ( !myIsMesh ) // submesh creation
- {
- // if a submesh on the selected shape already exist, pass to submesh edition mode
- if ( _PTR(SObject) pSubmesh = getSubmeshByGeom() ) {
- SMESH::SMESH_subMesh_var sm =
- SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( pSubmesh );
- bool editSubmesh = ( !sm->_is_nil() &&
- SUIT_MessageBox::question2( myDlg, tr( "SMESH_WARNING" ),
- tr( "EDIT_SUBMESH_QUESTION"),
- tr( "SMESH_BUT_YES" ),
- tr( "SMESH_BUT_NO" ), 1, 0, 0 ));
- if ( editSubmesh )
+ QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
+ _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() );
+ if ( pObj != 0 )
{
- selectionMgr()->clearFilters();
- selectObject( pSubmesh );
- SMESHGUI::GetSMESHGUI()->switchToOperation(704);
- return;
+
+ SMESH::SMESH_subMesh_var aVar =
+ SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
+ myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !aVar->_is_nil() );
+ myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, true );
+ myDlg->objectWg( SMESHGUI_MeshDlg::Mesh, SMESHGUI_MeshDlg::Btn )->hide();
+ myDlg->objectWg( SMESHGUI_MeshDlg::Geom, SMESHGUI_MeshDlg::Btn )->hide();
+ myDlg->updateGeometry();
+ myDlg->adjustSize();
+ readMesh();
}
else
- {
- myDlg->selectObject( "", SMESHGUI_MeshDlg::Geom, "" );
- selectObject( _PTR(SObject)() );
- selectionDone();
+ myDlg->reset();
+
+ }
+ else if ( !myIsMesh ) // submesh creation
+ {
+ // if a submesh on the selected shape already exist, pass to submesh edition mode
+ if ( _PTR(SObject) pSubmesh = getSubmeshByGeom() ) {
+ SMESH::SMESH_subMesh_var sm =
+ SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( pSubmesh );
+ bool editSubmesh = ( !sm->_is_nil() &&
+ SUIT_MessageBox::question2( myDlg, tr( "SMESH_WARNING" ),
+ tr( "EDIT_SUBMESH_QUESTION"),
+ tr( "SMESH_BUT_YES" ),
+ tr( "SMESH_BUT_NO" ), 1, 0, 0 ));
+ if ( editSubmesh )
+ {
+ selectionMgr()->clearFilters();
+ selectObject( pSubmesh );
+ SMESHGUI::GetSMESHGUI()->switchToOperation(704);
+ return;
+ }
+ else
+ {
+ myDlg->selectObject( "", SMESHGUI_MeshDlg::Geom, "" );
+ selectObject( _PTR(SObject)() );
+ selectionDone();
+ }
+ }
+
+ // enable/disable popup for choice of geom selection way
+ bool enable = false;
+ QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
+ if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.latin1() )) {
+ SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pMesh );
+ if ( !mesh->_is_nil() )
+ enable = ( shapeDim > 1 ) && ( mesh->NbEdges() > 0 );
}
+ myDlg->setGeomPopupEnabled( enable );
}
-
- // enable/disable popup for choice of geom selection way
- bool enable = false;
- QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
- if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.latin1() )) {
- SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pMesh );
- if ( !mesh->_is_nil() )
- enable = ( shapeDim > 1 ) && ( mesh->NbEdges() > 0 );
+ }
+ else {
+ myDlg->enableTab( SMESH::DIM_3D );
+ QStringList hypList;
+ availableHyps( SMESH::DIM_3D, Algo, hypList,
+ myAvailableHypData[SMESH::DIM_3D][Algo]);
+
+ SMESHGUI_MeshTab* aTab = myDlg->tab( SMESH::DIM_3D );
+ aTab->setAvailableHyps( Algo, hypList );
+ for( int i = SMESH::DIM_0D;i < SMESH::DIM_3D; ++i ) {
+ myDlg->disableTab(i);
}
- myDlg->setGeomPopupEnabled( enable );
+ //Hide labels and fields (Mesh ang Geometry)
+ myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, false );
+ myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, false );
+ myDlg->adjustSize();
+ readMesh();
}
}
catch ( const SALOME::SALOME_Exception& S_ex )
return false;
}
- // Imported mesh, if create sub-mesh or edit mesh
+/* // Imported mesh, if create sub-mesh or edit mesh
if ( !myToCreate || ( myToCreate && !myIsMesh ))
{
QString aMeshEntry = myDlg->selectedObject
return false;
}
}
- }
+ }*/
// Geom
if ( myToCreate )
theHyps.clear();
bool isAlgo = ( theHypType == Algo );
bool isAux = ( theHypType == AddHyp );
- QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, theDim, isAux );
+ QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, theDim, isAux, myIsOnGeometry );
QStringList::const_iterator anIter;
for ( anIter = aHypTypeNameList.begin(); anIter != aHypTypeNameList.end(); ++anIter )
}
else {
bool mainHyp = true;
+ QStringList anAvailable;
+ availableHyps( aDim, MainHyp, anAvailable, myAvailableHypData[aDim][MainHyp] );
+ myDlg->tab( aDim )->setAvailableHyps( MainHyp, anAvailable );
int index = myAvailableHypData[aDim][MainHyp].findIndex( aHypData );
if ( index < 0 ) {
mainHyp = false;
if ( !pObj )
return;
- // Get name of mesh if current object is sub-mesh
- SMESH::SMESH_subMesh_var aSubMeshVar =
+ if( myIsOnGeometry ) {
+ // Get name of mesh if current object is sub-mesh
+ SMESH::SMESH_subMesh_var aSubMeshVar =
SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
- if ( !aSubMeshVar->_is_nil() )
- {
- SMESH::SMESH_Mesh_var aMeshVar = aSubMeshVar->GetFather();
- if ( !aMeshVar->_is_nil() )
+ if ( !aSubMeshVar->_is_nil() )
{
- _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar );
- QString aMeshName = name( aMeshSO );
- myDlg->setObjectText( SMESHGUI_MeshDlg::Mesh, aMeshName );
+ SMESH::SMESH_Mesh_var aMeshVar = aSubMeshVar->GetFather();
+ if ( !aMeshVar->_is_nil() )
+ {
+ _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar );
+ QString aMeshName = name( aMeshSO );
+ myDlg->setObjectText( SMESHGUI_MeshDlg::Mesh, aMeshName );
+ }
+ }
+
+ // Get name of geometry object
+ GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
+ if ( !aGeomVar->_is_nil() )
+ {
+ _PTR(SObject) aGeomSO = studyDS()->FindObjectID( aGeomVar->GetStudyEntry() );
+ QString aShapeName = name( aGeomSO );
+ myDlg->setObjectText( SMESHGUI_MeshDlg::Geom, aShapeName );
}
- }
-
- // Get name of geometry object
- GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
- if ( !aGeomVar->_is_nil() )
- {
- _PTR(SObject) aGeomSO = studyDS()->FindObjectID( aGeomVar->GetStudyEntry() );
- QString aShapeName = name( aGeomSO );
- myDlg->setObjectText( SMESHGUI_MeshDlg::Geom, aShapeName );
}
// Get hypotheses and algorithms assigned to the mesh/sub-mesh
QStringList anExisting;
- for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
+ const int aDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D;
+ for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
{
// get algorithm
existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] );
// get hypotheses
bool hypWithoutAlgo = false;
- for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
+ for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
{
for ( int hypType = MainHyp; hypType <= AddHyp; hypType++ )
{
// Set new name
QString aName = myDlg->objectText( SMESHGUI_MeshDlg::Obj );
SMESH::SetName( pObj, aName.latin1() );
+ int aDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D;
// First, remove old algos in order to avoid messages on algorithm hiding
- for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
+ for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
{
if ( isAccessibleDim( dim ) && myObjHyps[ dim ][ Algo ].count() > 0 )
{
SMESH::SMESH_Hypothesis_var anOldAlgo = myObjHyps[ dim ][ Algo ].first().first;
CORBA::String_var anOldName = anOldAlgo->GetName();
SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( dim );
- CORBA::String_var anAlgoName = anAlgoVar->GetName();
+ // CORBA::String_var anAlgoName = anAlgoVar->GetName();
if ( anAlgoVar->_is_nil() || // no new algo selected or
- strcmp(anOldName.in(), anAlgoName.in()) ) // algo change
+ strcmp(anOldName.in(), anAlgoVar->GetName()) ) // algo change
{
// remove old algorithm
SMESH::RemoveHypothesisOrAlgorithmOnMesh ( pObj, myObjHyps[ dim ][ Algo ].first().first );
}
// Assign new algorithms and hypotheses
- for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
+ for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
{
if ( !isAccessibleDim( dim )) continue;
SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
bool myToCreate;
bool myIsMesh;
+ bool myIsOnGeometry; //!< TRUE if edited mesh accotiated with geometrical object
TDim2Type2HypList myExistingHyps; //!< all hypothesis of SMESH module
TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current
_PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).latin1() );
//FindSObject( mesh );
if ( so ) {
- GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
- return QVariant( !shape->_is_nil(), 0 );
+ CORBA::Object_var obj = SMESH::SObjectToObject(so, SMESH::GetActiveStudyDocument());
+ if(!CORBA::is_nil(obj)){
+ SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
+ if (!mesh->_is_nil()){
+ if(mesh->HasShapeToMesh()) {
+ GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
+ return QVariant( !shape->_is_nil(), 0 );
+ }
+ else
+ {
+ return QVariant(!mesh->NbFaces()==0, 0);
+ }
+ }
+ else
+ {
+ GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
+ return QVariant( !shape->_is_nil(), 0 );
+ }
+ }
}
// }
// }
QString aLabel = atts.value("label-id");
QString anIcon = atts.value("icon-id");
bool isAux = atts.value("auxiliary") == "true";
+ bool isNeedGeom = true;
+ QString aNeedGeom = atts.value("need-geom");
+ if ( !aNeedGeom.isEmpty() )
+ isNeedGeom = (aNeedGeom == "true");
QString aDimStr = atts.value("dim");
aDimStr = aDimStr.remove( ' ' );
HypothesisData* aHypData =
new HypothesisData (aHypAlType, myPluginName, myServerLib, myClientLib,
aLabel, anIcon, aDim, isAux,
- attr[ HYPOS ], attr[ OPT_HYPOS ], attr[ INPUT ], attr[ OUTPUT ]);
+ attr[ HYPOS ], attr[ OPT_HYPOS ], attr[ INPUT ], attr[ OUTPUT ], isNeedGeom );
if (qName == "algorithm")
{
#undef DUMP_CONVERSION
#endif
+
namespace {
//================================================================================
AddMeshAccessorMethod( aCommand );
// Add access to a wrapped algorithm
- AddAlgoAccessorMethod( aCommand ); // ??? what if algo won't be wrapped at all ???
+ // AddAlgoAccessorMethod( aCommand ); // ??? what if algo won't be wrapped at all ???
// PAL12227. PythonDump was not updated at proper time; result is
// aCriteria.append(SMESH.Filter.Criterion(17,26,0,'L1',26,25,1e-07,SMESH.EDGE,-1))
// Concatenate( [mesh1, ...], ... )
// CreateHypothesis( theHypType, theLibName )
// Compute( mesh, geom )
-
// mesh creation
if ( theCommand->GetMethod() == "CreateMesh" ||
- theCommand->GetMethod() == "CreateEmptyMesh" )
+ theCommand->GetMethod() == "CreateEmptyMesh" ||
+ theCommand->GetMethod() == "CreateMeshesFromUNV" ||
+ theCommand->GetMethod() == "CreateMeshesFromSTL")
{
Handle(_pyMesh) mesh = new _pyMesh( theCommand );
myMeshes.insert( make_pair( mesh->GetID(), mesh ));
return;
}
+ if(theCommand->GetMethod() == "CreateMeshesFromMED")
+ {
+ for(int ind = 0;ind<theCommand->GetNbResultValues();ind++)
+ {
+ Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue(ind));
+ myMeshes.insert( make_pair( theCommand->GetResultValue(ind), mesh ));
+ }
+ }
+
// CreateHypothesis()
if ( theCommand->GetMethod() == "CreateHypothesis" )
{
{
// convert my creation command
Handle(_pyCommand) creationCmd = GetCreationCmd();
- creationCmd->SetObject( SMESH_2smeshpy::SmeshpyName() );
- creationCmd->SetMethod( "Mesh" );
+ TCollection_AsciiString str = creationCmd->GetMethod();
+
+ creationCmd->SetObject( SMESH_2smeshpy::SmeshpyName() );
+ if(str != "CreateMeshesFromUNV" &&
+ str != "CreateMeshesFromMED" &&
+ str != "CreateMeshesFromSTL")
+ creationCmd->SetMethod( "Mesh" );
theGen->SetAccessorMethod( GetID(), "GetMesh()" );
}
+//================================================================================
+/*!
+ * \brief
+ * \param theCreationCmd -
+ */
+//================================================================================
+_pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd, const TCollection_AsciiString& id):
+ _pyObject(theCreationCmd), myHasEditor(false)
+{
+ // convert my creation command
+ Handle(_pyCommand) creationCmd = GetCreationCmd();
+ creationCmd->SetObject( SMESH_2smeshpy::SmeshpyName() );
+ theGen->SetAccessorMethod( id, "GetMesh()" );
+}
+
//================================================================================
/*!
* \brief Convert a IDL API command of SMESH::Mesh to a method call of python Mesh
}
}
Handle(_pyHypothesis) hyp = theGen->FindHyp( hypID );
- if ( ! hasAddCmd ) { // hypo addition already wrapped
+ if ( ! hasAddCmd && hypID.Length() != 0 ) { // hypo addition already wrapped
// RemoveHypothesis(geom, hyp) --> RemoveHypothesis( hyp, geom=0 )
_pyID geom = theCommand->GetArg( 1 );
theCommand->RemoveArgs();
return myRes;
}
+//================================================================================
+/*!
+ * \brief Return number of python command result value ResultValue = Obj.Meth()
+ * \retval const int
+ */
+//================================================================================
+
+const int _pyCommand::GetNbResultValues()
+{
+ int begPos = 1;
+ int Nb=0;
+ int endPos = myString.Location( "=", 1, Length() );
+ TCollection_AsciiString str = "";
+ while ( begPos < endPos) {
+ str = GetWord( myString, begPos, true );
+ begPos = begPos+ str.Length();
+ Nb++;
+ }
+ return (Nb-1);
+}
+
+
+//================================================================================
+/*!
+ * \brief Return substring of python command looking like
+ * ResultValue1 , ResultValue1,... = Obj.Meth() with res index
+ * \retval const TCollection_AsciiString & - ResultValue with res index substring
+ */
+//================================================================================
+const TCollection_AsciiString & _pyCommand::GetResultValue(int res)
+{
+ int begPos = 1;
+ int Nb=0;
+ int endPos = myString.Location( "=", 1, Length() );
+ while ( begPos < endPos) {
+ myRes = GetWord( myString, begPos, true );
+ begPos = begPos + myRes.Length();
+ Nb++;
+ if(res == Nb){
+ myRes.RemoveAll('[');myRes.RemoveAll(']');
+ return myRes;
+ }
+ if(Nb>res)
+ break;
+ }
+ return theEmptyString;
+}
+
//================================================================================
/*!
* \brief Return substring of python command looking like ResVal = Object.Meth()
bool IsEmpty() const { return myString.IsEmpty(); }
TCollection_AsciiString GetIndentation();
const TCollection_AsciiString & GetResultValue();
+ const int GetNbResultValues();
+ const TCollection_AsciiString & GetResultValue(int res);
const TCollection_AsciiString & GetObject();
const TCollection_AsciiString & GetMethod();
const TCollection_AsciiString & GetArg( int index );
bool myHasEditor;
public:
_pyMesh(const Handle(_pyCommand) theCreationCmd);
+ _pyMesh(const Handle(_pyCommand) theCreationCmd, const TCollection_AsciiString &);
const _pyID& GetGeom() { return GetCreationCmd()->GetArg(1); }
void Process( const Handle(_pyCommand)& theCommand);
void Flush();
Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetComputeErrors()" );
- if ( CORBA::is_nil( theSubObject ) )
+ if ( CORBA::is_nil( theSubObject ) && theMesh->HasShapeToMesh())
THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference", SALOME::BAD_PARAM );
if ( CORBA::is_nil( theMesh ) )
try {
if ( SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh ))
{
- TopoDS_Shape shape = GeomObjectToShape( theSubObject );
+ TopoDS_Shape shape;
+ if(theMesh->HasShapeToMesh())
+ shape = GeomObjectToShape( theSubObject );
+ else
+ shape = SMESH_Mesh::PseudoShape();
+
::SMESH_Mesh& mesh = meshServant->GetImpl();
error_array->length( mesh.GetMeshDS()->MaxShapeIndex() );
Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetAlgoState()" );
- if ( CORBA::is_nil( theSubObject ) )
+ if ( CORBA::is_nil( theSubObject ) && theMesh->HasShapeToMesh())
THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference", SALOME::BAD_PARAM );
if ( CORBA::is_nil( theMesh ) )
SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh );
ASSERT( meshServant );
if ( meshServant ) {
- TopoDS_Shape myLocShape = GeomObjectToShape( theSubObject );
+ TopoDS_Shape myLocShape;
+ if(theMesh->HasShapeToMesh())
+ myLocShape = GeomObjectToShape( theSubObject );
+ else
+ myLocShape = SMESH_Mesh::PseudoShape();
+
::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
list< ::SMESH_Gen::TAlgoStateError > error_list;
list< ::SMESH_Gen::TAlgoStateError >::iterator error;
Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Compute" );
- if ( CORBA::is_nil( theShapeObject ) )
+ if ( CORBA::is_nil( theShapeObject ) && theMesh->HasShapeToMesh())
THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
SALOME::BAD_PARAM );
// NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation"
meshServant->CheckGeomGroupModif();
// get local TopoDS_Shape
- TopoDS_Shape myLocShape = GeomObjectToShape( theShapeObject );
+ TopoDS_Shape myLocShape;
+ if(theMesh->HasShapeToMesh())
+ myLocShape = GeomObjectToShape( theShapeObject );
+ else
+ myLocShape = SMESH_Mesh::PseudoShape();
// call implementation compute
::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
return myGen.Compute( myLocMesh, myLocShape);
int id = myStudyContext->findId( string( objStr.in() ) );
::SMESH_Mesh& myLocMesh = myImpl->GetImpl();
SMESHDS_Mesh* mySMESHDSMesh = myLocMesh.GetMeshDS();
+ bool hasShape = myLocMesh.HasShapeToMesh();
// for each mesh open the HDF group basing on its id
char meshGrpName[ 30 ];
// write applied hypotheses if exist
SALOMEDS::SObject_var myHypBranch;
found = gotBranch->FindSubObject( GetRefOnAppliedHypothesisTag(), myHypBranch );
- if ( found && !shapeRefFound ) { // remove applied hyps
+ if ( found && !shapeRefFound && hasShape) { // remove applied hyps
myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( myHypBranch );
}
- if ( found && shapeRefFound ) {
+ if ( found && (shapeRefFound || !hasShape) ) {
aGroup = new HDFgroup( "Applied Hypotheses", aTopGroup );
aGroup->CreateOnDisk();
// write applied algorithms if exist
SALOMEDS::SObject_var myAlgoBranch;
found = gotBranch->FindSubObject( GetRefOnAppliedAlgorithmsTag(), myAlgoBranch );
- if ( found && !shapeRefFound ) { // remove applied algos
+ if ( found && !shapeRefFound && hasShape) { // remove applied algos
myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( myAlgoBranch );
}
- if ( found && shapeRefFound ) {
+ if ( found && (shapeRefFound || !hasShape)) {
aGroup = new HDFgroup( "Applied Algorithms", aTopGroup );
aGroup->CreateOnDisk();
myWriter.Perform();
// maybe a shape was deleted in the study
- if ( !shapeRefFound && !mySMESHDSMesh->ShapeToMesh().IsNull() ) {
+ if ( !shapeRefFound && !mySMESHDSMesh->ShapeToMesh().IsNull() && hasShape) {
TopoDS_Shape nullShape;
myLocMesh.ShapeToMesh( nullShape ); // remove shape referring data
}
CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
if ( !CORBA::is_nil( hypObject ) ) {
SMESH::SMESH_Hypothesis_var anHyp = SMESH::SMESH_Hypothesis::_narrow( hypObject );
- if ( !anHyp->_is_nil() && !aShapeObject->_is_nil() )
+ if ( !anHyp->_is_nil() && (!aShapeObject->_is_nil()
+ || !myNewMeshImpl->HasShapeToMesh()) )
myNewMeshImpl->addHypothesis( aShapeObject, anHyp );
}
}
CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
if ( !CORBA::is_nil( hypObject ) ) {
SMESH::SMESH_Hypothesis_var anHyp = SMESH::SMESH_Hypothesis::_narrow( hypObject );
- if ( !anHyp->_is_nil() && !aShapeObject->_is_nil() )
+ if ( !anHyp->_is_nil() && (!aShapeObject->_is_nil()
+ || !myNewMeshImpl->HasShapeToMesh()) )
myNewMeshImpl->addHypothesis( aShapeObject, anHyp );
}
}
} // if ( hasData )
// Recompute State (as computed sub-meshes are restored from MED)
- if ( !aShapeObject->_is_nil() ) {
+ if ( !aShapeObject->_is_nil() || !myNewMeshImpl->HasShapeToMesh()) {
MESSAGE("Compute State Engine ...");
- TopoDS_Shape myLocShape = GeomObjectToShape( aShapeObject );
+ TopoDS_Shape myLocShape;
+ if(myNewMeshImpl->HasShapeToMesh())
+ myLocShape = GeomObjectToShape( aShapeObject );
+ else
+ myLocShape = SMESH_Mesh::PseudoShape();
+
myNewMeshImpl->GetImpl().GetSubMesh(myLocShape)->ComputeStateEngine
(SMESH_subMesh::SUBMESH_RESTORED);
MESSAGE("Compute State Engine finished");
{
if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape")
SALOMEDS::SObject_var aMeshOrSubMesh;
- if ( theShape->_is_nil() || theMesh->_is_nil() )
+ if (theMesh->_is_nil() || ( theShape->_is_nil() && theMesh->HasShapeToMesh()))
return aMeshOrSubMesh._retn();
+
+ TopoDS_Shape aShape;
+ if(theMesh->HasShapeToMesh())
+ aShape = GeomObjectToShape( theShape );
+ else
+ aShape = SMESH_Mesh::PseudoShape();
- TopoDS_Shape aShape = GeomObjectToShape( theShape );
SMESH_Mesh_i* mesh_i = objectToServant<SMESH_Mesh_i>( theMesh );
if ( !aShape.IsNull() && mesh_i && mesh_i->GetImpl().GetMeshDS() ) {
{
if(MYDEBUG) MESSAGE("AddHypothesisToShape")
if (theStudy->_is_nil() || theMesh->_is_nil() ||
- theHyp->_is_nil() || theShape->_is_nil() )
+ theHyp->_is_nil() || (theShape->_is_nil()
+ && theMesh->HasShapeToMesh()) )
return false;
SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh );
SMESH::SMESH_Hypothesis_ptr theHyp)
{
if (theStudy->_is_nil() || theMesh->_is_nil() ||
- theHyp->_is_nil() || theShape->_is_nil() )
+ theHyp->_is_nil() || (theShape->_is_nil()
+ && theMesh->HasShapeToMesh()))
return false;
SALOMEDS::SObject_var aHypSO = ObjectToSObject( theStudy, theHyp );
if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status );
// Update Python script
- TPythonDump() << "status = " << _this() << ".AddHypothesis( "
- << aSubShapeObject << ", " << anHyp << " )";
-
+ if(_impl->HasShapeToMesh()) {
+ TPythonDump() << "status = " << _this() << ".AddHypothesis( "
+ << aSubShapeObject << ", " << anHyp << " )";
+ }
+ else {
+ TPythonDump() << "status = " << _this() << ".AddHypothesis( "<< anHyp << " )";
+ }
+
return ConvertHypothesisStatus(status);
}
{
if(MYDEBUG) MESSAGE("addHypothesis");
- if (CORBA::is_nil(aSubShapeObject))
+ if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh())
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
SALOME::BAD_PARAM);
SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK;
try
{
- TopoDS_Shape myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject);
+ TopoDS_Shape myLocSubShape;
+ //use PseudoShape in case if mesh has no shape
+ if(HasShapeToMesh())
+ myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject);
+ else
+ myLocSubShape = _impl->GetShapeToMesh();
+
int hypId = myHyp->GetId();
status = _impl->AddHypothesis(myLocSubShape, hypId);
if ( !SMESH_Hypothesis::IsStatusFatal(status) ) {
aSubShapeObject, anHyp );
// Update Python script
+ // Update Python script
+ if(_impl->HasShapeToMesh()) {
TPythonDump() << "status = " << _this() << ".RemoveHypothesis( "
<< aSubShapeObject << ", " << anHyp << " )";
+ }
+ else {
+ TPythonDump() << "status = " << _this() << ".RemoveHypothesis( "
+ << anHyp << " )";
+ }
return ConvertHypothesisStatus(status);
}
if(MYDEBUG) MESSAGE("removeHypothesis()");
// **** proposer liste de subShape (selection multiple)
- if (CORBA::is_nil(aSubShapeObject))
+ if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh())
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
SALOME::BAD_PARAM);
SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK;
try
{
- TopoDS_Shape myLocSubShape = _gen_i->GeomObjectToShape(aSubShapeObject);
- int hypId = myHyp->GetId();
+ TopoDS_Shape myLocSubShape;
+ //use PseudoShape in case if mesh has no shape
+ if(HasShapeToMesh())
+ myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject);
+ else
+ myLocSubShape = _impl->GetShapeToMesh();
+
+ int hypId = myHyp->GetId();
status = _impl->RemoveHypothesis(myLocSubShape, hypId);
if ( !SMESH_Hypothesis::IsStatusFatal(status) )
_mapHypo.erase( hypId );