MeshPart: apply clang format
This commit is contained in:
@@ -22,15 +22,15 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QMessageBox>
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
@@ -39,8 +39,8 @@
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/WaitCursor.h>
|
||||
#include <Mod/Mesh/App/MeshFeature.h>
|
||||
#include <Mod/Part/App/BodyBase.h>
|
||||
#include <Mod/Mesh/Gui/ViewProvider.h>
|
||||
#include <Mod/Part/App/BodyBase.h>
|
||||
#include <Mod/Part/Gui/ViewProvider.h>
|
||||
|
||||
#include "Tessellation.h"
|
||||
@@ -52,7 +52,8 @@ using namespace MeshPartGui;
|
||||
/* TRANSLATOR MeshPartGui::Tessellation */
|
||||
|
||||
Tessellation::Tessellation(QWidget* parent)
|
||||
: QWidget(parent), ui(new Ui_Tessellation)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui_Tessellation)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
gmsh = new Mesh2ShapeGmsh(this);
|
||||
@@ -60,8 +61,8 @@ Tessellation::Tessellation(QWidget* parent)
|
||||
|
||||
ui->stackedWidget->addTab(gmsh, tr("Gmsh"));
|
||||
|
||||
ParameterGrp::handle handle = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/Mod/Mesh/Meshing/Standard");
|
||||
ParameterGrp::handle handle = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Mesh/Meshing/Standard");
|
||||
double value = ui->spinSurfaceDeviation->value().getValue();
|
||||
value = handle->GetFloat("LinearDeflection", value);
|
||||
double angle = ui->spinAngularDeviation->value().getValue();
|
||||
@@ -79,10 +80,10 @@ Tessellation::Tessellation(QWidget* parent)
|
||||
ui->comboFineness->setCurrentIndex(2);
|
||||
onComboFinenessCurrentIndexChanged(2);
|
||||
|
||||
#if !defined (HAVE_MEFISTO)
|
||||
#if !defined(HAVE_MEFISTO)
|
||||
ui->stackedWidget->setTabEnabled(Mefisto, false);
|
||||
#endif
|
||||
#if !defined (HAVE_NETGEN)
|
||||
#if !defined(HAVE_NETGEN)
|
||||
ui->stackedWidget->setTabEnabled(Netgen, false);
|
||||
#endif
|
||||
|
||||
@@ -101,14 +102,22 @@ Tessellation::~Tessellation() = default;
|
||||
void Tessellation::setupConnections()
|
||||
{
|
||||
connect(gmsh, &Mesh2ShapeGmsh::processed, this, &Tessellation::gmshProcessed);
|
||||
connect(ui->estimateMaximumEdgeLength, &QPushButton::clicked,
|
||||
this, &Tessellation::onEstimateMaximumEdgeLengthClicked);
|
||||
connect(ui->comboFineness, qOverload<int>(&QComboBox::currentIndexChanged),
|
||||
this, &Tessellation::onComboFinenessCurrentIndexChanged);
|
||||
connect(ui->checkSecondOrder, &QCheckBox::toggled,
|
||||
this, &Tessellation::onCheckSecondOrderToggled);
|
||||
connect(ui->checkQuadDominated, &QCheckBox::toggled,
|
||||
this, &Tessellation::onCheckQuadDominatedToggled);
|
||||
connect(ui->estimateMaximumEdgeLength,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&Tessellation::onEstimateMaximumEdgeLengthClicked);
|
||||
connect(ui->comboFineness,
|
||||
qOverload<int>(&QComboBox::currentIndexChanged),
|
||||
this,
|
||||
&Tessellation::onComboFinenessCurrentIndexChanged);
|
||||
connect(ui->checkSecondOrder,
|
||||
&QCheckBox::toggled,
|
||||
this,
|
||||
&Tessellation::onCheckSecondOrderToggled);
|
||||
connect(ui->checkQuadDominated,
|
||||
&QCheckBox::toggled,
|
||||
this,
|
||||
&Tessellation::onCheckQuadDominatedToggled);
|
||||
}
|
||||
|
||||
void Tessellation::meshingMethod(int id)
|
||||
@@ -130,56 +139,59 @@ void Tessellation::onComboFinenessCurrentIndexChanged(int index)
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
case VeryCoarse:
|
||||
ui->doubleGrading->setValue(0.7);
|
||||
ui->spinEdgeElements->setValue(0.3);
|
||||
ui->spinCurvatureElements->setValue(1.0);
|
||||
break;
|
||||
case Coarse:
|
||||
ui->doubleGrading->setValue(0.5);
|
||||
ui->spinEdgeElements->setValue(0.5);
|
||||
ui->spinCurvatureElements->setValue(1.5);
|
||||
break;
|
||||
case Moderate:
|
||||
ui->doubleGrading->setValue(0.3);
|
||||
ui->spinEdgeElements->setValue(1.0);
|
||||
ui->spinCurvatureElements->setValue(2.0);
|
||||
break;
|
||||
case Fine:
|
||||
ui->doubleGrading->setValue(0.2);
|
||||
ui->spinEdgeElements->setValue(2.0);
|
||||
ui->spinCurvatureElements->setValue(3.0);
|
||||
break;
|
||||
case VeryFine:
|
||||
ui->doubleGrading->setValue(0.1);
|
||||
ui->spinEdgeElements->setValue(3.0);
|
||||
ui->spinCurvatureElements->setValue(5.0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case VeryCoarse:
|
||||
ui->doubleGrading->setValue(0.7);
|
||||
ui->spinEdgeElements->setValue(0.3);
|
||||
ui->spinCurvatureElements->setValue(1.0);
|
||||
break;
|
||||
case Coarse:
|
||||
ui->doubleGrading->setValue(0.5);
|
||||
ui->spinEdgeElements->setValue(0.5);
|
||||
ui->spinCurvatureElements->setValue(1.5);
|
||||
break;
|
||||
case Moderate:
|
||||
ui->doubleGrading->setValue(0.3);
|
||||
ui->spinEdgeElements->setValue(1.0);
|
||||
ui->spinCurvatureElements->setValue(2.0);
|
||||
break;
|
||||
case Fine:
|
||||
ui->doubleGrading->setValue(0.2);
|
||||
ui->spinEdgeElements->setValue(2.0);
|
||||
ui->spinCurvatureElements->setValue(3.0);
|
||||
break;
|
||||
case VeryFine:
|
||||
ui->doubleGrading->setValue(0.1);
|
||||
ui->spinEdgeElements->setValue(3.0);
|
||||
ui->spinCurvatureElements->setValue(5.0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Tessellation::onCheckSecondOrderToggled(bool on)
|
||||
{
|
||||
if (on)
|
||||
if (on) {
|
||||
ui->checkQuadDominated->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Tessellation::onCheckQuadDominatedToggled(bool on)
|
||||
{
|
||||
if (on)
|
||||
if (on) {
|
||||
ui->checkSecondOrder->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Tessellation::gmshProcessed()
|
||||
{
|
||||
bool doClose = !ui->checkBoxDontQuit->isChecked();
|
||||
if (doClose)
|
||||
if (doClose) {
|
||||
Gui::Control().reject();
|
||||
}
|
||||
}
|
||||
|
||||
void Tessellation::changeEvent(QEvent *e)
|
||||
void Tessellation::changeEvent(QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
int index = ui->comboFineness->currentIndex();
|
||||
@@ -202,8 +214,8 @@ void Tessellation::onEstimateMaximumEdgeLengthClicked()
|
||||
}
|
||||
|
||||
double edgeLen = 0;
|
||||
for (auto &sel : Gui::Selection().getSelection("*", Gui::ResolveMode::NoResolve)) {
|
||||
auto shape = Part::Feature::getTopoShape(sel.pObject,sel.SubName);
|
||||
for (auto& sel : Gui::Selection().getSelection("*", Gui::ResolveMode::NoResolve)) {
|
||||
auto shape = Part::Feature::getTopoShape(sel.pObject, sel.SubName);
|
||||
if (shape.hasSubShape(TopAbs_FACE)) {
|
||||
Base::BoundBox3d bbox = shape.getBoundBox();
|
||||
edgeLen = std::max<double>(edgeLen, bbox.LengthX());
|
||||
@@ -212,7 +224,7 @@ void Tessellation::onEstimateMaximumEdgeLengthClicked()
|
||||
}
|
||||
}
|
||||
|
||||
ui->spinMaximumEdgeLength->setValue(edgeLen/10);
|
||||
ui->spinMaximumEdgeLength->setValue(edgeLen / 10);
|
||||
}
|
||||
|
||||
bool Tessellation::accept()
|
||||
@@ -234,8 +246,8 @@ bool Tessellation::accept()
|
||||
|
||||
bool bodyWithNoTip = false;
|
||||
bool partWithNoFace = false;
|
||||
for (auto &sel : Gui::Selection().getSelection("*", Gui::ResolveMode::NoResolve)) {
|
||||
auto shape = Part::Feature::getTopoShape(sel.pObject,sel.SubName);
|
||||
for (auto& sel : Gui::Selection().getSelection("*", Gui::ResolveMode::NoResolve)) {
|
||||
auto shape = Part::Feature::getTopoShape(sel.pObject, sel.SubName);
|
||||
if (shape.hasSubShape(TopAbs_FACE)) {
|
||||
shapeObjects.emplace_back(sel.pObject, sel.SubName);
|
||||
}
|
||||
@@ -254,12 +266,17 @@ bool Tessellation::accept()
|
||||
|
||||
if (shapeObjects.empty()) {
|
||||
if (bodyWithNoTip) {
|
||||
QMessageBox::critical(this, windowTitle(), tr("You have selected a body without tip.\n"
|
||||
"Either set the tip of the body or select a different shape, please."));
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
windowTitle(),
|
||||
tr("You have selected a body without tip.\n"
|
||||
"Either set the tip of the body or select a different shape, please."));
|
||||
}
|
||||
else if (partWithNoFace) {
|
||||
QMessageBox::critical(this, windowTitle(), tr("You have selected a shape without faces.\n"
|
||||
"Select a different shape, please."));
|
||||
QMessageBox::critical(this,
|
||||
windowTitle(),
|
||||
tr("You have selected a shape without faces.\n"
|
||||
"Select a different shape, please."));
|
||||
}
|
||||
else {
|
||||
QMessageBox::critical(this, windowTitle(), tr("Select a shape for meshing, first."));
|
||||
@@ -282,7 +299,9 @@ bool Tessellation::accept()
|
||||
}
|
||||
}
|
||||
|
||||
void Tessellation::process(int method, App::Document* doc, const std::list<App::SubObjectT>& shapeObjects)
|
||||
void Tessellation::process(int method,
|
||||
App::Document* doc,
|
||||
const std::list<App::SubObjectT>& shapeObjects)
|
||||
{
|
||||
try {
|
||||
Gui::WaitCursor wc;
|
||||
@@ -290,37 +309,36 @@ void Tessellation::process(int method, App::Document* doc, const std::list<App::
|
||||
saveParameters(method);
|
||||
|
||||
doc->openTransaction("Meshing");
|
||||
for (auto &info : shapeObjects) {
|
||||
for (auto& info : shapeObjects) {
|
||||
QString subname = QString::fromLatin1(info.getSubName().c_str());
|
||||
QString objname = QString::fromLatin1(info.getObjectName().c_str());
|
||||
|
||||
auto obj = info.getObject();
|
||||
if (!obj)
|
||||
if (!obj) {
|
||||
continue;
|
||||
}
|
||||
auto sobj = obj->getSubObject(info.getSubName().c_str());
|
||||
if (!sobj)
|
||||
if (!sobj) {
|
||||
continue;
|
||||
}
|
||||
sobj = sobj->getLinkedObject(true);
|
||||
if (!sobj)
|
||||
if (!sobj) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QString label = QString::fromUtf8(sobj->Label.getValue());
|
||||
|
||||
QString param = getMeshingParameters(method, sobj);
|
||||
|
||||
QString cmd = QString::fromLatin1(
|
||||
"__doc__=FreeCAD.getDocument(\"%1\")\n"
|
||||
"__mesh__=__doc__.addObject(\"Mesh::Feature\",\"Mesh\")\n"
|
||||
"__part__=__doc__.getObject(\"%2\")\n"
|
||||
"__shape__=Part.getShape(__part__,\"%3\")\n"
|
||||
"__mesh__.Mesh=MeshPart.meshFromShape(%4)\n"
|
||||
"__mesh__.Label=\"%5 (Meshed)\"\n"
|
||||
"del __doc__, __mesh__, __part__, __shape__\n")
|
||||
.arg(this->document,
|
||||
objname,
|
||||
subname,
|
||||
param,
|
||||
label);
|
||||
QString cmd =
|
||||
QString::fromLatin1("__doc__=FreeCAD.getDocument(\"%1\")\n"
|
||||
"__mesh__=__doc__.addObject(\"Mesh::Feature\",\"Mesh\")\n"
|
||||
"__part__=__doc__.getObject(\"%2\")\n"
|
||||
"__shape__=Part.getShape(__part__,\"%3\")\n"
|
||||
"__mesh__.Mesh=MeshPart.meshFromShape(%4)\n"
|
||||
"__mesh__.Label=\"%5 (Meshed)\"\n"
|
||||
"del __doc__, __mesh__, __part__, __shape__\n")
|
||||
.arg(this->document, objname, subname, param, label);
|
||||
|
||||
Gui::Command::runCommand(Gui::Command::Doc, cmd.toUtf8());
|
||||
|
||||
@@ -337,8 +355,8 @@ void Tessellation::process(int method, App::Document* doc, const std::list<App::
|
||||
void Tessellation::saveParameters(int method)
|
||||
{
|
||||
if (method == Standard) {
|
||||
ParameterGrp::handle handle = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/Mod/Mesh/Meshing/Standard");
|
||||
ParameterGrp::handle handle = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Mesh/Meshing/Standard");
|
||||
double value = ui->spinSurfaceDeviation->value().getValue();
|
||||
handle->SetFloat("LinearDeflection", value);
|
||||
double angle = ui->spinAngularDeviation->value().getValue();
|
||||
@@ -353,12 +371,12 @@ void Tessellation::setFaceColors(int method, App::Document* doc, App::DocumentOb
|
||||
// if Standard mesher is used and face colors should be applied
|
||||
if (method == Standard) {
|
||||
if (ui->meshShapeColors->isChecked()) {
|
||||
Gui::ViewProvider* vpm = Gui::Application::Instance->getViewProvider
|
||||
(doc->getActiveObject());
|
||||
Gui::ViewProvider* vpm =
|
||||
Gui::Application::Instance->getViewProvider(doc->getActiveObject());
|
||||
MeshGui::ViewProviderMesh* vpmesh = dynamic_cast<MeshGui::ViewProviderMesh*>(vpm);
|
||||
|
||||
auto svp = Base::freecad_dynamic_cast<PartGui::ViewProviderPartExt>(
|
||||
Gui::Application::Instance->getViewProvider(obj));
|
||||
Gui::Application::Instance->getViewProvider(obj));
|
||||
if (vpmesh && svp) {
|
||||
std::vector<App::Color> diff_col = svp->DiffuseColor.getValues();
|
||||
if (ui->groupsFaceColors->isChecked()) {
|
||||
@@ -374,12 +392,14 @@ std::vector<App::Color> Tessellation::getUniqueColors(const std::vector<App::Col
|
||||
{
|
||||
// unique colors
|
||||
std::set<uint32_t> col_set;
|
||||
for (const auto& it : colors)
|
||||
for (const auto& it : colors) {
|
||||
col_set.insert(it.getPackedValue());
|
||||
}
|
||||
|
||||
std::vector<App::Color> unique;
|
||||
for (const auto& it : col_set)
|
||||
for (const auto& it : col_set) {
|
||||
unique.emplace_back(it);
|
||||
}
|
||||
return unique;
|
||||
}
|
||||
|
||||
@@ -411,14 +431,15 @@ QString Tessellation::getStandardParameters(App::DocumentObject* obj) const
|
||||
"LinearDeflection=%1, "
|
||||
"AngularDeflection=%2, "
|
||||
"Relative=%3")
|
||||
.arg(devFace)
|
||||
.arg(devAngle)
|
||||
.arg(relative ? QString::fromLatin1("True") : QString::fromLatin1("False"));
|
||||
if (ui->meshShapeColors->isChecked())
|
||||
.arg(devFace)
|
||||
.arg(devAngle)
|
||||
.arg(relative ? QString::fromLatin1("True") : QString::fromLatin1("False"));
|
||||
if (ui->meshShapeColors->isChecked()) {
|
||||
param += QString::fromLatin1(",Segments=True");
|
||||
}
|
||||
|
||||
auto svp = Base::freecad_dynamic_cast<PartGui::ViewProviderPartExt>(
|
||||
Gui::Application::Instance->getViewProvider(obj));
|
||||
Gui::Application::Instance->getViewProvider(obj));
|
||||
if (ui->groupsFaceColors->isChecked() && svp) {
|
||||
// TODO: currently, we can only retrieve part feature
|
||||
// color. The problem is that if the feature is linked,
|
||||
@@ -431,7 +452,8 @@ QString Tessellation::getStandardParameters(App::DocumentObject* obj) const
|
||||
//
|
||||
// PartGui::ViewProviderPartExt::getShapeColors().
|
||||
//
|
||||
param += QString::fromLatin1(",GroupColors=Gui.getDocument('%1').getObject('%2').DiffuseColor")
|
||||
param +=
|
||||
QString::fromLatin1(",GroupColors=Gui.getDocument('%1').getObject('%2').DiffuseColor")
|
||||
.arg(QString::fromLatin1(obj->getDocument()->getName()),
|
||||
QString::fromLatin1(obj->getNameInDocument()));
|
||||
}
|
||||
@@ -442,8 +464,9 @@ QString Tessellation::getStandardParameters(App::DocumentObject* obj) const
|
||||
QString Tessellation::getMefistoParameters() const
|
||||
{
|
||||
double maxEdge = ui->spinMaximumEdgeLength->value().getValue();
|
||||
if (!ui->spinMaximumEdgeLength->isEnabled())
|
||||
if (!ui->spinMaximumEdgeLength->isEnabled()) {
|
||||
maxEdge = 0;
|
||||
}
|
||||
return QString::fromLatin1("Shape=__shape__,MaxLength=%1").arg(maxEdge);
|
||||
}
|
||||
|
||||
@@ -459,21 +482,22 @@ QString Tessellation::getNetgenParameters() const
|
||||
bool allowquad = ui->checkQuadDominated->isChecked();
|
||||
if (fineness < 5) {
|
||||
param = QString::fromLatin1("Shape=__shape__,"
|
||||
"Fineness=%1,SecondOrder=%2,Optimize=%3,AllowQuad=%4")
|
||||
.arg(fineness)
|
||||
.arg(secondOrder ? 1 : 0)
|
||||
.arg(optimize ? 1 : 0)
|
||||
.arg(allowquad ? 1 : 0);
|
||||
"Fineness=%1,SecondOrder=%2,Optimize=%3,AllowQuad=%4")
|
||||
.arg(fineness)
|
||||
.arg(secondOrder ? 1 : 0)
|
||||
.arg(optimize ? 1 : 0)
|
||||
.arg(allowquad ? 1 : 0);
|
||||
}
|
||||
else {
|
||||
param = QString::fromLatin1("Shape=__shape__,"
|
||||
"GrowthRate=%1,SegPerEdge=%2,SegPerRadius=%3,SecondOrder=%4,Optimize=%5,AllowQuad=%6")
|
||||
.arg(growthRate)
|
||||
.arg(nbSegPerEdge)
|
||||
.arg(nbSegPerRadius)
|
||||
.arg(secondOrder ? 1 : 0)
|
||||
.arg(optimize ? 1 : 0)
|
||||
.arg(allowquad ? 1 : 0);
|
||||
"GrowthRate=%1,SegPerEdge=%2,SegPerRadius=%3,SecondOrder=%4,"
|
||||
"Optimize=%5,AllowQuad=%6")
|
||||
.arg(growthRate)
|
||||
.arg(nbSegPerEdge)
|
||||
.arg(nbSegPerRadius)
|
||||
.arg(secondOrder ? 1 : 0)
|
||||
.arg(optimize ? 1 : 0)
|
||||
.arg(allowquad ? 1 : 0);
|
||||
}
|
||||
|
||||
return param;
|
||||
@@ -481,7 +505,8 @@ QString Tessellation::getNetgenParameters() const
|
||||
|
||||
// ---------------------------------------
|
||||
|
||||
class Mesh2ShapeGmsh::Private {
|
||||
class Mesh2ShapeGmsh::Private
|
||||
{
|
||||
public:
|
||||
std::string label;
|
||||
std::list<App::SubObjectT> shapes;
|
||||
@@ -492,8 +517,8 @@ public:
|
||||
};
|
||||
|
||||
Mesh2ShapeGmsh::Mesh2ShapeGmsh(QWidget* parent, Qt::WindowFlags fl)
|
||||
: GmshWidget(parent, fl)
|
||||
, d(new Private())
|
||||
: GmshWidget(parent, fl)
|
||||
, d(new Private())
|
||||
{
|
||||
d->cadFile = App::Application::getTempFileName() + "mesh.brep";
|
||||
d->stlFile = App::Application::getTempFileName() + "mesh.stl";
|
||||
@@ -526,40 +551,46 @@ bool Mesh2ShapeGmsh::writeProject(QString& inpFile, QString& outFile)
|
||||
// Parameters
|
||||
int algorithm = meshingAlgorithm();
|
||||
double maxSize = getMaxSize();
|
||||
if (maxSize == 0.0)
|
||||
if (maxSize == 0.0) {
|
||||
maxSize = 1.0e22;
|
||||
}
|
||||
double minSize = getMinSize();
|
||||
|
||||
// Gmsh geo file
|
||||
Base::FileInfo geo(d->geoFile);
|
||||
Base::ofstream geoOut(geo, std::ios::out);
|
||||
geoOut << "// geo file for meshing with Gmsh meshing software created by FreeCAD\n"
|
||||
<< "// open brep geometry\n"
|
||||
<< "Merge \"" << d->cadFile << "\";\n\n"
|
||||
<< "// Characteristic Length\n"
|
||||
<< "// no boundary layer settings for this mesh\n"
|
||||
<< "// min, max Characteristic Length\n"
|
||||
<< "Mesh.CharacteristicLengthMax = " << maxSize << ";\n"
|
||||
<< "Mesh.CharacteristicLengthMin = " << minSize << ";\n\n"
|
||||
<< "// optimize the mesh\n"
|
||||
<< "Mesh.Optimize = 1;\n"
|
||||
<< "Mesh.OptimizeNetgen = 0;\n"
|
||||
<< "// High-order meshes optimization (0=none, 1=optimization, 2=elastic+optimization, 3=elastic, 4=fast curving)\n"
|
||||
<< "Mesh.HighOrderOptimize = 0;\n\n"
|
||||
<< "// mesh order\n"
|
||||
<< "Mesh.ElementOrder = 2;\n"
|
||||
<< "// Second order nodes are created by linear interpolation instead by curvilinear\n"
|
||||
<< "Mesh.SecondOrderLinear = 1;\n\n"
|
||||
<< "// mesh algorithm, only a few algorithms are usable with 3D boundary layer generation\n"
|
||||
<< "// 2D mesh algorithm (1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=BAMG, 8=DelQuad, 9=Packing of Parallelograms)\n"
|
||||
<< "Mesh.Algorithm = " << algorithm << ";\n"
|
||||
<< "// 3D mesh algorithm (1=Delaunay, 2=New Delaunay, 4=Frontal, 7=MMG3D, 9=R-tree, 10=HTX)\n"
|
||||
<< "Mesh.Algorithm3D = 1;\n\n"
|
||||
<< "// meshing\n"
|
||||
<< "// set geometrical tolerance (also used for merging nodes)\n"
|
||||
<< "Geometry.Tolerance = 1e-06;\n"
|
||||
<< "Mesh 2;\n"
|
||||
<< "Coherence Mesh; // Remove duplicate vertices\n";
|
||||
<< "// open brep geometry\n"
|
||||
<< "Merge \"" << d->cadFile << "\";\n\n"
|
||||
<< "// Characteristic Length\n"
|
||||
<< "// no boundary layer settings for this mesh\n"
|
||||
<< "// min, max Characteristic Length\n"
|
||||
<< "Mesh.CharacteristicLengthMax = " << maxSize << ";\n"
|
||||
<< "Mesh.CharacteristicLengthMin = " << minSize << ";\n\n"
|
||||
<< "// optimize the mesh\n"
|
||||
<< "Mesh.Optimize = 1;\n"
|
||||
<< "Mesh.OptimizeNetgen = 0;\n"
|
||||
<< "// High-order meshes optimization (0=none, 1=optimization, "
|
||||
"2=elastic+optimization, 3=elastic, 4=fast curving)\n"
|
||||
<< "Mesh.HighOrderOptimize = 0;\n\n"
|
||||
<< "// mesh order\n"
|
||||
<< "Mesh.ElementOrder = 2;\n"
|
||||
<< "// Second order nodes are created by linear interpolation instead by "
|
||||
"curvilinear\n"
|
||||
<< "Mesh.SecondOrderLinear = 1;\n\n"
|
||||
<< "// mesh algorithm, only a few algorithms are usable with 3D boundary layer "
|
||||
"generation\n"
|
||||
<< "// 2D mesh algorithm (1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, "
|
||||
"7=BAMG, 8=DelQuad, 9=Packing of Parallelograms)\n"
|
||||
<< "Mesh.Algorithm = " << algorithm << ";\n"
|
||||
<< "// 3D mesh algorithm (1=Delaunay, 2=New Delaunay, 4=Frontal, 7=MMG3D, "
|
||||
"9=R-tree, 10=HTX)\n"
|
||||
<< "Mesh.Algorithm3D = 1;\n\n"
|
||||
<< "// meshing\n"
|
||||
<< "// set geometrical tolerance (also used for merging nodes)\n"
|
||||
<< "Geometry.Tolerance = 1e-06;\n"
|
||||
<< "Mesh 2;\n"
|
||||
<< "Coherence Mesh; // Remove duplicate vertices\n";
|
||||
geoOut.close();
|
||||
|
||||
inpFile = QString::fromUtf8(d->geoFile.c_str());
|
||||
@@ -570,8 +601,9 @@ bool Mesh2ShapeGmsh::writeProject(QString& inpFile, QString& outFile)
|
||||
}
|
||||
else {
|
||||
App::Document* doc = d->doc.getDocument();
|
||||
if (doc)
|
||||
if (doc) {
|
||||
doc->commitTransaction();
|
||||
}
|
||||
|
||||
Q_EMIT processed();
|
||||
}
|
||||
@@ -582,8 +614,9 @@ bool Mesh2ShapeGmsh::writeProject(QString& inpFile, QString& outFile)
|
||||
bool Mesh2ShapeGmsh::loadOutput()
|
||||
{
|
||||
App::Document* doc = d->doc.getDocument();
|
||||
if (!doc)
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now read-in the mesh
|
||||
Base::FileInfo stl(d->stlFile);
|
||||
@@ -613,20 +646,20 @@ bool Mesh2ShapeGmsh::loadOutput()
|
||||
TaskTessellation::TaskTessellation()
|
||||
{
|
||||
widget = new Tessellation();
|
||||
Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox(
|
||||
QPixmap()/*Gui::BitmapFactory().pixmap("MeshPart_Mesher")*/,
|
||||
widget->windowTitle(), true, nullptr);
|
||||
Gui::TaskView::TaskBox* taskbox =
|
||||
new Gui::TaskView::TaskBox(QPixmap() /*Gui::BitmapFactory().pixmap("MeshPart_Mesher")*/,
|
||||
widget->windowTitle(),
|
||||
true,
|
||||
nullptr);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
void TaskTessellation::open()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void TaskTessellation::clicked(int)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool TaskTessellation::accept()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user