fixes #0001906: add Parameters isRelative, theAngDeflection of BRepMesh_IncrementalMesh in MeshFromShape Gui command
This commit is contained in:
@@ -67,8 +67,11 @@ public:
|
||||
"Multiple signatures are available:\n"
|
||||
"\n"
|
||||
" meshFromShape(Shape)\n"
|
||||
" meshFromShape(Shape, LinearDeflection, AngularDeflection=0.5,\n"
|
||||
" Segments=False, GroupColors=[])\n"
|
||||
" meshFromShape(Shape, LinearDeflection,\n"
|
||||
" AngularDeflection=0.5,\n"
|
||||
" Relative=False,"
|
||||
" Segments=False,\n"
|
||||
" GroupColors=[])\n"
|
||||
" meshFromShape(Shape, MaxLength)\n"
|
||||
" meshFromShape(Shape, MaxArea)\n"
|
||||
" meshFromShape(Shape, LocalLength)\n"
|
||||
@@ -230,20 +233,23 @@ private:
|
||||
PyObject *shape;
|
||||
|
||||
static char* kwds_lindeflection[] = {"Shape", "LinearDeflection", "AngularDeflection",
|
||||
"Segments", "GroupColors", NULL};
|
||||
"Relative", "Segments", "GroupColors", NULL};
|
||||
PyErr_Clear();
|
||||
double lindeflection=0;
|
||||
double angdeflection=0.5;
|
||||
PyObject* relative = Py_False;
|
||||
PyObject* segment = Py_False;
|
||||
PyObject* groupColors = 0;
|
||||
if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d|dO!O", kwds_lindeflection,
|
||||
&(Part::TopoShapePy::Type), &shape, &lindeflection, &angdeflection,
|
||||
if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d|dO!O!O", kwds_lindeflection,
|
||||
&(Part::TopoShapePy::Type), &shape, &lindeflection,
|
||||
&angdeflection, &(PyBool_Type), &relative,
|
||||
&(PyBool_Type), &segment, &groupColors)) {
|
||||
MeshPart::Mesher mesher(static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
|
||||
mesher.setMethod(MeshPart::Mesher::Standard);
|
||||
mesher.setDeflection(lindeflection);
|
||||
mesher.setAngularDeflection(angdeflection);
|
||||
mesher.setRegular(true);
|
||||
mesher.setRelative(PyObject_IsTrue(relative) ? true : false);
|
||||
mesher.setSegments(PyObject_IsTrue(segment) ? true : false);
|
||||
if (groupColors) {
|
||||
Py::Sequence list(groupColors);
|
||||
|
||||
@@ -148,6 +148,7 @@ Mesher::Mesher(const TopoDS_Shape& s)
|
||||
, angularDeflection(0.5)
|
||||
, minLen(0)
|
||||
, maxLen(0)
|
||||
, relative(false)
|
||||
, regular(false)
|
||||
, segments(false)
|
||||
#if defined (HAVE_NETGEN)
|
||||
@@ -172,7 +173,7 @@ Mesh::MeshObject* Mesher::createMesh() const
|
||||
if (method == Standard) {
|
||||
if (!shape.IsNull()) {
|
||||
BRepTools::Clean(shape);
|
||||
BRepMesh_IncrementalMesh aMesh(shape, deflection, Standard_False, angularDeflection);
|
||||
BRepMesh_IncrementalMesh aMesh(shape, deflection, relative, angularDeflection);
|
||||
}
|
||||
|
||||
std::vector<Part::TopoShape::Domain> domains;
|
||||
|
||||
@@ -81,6 +81,10 @@ public:
|
||||
{ regular = s; }
|
||||
bool isRegular() const
|
||||
{ return regular; }
|
||||
void setRelative(bool s)
|
||||
{ relative = s; }
|
||||
bool isRelative() const
|
||||
{ return relative; }
|
||||
void setSegments(bool s)
|
||||
{ segments = s; }
|
||||
bool isSegments() const
|
||||
@@ -134,6 +138,7 @@ private:
|
||||
double deflection;
|
||||
double angularDeflection;
|
||||
double minLen, maxLen;
|
||||
bool relative;
|
||||
bool regular;
|
||||
bool segments;
|
||||
#if defined (HAVE_NETGEN)
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "ui_Tessellation.h"
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <Gui/Application.h>
|
||||
@@ -248,9 +249,17 @@ bool Tessellation::accept()
|
||||
QString cmd;
|
||||
if (method == 0) { // Standard
|
||||
double devFace = ui->spinSurfaceDeviation->value().getValue();
|
||||
QString param = QString::fromLatin1("Shape=__doc__.getObject(\"%1\").Shape,LinearDeflection=%2")
|
||||
double devAngle = ui->spinAngularDeviation->value().getValue();
|
||||
devAngle = Base::toRadians<double>(devAngle);
|
||||
bool relative = ui->relativeDeviation->isChecked();
|
||||
QString param = QString::fromLatin1("Shape=__doc__.getObject(\"%1\").Shape, "
|
||||
"LinearDeflection=%2, "
|
||||
"AngularDeflection=%3, "
|
||||
"Relative=%4")
|
||||
.arg(shape)
|
||||
.arg(devFace);
|
||||
.arg(devFace)
|
||||
.arg(devAngle)
|
||||
.arg(relative ? QString::fromLatin1("True") : QString::fromLatin1("False"));
|
||||
if (ui->meshShapeColors->isChecked())
|
||||
param += QString::fromLatin1(",Segments=True");
|
||||
if (ui->groupsFaceColors->isChecked())
|
||||
|
||||
@@ -59,30 +59,17 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageStandard">
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>189</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelSurfaceDeviation">
|
||||
<property name="text">
|
||||
<string>Surface deviation:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="spinSurfaceDeviation">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
@@ -98,21 +85,67 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelAngularDeviation">
|
||||
<property name="text">
|
||||
<string>Angular deviation:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="spinAngularDeviation">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">deg</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>180.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>5.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>30.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="relativeDeviation">
|
||||
<property name="text">
|
||||
<string>Relative surface deviation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="meshShapeColors">
|
||||
<property name="text">
|
||||
<string>Apply face colors to mesh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="groupsFaceColors">
|
||||
<property name="text">
|
||||
<string>Define segments by face colors</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="meshShapeColors">
|
||||
<property name="text">
|
||||
<string>Apply face colors to mesh</string>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>189</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user