Further implementing parameter setting

This commit is contained in:
jriegel 2013-05-05 19:34:05 +02:00
parent 81aa1caf9b
commit dab1499b5b
5 changed files with 71 additions and 8 deletions

View File

@ -31,6 +31,7 @@
#include <App/DocumentObjectPy.h>
#include <Base/Placement.h>
#include <Mod/Part/App/PartFeature.h>
#include <Base/Console.h>
#include <SMESH_Gen.hxx>
#include <SMESH_Mesh.hxx>
@ -100,17 +101,22 @@ App::DocumentObjectExecReturn *FemMeshShapeNetgenObject::execute(void)
NETGENPlugin_Hypothesis* tet= new NETGENPlugin_Hypothesis(hyp++,1,myGen);
tet->SetMaxSize(MaxSize.getValue());
tet->SetSecondOrder(SecondOrder.getValue());
tet->SetOptimize(Optimize.getValue());
tet->SetFineness((NETGENPlugin_Hypothesis::Fineness)Fininess.getValue());
tet->SetGrowthRate(GrothRate.getValue());
tet->SetNbSegPerEdge(NbSegsPerEdge.getValue());
tet->SetNbSegPerRadius(NbSegsPerRadius.getValue());
tet->SetOptimize(Optimize.getValue());
int iFininess = Fininess.getValue();
tet->SetFineness((NETGENPlugin_Hypothesis::Fineness)iFininess);
if(iFininess == 5){
tet->SetGrowthRate(GrothRate.getValue());
tet->SetNbSegPerEdge(NbSegsPerEdge.getValue());
tet->SetNbSegPerRadius(NbSegsPerRadius.getValue());
}
myNetGenMesher.SetParameters( tet);
myNetGenMesher.Compute();
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(newMesh.getSMesh())->GetMeshDS();
const SMDS_MeshInfo& info = data->GetMeshInfo();
int numFaces = data->NbFaces();
int numNode = info.NbNodes();
int numTria = info.NbTriangles();
int numQuad = info.NbQuadrangles();
@ -122,6 +128,8 @@ App::DocumentObjectExecReturn *FemMeshShapeNetgenObject::execute(void)
int numPris = info.NbPrisms();
int numHedr = info.NbPolyhedrons();
Base::Console().Log("NetgenMesh: %i Nodes, %i Volumes, %i Faces\n",numNode,numVolu,numFaces);
// set the value to the object
FemMesh.setValue(newMesh);

View File

@ -34,6 +34,8 @@
#include <Gui/Application.h>
#include <Gui/Document.h>
#include <Gui/Command.h>
#include <Gui/WaitCursor.h>
#include "ViewProviderFemMeshShapeNetgen.h"
#include <Mod/Fem/App/FemMeshShapeNetgenObject.h>
@ -77,6 +79,7 @@ void TaskDlgMeshShapeNetgen::clicked(int button)
try {
if(QDialogButtonBox::Apply == button)
{
Gui::WaitCursor wc;
// May throw an exception which we must handle here
FemMeshShapeNetgenObject->execute();
}

View File

@ -63,6 +63,11 @@ TaskTetParameter::TaskTetParameter(Fem::FemMeshShapeNetgenObject *pcObject,QWidg
QObject::connect(ui->doubleSpinBox_MaxSize,SIGNAL(valueChanged(double)),this,SLOT(maxSizeValueChanged(double)));
QObject::connect(ui->comboBox_Fineness,SIGNAL(activated (int)),this,SLOT(SwitchMethod(int)));
QObject::connect(ui->checkBox_SecondOrder,SIGNAL(stateChanged (int)),this,SLOT(setQuadric(int)));
QObject::connect(ui->doubleSpinBox_GrothRate,SIGNAL(valueChanged(double)),this,SLOT(setGrothRate(double)));
QObject::connect(ui->spinBox_SegsPerEdge,SIGNAL(valueChanged (int)),this,SLOT(setSegsPerEdge(int)));
QObject::connect(ui->spinBox_SegsPerRadius,SIGNAL(valueChanged (int)),this,SLOT(setSegsPerRadius(int)));
QObject::connect(ui->checkBox_Optimize,SIGNAL(stateChanged (int)),this,SLOT(setOptimize(int)));
}
@ -74,6 +79,16 @@ TaskTetParameter::~TaskTetParameter()
void TaskTetParameter::SwitchMethod(int Value)
{
if(Value == 5){
ui->doubleSpinBox_GrothRate->setEnabled(true);
ui->spinBox_SegsPerEdge->setEnabled(true);
ui->spinBox_SegsPerRadius->setEnabled(true);
}else{
ui->doubleSpinBox_GrothRate->setEnabled(false);
ui->spinBox_SegsPerEdge->setEnabled(false);
ui->spinBox_SegsPerRadius->setEnabled(false);
}
pcObject->Fininess.setValue(Value);
}
@ -82,6 +97,35 @@ void TaskTetParameter::maxSizeValueChanged(double Value)
pcObject->MaxSize.setValue(Value);
}
void TaskTetParameter::setQuadric(int s)
{
pcObject->SecondOrder.setValue(s!=0);
}
void TaskTetParameter::setGrothRate(double v)
{
pcObject->GrothRate.setValue(v);
}
void TaskTetParameter::setSegsPerEdge(int v)
{
pcObject->NbSegsPerEdge.setValue(v);
}
void TaskTetParameter::setSegsPerRadius(int v)
{
pcObject->NbSegsPerRadius.setValue(v);
}
void TaskTetParameter::setOptimize(int v)
{
pcObject->Optimize.setValue(v!=0);
}

View File

@ -63,6 +63,11 @@ public:
private Q_SLOTS:
void SwitchMethod(int Value);
void maxSizeValueChanged(double Value);
void setQuadric(int s);
void setGrothRate(double v);
void setSegsPerEdge(int v);
void setSegsPerRadius(int v);
void setOptimize(int v);
protected:
Fem::FemMeshShapeNetgenObject *pcObject;

View File

@ -39,7 +39,7 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<widget class="QCheckBox" name="checkBox_SecondOrder">
<property name="text">
<string>Second order</string>
</property>
@ -117,6 +117,9 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
<item row="3" column="0">
@ -136,7 +139,7 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<widget class="QCheckBox" name="checkBox_Optimize">
<property name="text">
<string>Optimize</string>
</property>