+ raise error message when trying to mesh without netgen support

This commit is contained in:
wmayer 2015-05-22 16:15:18 +02:00
parent a4441f2a41
commit 1099b23587
3 changed files with 26 additions and 7 deletions

View File

@ -118,8 +118,8 @@ App::DocumentObjectExecReturn *FemMeshShapeNetgenObject::execute(void)
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(newMesh.getSMesh())->GetMeshDS();
const SMDS_MeshInfo& info = data->GetMeshInfo();
int numFaces = data->NbFaces();
const SMDS_MeshInfo& info = data->GetMeshInfo();
int numFaces = data->NbFaces();
int numNode = info.NbNodes();
int numTria = info.NbTriangles();
int numQuad = info.NbQuadrangles();
@ -135,9 +135,11 @@ App::DocumentObjectExecReturn *FemMeshShapeNetgenObject::execute(void)
// set the value to the object
FemMesh.setValue(newMesh);
#endif
return App::DocumentObject::StdReturn;
#else
return new App::DocumentObjectExecReturn("The FEM module is built without NETGEN support. Meshing will not work!!!", this);
#endif
}
//short FemMeshShapeNetgenObject::mustExecute(void) const

View File

@ -34,6 +34,7 @@
#include <Gui/Application.h>
#include <Gui/Document.h>
#include <Gui/Command.h>
#include <Gui/MainWindow.h>
#include <Gui/WaitCursor.h>
#include "ViewProviderFemMeshShapeNetgen.h"
@ -98,7 +99,13 @@ bool TaskDlgMeshShapeNetgen::accept()
if(param->touched)
{
Gui::WaitCursor wc;
FemMeshShapeNetgenObject->recompute();
App::DocumentObjectExecReturn* ret = FemMeshShapeNetgenObject->recompute();
if (ret) {
wc.restoreCursor();
QMessageBox::critical(Gui::getMainWindow(), tr("Meshing failure"), QString::fromStdString(ret->Why));
delete ret;
return true;
}
}
// hide the input object

View File

@ -25,12 +25,14 @@
#ifndef _PreComp_
# include <Standard_math.hxx>
# include <QCoreApplication>
#endif
#include "ViewProviderFemMeshShapeNetgen.h"
#include "TaskDlgMeshShapeNetgen.h"
#include "Gui/Control.h"
#include <Gui/Control.h>
#include <Gui/MainWindow.h>
using namespace FemGui;
@ -38,6 +40,8 @@ using namespace FemGui;
/* TRANSLATOR FemGui::ViewProviderFemMeshShapeNetgen */
PROPERTY_SOURCE(FemGui::ViewProviderFemMeshShapeNetgen, FemGui::ViewProviderFemMeshShape)
@ -63,10 +67,16 @@ bool ViewProviderFemMeshShapeNetgen::setEdit(int ModNum)
if (ModNum == ViewProvider::Default) {
// clear the selection (convenience)
Gui::Selection().clearSelection();
#ifdef FCWithNetgen
Gui::Control().showDialog(new TaskDlgMeshShapeNetgen(this));
return true;
#else
QMessageBox::critical(Gui::getMainWindow(),
QCoreApplication::translate("FemGui::ViewProviderFemMeshShapeNetgen", "Meshing failure"),
QCoreApplication::translate("FemGui::ViewProviderFemMeshShapeNetgen", "The FEM module is built without NETGEN support. Meshing will not work!!!")
);
return false;
#endif
}
else {
return ViewProviderDocumentObject::setEdit(ModNum);