fixes #0001906: add Parameters isRelative, theAngDeflection of BRepMesh_IncrementalMesh in MeshFromShape Gui command

This commit is contained in:
wmayer
2017-09-30 16:15:24 +02:00
parent c60bad3304
commit f8728a008f
5 changed files with 84 additions and 30 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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)