1
/***************************************************************************
2
* Copyright (c) 2008 Jürgen Riegel <juergen.riegel@web.de> *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 59 Temple Place, *
19
* Suite 330, Boston, MA 02111-1307, USA *
21
***************************************************************************/
23
#include "PreCompiled.h"
25
#include <BRepBuilderAPI_MakePolygon.hxx>
29
#include <Base/Console.h>
30
#include <Base/Converter.h>
31
#include <Base/GeometryPyCXX.h>
32
#include <Base/Interpreter.h>
33
#include <Base/PyWrapParseTupleAndKeywords.h>
34
#include <Base/Vector3D.h>
35
#include <Base/VectorPy.h>
36
#include <Mod/Mesh/App/Core/Algorithm.h>
37
#include <Mod/Mesh/App/Core/MeshKernel.h>
38
#include <Mod/Mesh/App/MeshPy.h>
39
#include <Mod/Part/App/TopoShapeEdgePy.h>
40
#include <Mod/Part/App/TopoShapePy.h>
41
#include <Mod/Part/App/TopoShapeWirePy.h>
49
class Module : public Py::ExtensionModule<Module>
52
Module() : Py::ExtensionModule<Module>("MeshPart")
54
add_varargs_method("loftOnCurve",&Module::loftOnCurve,
55
"Creates a mesh loft based on a curve and an up vector\n"
57
"loftOnCurve(curve, poly, upVector, MaxSize)\n"
60
" curve (topology):\n"
61
" poly (list of (x, y z) or (x, y) tuples of floats):\n"
62
" upVector ((x, y, z) tuple):\n"
65
add_varargs_method("findSectionParameters",&Module::findSectionParameters,
66
"Find the parameters of the edge where when projecting the corresponding point\n"
67
"will lie on an edge of the mesh\n"
69
"findSectionParameters(Edge, Mesh, Vector) -> list\n"
71
add_keyword_method("projectShapeOnMesh",&Module::projectShapeOnMesh,
72
"Projects a shape onto a mesh with a given maximum distance\n"
73
"projectShapeOnMesh(Shape, Mesh, float) -> polygon\n"
74
"or projects the shape in a given direction\n"
76
"Multiple signatures are available:\n"
78
"projectShapeOnMesh(Shape, Mesh, float) -> list of polygons\n"
79
"projectShapeOnMesh(Shape, Mesh, Vector) -> list of polygons\n"
80
"projectShapeOnMesh(list of polygons, Mesh, Vector) -> list of polygons\n"
82
add_varargs_method("projectPointsOnMesh",&Module::projectPointsOnMesh,
83
"Projects points onto a mesh with a given direction\n"
85
"projectPointsOnMesh(list of points, Mesh, Vector, [float]) -> list of points\n"
87
add_varargs_method("wireFromSegment",&Module::wireFromSegment,
88
"Create wire(s) from boundary of a mesh segment\n"
90
add_varargs_method("wireFromMesh",&Module::wireFromMesh,
91
"Create wire(s) from boundary of a mesh\n"
93
add_keyword_method("meshFromShape",&Module::meshFromShape,
94
"Create surface mesh from shape\n"
96
"Multiple signatures are available:\n"
98
" meshFromShape(Shape)\n"
99
" meshFromShape(Shape, LinearDeflection,\n"
100
" AngularDeflection=0.5,\n"
104
" meshFromShape(Shape, MaxLength)\n"
105
" meshFromShape(Shape, MaxArea)\n"
106
" meshFromShape(Shape, LocalLength)\n"
107
" meshFromShape(Shape, Deflection)\n"
108
" meshFromShape(Shape, MinLength, MaxLength)\n"
110
"Additionally, when FreeCAD is built with netgen, the following\n"
111
"signatures are also available (they are "
117
" meshFromShape(Shape, Fineness, SecondOrder=0,\n"
118
" Optimize=1, AllowQuad=0, MaxLength=0, MinLength=0)\n"
119
" meshFromShape(Shape, GrowthRate=0, SegPerEdge=0,\n"
120
" SegPerRadius=0, SecondOrder=0, Optimize=1,\n"
124
" Shape (required, topology) - TopoShape to create mesh of.\n"
125
" LinearDeflection (required, float)\n"
126
" AngularDeflection (optional, float)\n"
127
" Segments (optional, boolean)\n"
128
" GroupColors (optional, list of (Red, Green, Blue) tuples)\n"
129
" MaxLength (required, float)\n"
130
" MaxArea (required, float)\n"
131
" LocalLength (required, float)\n"
132
" Deflection (required, float)\n"
133
" MinLength (required, float)\n"
134
" Fineness (required, integer)\n"
135
" SecondOrder (optional, integer boolean)\n"
136
" Optimize (optional, integer boolean)\n"
137
" AllowQuad (optional, integer boolean)\n"
138
" GrowthRate (optional, float)\n"
139
" SegPerEdge (optional, float)\n"
140
" SegPerRadius (optional, float)\n"
142
initialize("This module is the MeshPart module."); // register with Python
146
Py::Object invoke_method_varargs(void *method_def, const Py::Tuple &args) override
149
return Py::ExtensionModule<Module>::invoke_method_varargs(method_def, args);
151
catch (const Standard_Failure &e) {
153
Standard_CString msg = e.GetMessageString();
154
str += typeid(e).name();
156
if (msg) {str += msg;}
157
else {str += "No OCCT Exception Message";}
158
Base::Console().Error("%s\n", str.c_str());
159
throw Py::Exception(Base::PyExc_FC_GeneralError, str);
161
catch (const Base::Exception &e) {
163
str += "FreeCAD exception thrown (";
167
throw Py::RuntimeError(str);
169
catch (const std::exception &e) {
171
str += "C++ exception thrown (";
174
Base::Console().Error("%s\n", str.c_str());
175
throw Py::RuntimeError(str);
179
Py::Object loftOnCurve(const Py::Tuple& args)
181
Part::TopoShapePy *pcObject;
182
PyObject *pcTopoObj,*pcListObj;
183
float x=0.0f,y=0.0f,z=1.0f,size = 0.1f;
185
if (!PyArg_ParseTuple(args.ptr(), "O!O(fff)f", &(Part::TopoShapePy::Type), &pcTopoObj,&pcListObj,&x,&y,&z,&size))
186
// if (!PyArg_ParseTuple(args, "O!O!", &(App::TopoShapePy::Type), &pcTopoObj,&PyList_Type,&pcListObj,x,y,z,size))
187
throw Py::Exception();
189
pcObject = static_cast<Part::TopoShapePy*>(pcTopoObj);
190
MeshCore::MeshKernel M;
192
std::vector<Base::Vector3f> poly;
193
auto exText( "List of Tuples of three or two floats needed as second parameter!" );
195
if (!PyList_Check(pcListObj))
196
throw Py::TypeError(exText);
198
int nSize = PyList_Size(pcListObj);
199
for (int i=0; i<nSize;++i) {
200
PyObject* item = PyList_GetItem(pcListObj, i);
201
if (!PyTuple_Check(item))
202
throw Py::TypeError(exText);
204
int nTSize = PyTuple_Size(item);
205
if (nTSize != 2 && nTSize != 3)
206
throw Py::ValueError(exText);
208
Base::Vector3f vec(0,0,0);
210
for(int l = 0; l < nTSize;l++) {
211
PyObject* item2 = PyTuple_GetItem(item, l);
212
if (!PyFloat_Check(item2))
213
throw Py::TypeError(exText);
214
vec[l] = (float)PyFloat_AS_DOUBLE(item2);
219
TopoDS_Shape aShape = pcObject->getTopoShapePtr()->getShape();
221
MeshPart::MeshAlgos::LoftOnCurve(M,aShape,poly,Base::Vector3f(x,y,z),size);
222
return Py::asObject(new Mesh::MeshPy(new Mesh::MeshObject(M)));
224
Py::Object findSectionParameters(const Py::Tuple& args)
227
if (!PyArg_ParseTuple(args.ptr(), "O!O!O!", &(Part::TopoShapeEdgePy::Type), &e,
228
&(Mesh::MeshPy::Type), &m,
229
&(Base::VectorPy::Type),&v))
230
throw Py::Exception();
232
TopoDS_Shape shape = static_cast<Part::TopoShapePy*>(e)->getTopoShapePtr()->getShape();
233
const Mesh::MeshObject* mesh = static_cast<Mesh::MeshPy*>(m)->getMeshObjectPtr();
234
MeshCore::MeshKernel kernel(mesh->getKernel());
235
kernel.Transform(mesh->getTransform());
236
Base::Vector3d* vec = static_cast<Base::VectorPy*>(v)->getVectorPtr();
237
Base::Vector3f dir = Base::convertTo<Base::Vector3f>(*vec);
239
MeshProjection proj(kernel);
240
std::set<double> parameters;
241
proj.findSectionParameters(TopoDS::Edge(shape), dir, parameters);
244
for (auto it : parameters) {
251
Py::Object projectShapeOnMesh(const Py::Tuple& args, const Py::Dict& kwds)
253
static const std::array<const char *, 4> kwds_maxdist{"Shape", "Mesh", "MaxDistance", nullptr};
256
if (Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
257
"O!O!d", kwds_maxdist,
258
&Part::TopoShapePy::Type, &s,
259
&Mesh::MeshPy::Type, &m,
261
TopoDS_Shape shape = static_cast<Part::TopoShapePy*>(s)->getTopoShapePtr()->getShape();
262
const Mesh::MeshObject* mesh = static_cast<Mesh::MeshPy*>(m)->getMeshObjectPtr();
263
MeshCore::MeshKernel kernel(mesh->getKernel());
264
kernel.Transform(mesh->getTransform());
266
MeshProjection proj(kernel);
267
std::vector<MeshProjection::PolyLine> polylines;
268
proj.projectToMesh(shape, maxDist, polylines);
271
for (const auto& it : polylines) {
273
for (auto jt : it.points) {
283
static const std::array<const char *, 4> kwds_dir {"Shape", "Mesh", "Direction", nullptr};
286
if (Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
288
&Part::TopoShapePy::Type, &s,
289
&Mesh::MeshPy::Type, &m,
290
&Base::VectorPy::Type, &v)) {
291
TopoDS_Shape shape = static_cast<Part::TopoShapePy*>(s)->getTopoShapePtr()->getShape();
292
const Mesh::MeshObject* mesh = static_cast<Mesh::MeshPy*>(m)->getMeshObjectPtr();
293
Base::Vector3d* vec = static_cast<Base::VectorPy*>(v)->getVectorPtr();
294
Base::Vector3f dir = Base::convertTo<Base::Vector3f>(*vec);
296
MeshCore::MeshKernel kernel(mesh->getKernel());
297
kernel.Transform(mesh->getTransform());
299
MeshProjection proj(kernel);
300
std::vector<MeshProjection::PolyLine> polylines;
301
proj.projectParallelToMesh(shape, dir, polylines);
303
for (const auto& it : polylines) {
305
for (auto jt : it.points) {
315
static const std::array<const char *, 4> kwds_poly {"Polygons", "Mesh", "Direction", nullptr};
318
if (Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
321
&Mesh::MeshPy::Type, &m,
322
&Base::VectorPy::Type, &v)) {
323
std::vector<MeshProjection::PolyLine> polylinesIn;
324
Py::Sequence edges(seq);
325
polylinesIn.reserve(edges.size());
327
// collect list of sampled input edges
328
for (Py::Sequence::iterator it = edges.begin(); it != edges.end(); ++it) {
329
Py::Sequence edge(*it);
330
MeshProjection::PolyLine poly;
331
poly.points.reserve(edge.size());
333
for (Py::Sequence::iterator jt = edge.begin(); jt != edge.end(); ++jt) {
335
poly.points.push_back(Base::convertTo<Base::Vector3f>(pnt.toVector()));
338
polylinesIn.push_back(poly);
341
const Mesh::MeshObject* mesh = static_cast<Mesh::MeshPy*>(m)->getMeshObjectPtr();
342
Base::Vector3d* vec = static_cast<Base::VectorPy*>(v)->getVectorPtr();
343
Base::Vector3f dir = Base::convertTo<Base::Vector3f>(*vec);
345
MeshCore::MeshKernel kernel(mesh->getKernel());
346
kernel.Transform(mesh->getTransform());
348
MeshProjection proj(kernel);
349
std::vector<MeshProjection::PolyLine> polylines;
350
proj.projectParallelToMesh(polylinesIn, dir, polylines);
353
for (const auto& it : polylines) {
355
for (auto jt : it.points) {
365
throw Py::TypeError("Expected arguments are:\n"
366
"Shape, Mesh, float or\n"
367
"Shape, Mesh, Vector or\n"
368
"Polygons, Mesh, Vector\n");
370
Py::Object projectPointsOnMesh(const Py::Tuple& args)
372
PyObject *seq, *m, *v;
373
double precision = -1;
374
if (PyArg_ParseTuple(args.ptr(), "OO!O!|d",
376
&Mesh::MeshPy::Type, &m,
377
&Base::VectorPy::Type, &v,
379
std::vector<Base::Vector3f> pointsIn;
380
Py::Sequence points(seq);
381
pointsIn.reserve(points.size());
383
// collect list of input points
384
for (Py::Sequence::iterator it = points.begin(); it != points.end(); ++it) {
386
pointsIn.push_back(Base::convertTo<Base::Vector3f>(pnt.toVector()));
389
const Mesh::MeshObject* mesh = static_cast<Mesh::MeshPy*>(m)->getMeshObjectPtr();
390
Base::Vector3d* vec = static_cast<Base::VectorPy*>(v)->getVectorPtr();
391
Base::Vector3f dir = Base::convertTo<Base::Vector3f>(*vec);
393
MeshCore::MeshKernel kernel(mesh->getKernel());
394
kernel.Transform(mesh->getTransform());
396
MeshProjection proj(kernel);
397
std::vector<Base::Vector3f> pointsOut;
398
proj.projectOnMesh(pointsIn, dir, static_cast<float>(precision), pointsOut);
401
for (auto it : pointsOut) {
409
throw Py::Exception();
411
Py::Object wireFromSegment(const Py::Tuple& args)
414
if (!PyArg_ParseTuple(args.ptr(), "O!O!", &(Mesh::MeshPy::Type), &m,&PyList_Type,&o))
415
throw Py::Exception();
418
Mesh::MeshObject* mesh = static_cast<Mesh::MeshPy*>(m)->getMeshObjectPtr();
419
std::vector<MeshCore::FacetIndex> segm;
420
segm.reserve(list.size());
421
for (Py_ssize_t i=0; i<list.size(); i++) {
422
segm.push_back((long)Py::Long(list[i]));
425
std::list<std::vector<Base::Vector3f> > bounds;
426
MeshCore::MeshAlgorithm algo(mesh->getKernel());
427
algo.GetFacetBorders(segm, bounds);
430
std::list<std::vector<Base::Vector3f> >::iterator bt;
432
for (bt = bounds.begin(); bt != bounds.end(); ++bt) {
433
BRepBuilderAPI_MakePolygon mkPoly;
434
for (std::vector<Base::Vector3f>::reverse_iterator it = bt->rbegin(); it != bt->rend(); ++it) {
435
mkPoly.Add(gp_Pnt(it->x,it->y,it->z));
437
if (mkPoly.IsDone()) {
438
PyObject* wire = new Part::TopoShapeWirePy(new Part::TopoShape(mkPoly.Wire()));
439
wires.append(Py::Object(wire, true));
445
Py::Object wireFromMesh(const Py::Tuple& args)
448
if (!PyArg_ParseTuple(args.ptr(), "O!", &(Mesh::MeshPy::Type), &m))
449
throw Py::Exception();
451
Mesh::MeshObject* mesh = static_cast<Mesh::MeshPy*>(m)->getMeshObjectPtr();
453
std::list<std::vector<Base::Vector3f> > bounds;
454
MeshCore::MeshAlgorithm algo(mesh->getKernel());
455
algo.GetMeshBorders(bounds);
458
std::list<std::vector<Base::Vector3f> >::iterator bt;
460
for (bt = bounds.begin(); bt != bounds.end(); ++bt) {
461
BRepBuilderAPI_MakePolygon mkPoly;
462
for (std::vector<Base::Vector3f>::reverse_iterator it = bt->rbegin(); it != bt->rend(); ++it) {
463
mkPoly.Add(gp_Pnt(it->x,it->y,it->z));
465
if (mkPoly.IsDone()) {
466
PyObject* wire = new Part::TopoShapeWirePy(new Part::TopoShape(mkPoly.Wire()));
467
wires.append(Py::Object(wire, true));
473
Py::Object meshFromShape(const Py::Tuple& args, const Py::Dict& kwds)
477
auto runMesher = [](const MeshPart::Mesher& mesher) {
478
Mesh::MeshObject* mesh;
480
Base::PyGILStateRelease releaser{};
481
mesh = mesher.createMesh();
483
return Py::asObject(new Mesh::MeshPy(mesh));
486
static const std::array<const char *, 7> kwds_lindeflection{"Shape", "LinearDeflection", "AngularDeflection",
487
"Relative", "Segments", "GroupColors", nullptr};
489
double lindeflection=0;
490
double angdeflection=0.5;
491
PyObject* relative = Py_False;
492
PyObject* segment = Py_False;
493
PyObject* groupColors = nullptr;
494
if (Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d|dO!O!O", kwds_lindeflection,
495
&(Part::TopoShapePy::Type), &shape, &lindeflection,
496
&angdeflection, &(PyBool_Type), &relative,
497
&(PyBool_Type), &segment, &groupColors)) {
498
MeshPart::Mesher mesher(static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
499
mesher.setMethod(MeshPart::Mesher::Standard);
500
mesher.setDeflection(lindeflection);
501
mesher.setAngularDeflection(angdeflection);
502
mesher.setRegular(true);
503
mesher.setRelative(Base::asBoolean(relative));
504
mesher.setSegments(Base::asBoolean(segment));
506
Py::Sequence list(groupColors);
507
std::vector<uint32_t> colors;
508
colors.reserve(list.size());
509
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
514
App::Color c(static_cast<float>(r),
515
static_cast<float>(g),
516
static_cast<float>(b));
517
colors.push_back(c.getPackedValue());
519
mesher.setColors(colors);
521
return runMesher(mesher);
524
static const std::array<const char *, 3> kwds_maxLength{"Shape", "MaxLength", nullptr};
527
if (Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d", kwds_maxLength,
528
&(Part::TopoShapePy::Type), &shape, &maxLength)) {
529
MeshPart::Mesher mesher(static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
530
mesher.setMethod(MeshPart::Mesher::Mefisto);
531
mesher.setMaxLength(maxLength);
532
mesher.setRegular(true);
533
return runMesher(mesher);
536
static const std::array<const char *, 3> kwds_maxArea{"Shape", "MaxArea", nullptr};
539
if (Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d", kwds_maxArea,
540
&(Part::TopoShapePy::Type), &shape, &maxArea)) {
541
MeshPart::Mesher mesher(static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
542
mesher.setMethod(MeshPart::Mesher::Mefisto);
543
mesher.setMaxArea(maxArea);
544
mesher.setRegular(true);
545
return runMesher(mesher);
548
static const std::array<const char *, 3> kwds_localLen{"Shape", "LocalLength", nullptr};
551
if (Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d", kwds_localLen,
552
&(Part::TopoShapePy::Type), &shape, &localLen)) {
553
MeshPart::Mesher mesher(static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
554
mesher.setMethod(MeshPart::Mesher::Mefisto);
555
mesher.setLocalLength(localLen);
556
mesher.setRegular(true);
557
return runMesher(mesher);
560
static const std::array<const char *, 3> kwds_deflection{"Shape", "Deflection", nullptr};
563
if (Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d", kwds_deflection,
564
&(Part::TopoShapePy::Type), &shape, &deflection)) {
565
MeshPart::Mesher mesher(static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
566
mesher.setMethod(MeshPart::Mesher::Mefisto);
567
mesher.setDeflection(deflection);
568
mesher.setRegular(true);
569
return runMesher(mesher);
572
static const std::array<const char *, 4> kwds_minmaxLen{"Shape", "MinLength", "MaxLength", nullptr};
574
double minLen=0, maxLen=0;
575
if (Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!dd", kwds_minmaxLen,
576
&(Part::TopoShapePy::Type), &shape, &minLen, &maxLen)) {
577
MeshPart::Mesher mesher(static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
578
mesher.setMethod(MeshPart::Mesher::Mefisto);
579
mesher.setMinMaxLengths(minLen, maxLen);
580
mesher.setRegular(true);
581
return runMesher(mesher);
584
static const std::array<const char *, 8> kwds_fineness{"Shape", "Fineness", "SecondOrder", "Optimize",
585
"AllowQuad", "MinLength", "MaxLength", nullptr};
587
int fineness=0, secondOrder=0, optimize=1, allowquad=0;
588
if (Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!i|iiidd", kwds_fineness,
589
&(Part::TopoShapePy::Type), &shape, &fineness,
590
&secondOrder, &optimize, &allowquad, &minLen, &maxLen)) {
591
#if defined (HAVE_NETGEN)
592
MeshPart::Mesher mesher(static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
593
mesher.setMethod(MeshPart::Mesher::Netgen);
594
mesher.setFineness(fineness);
595
mesher.setSecondOrder(secondOrder != 0);
596
mesher.setOptimize(optimize != 0);
597
mesher.setQuadAllowed(allowquad != 0);
598
mesher.setMinMaxLengths(minLen, maxLen);
599
return runMesher(mesher);
601
throw Py::RuntimeError("SMESH was built without NETGEN support");
605
static const std::array<const char *, 10> kwds_user{"Shape", "GrowthRate", "SegPerEdge", "SegPerRadius",
606
"SecondOrder", "Optimize", "AllowQuad", "MinLength",
607
"MaxLength", nullptr};
609
double growthRate=0, nbSegPerEdge=0, nbSegPerRadius=0;
610
if (Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!|dddiiidd", kwds_user,
611
&(Part::TopoShapePy::Type), &shape,
612
&growthRate, &nbSegPerEdge, &nbSegPerRadius,
613
&secondOrder, &optimize, &allowquad, &minLen, &maxLen)) {
614
#if defined (HAVE_NETGEN)
615
MeshPart::Mesher mesher(static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
616
mesher.setMethod(MeshPart::Mesher::Netgen);
617
mesher.setGrowthRate(growthRate);
618
mesher.setNbSegPerEdge(nbSegPerEdge);
619
mesher.setNbSegPerRadius(nbSegPerRadius);
620
mesher.setSecondOrder(secondOrder != 0);
621
mesher.setOptimize(optimize != 0);
622
mesher.setQuadAllowed(allowquad != 0);
623
mesher.setMinMaxLengths(minLen, maxLen);
624
return runMesher(mesher);
626
throw Py::RuntimeError("SMESH was built without NETGEN support");
631
if (PyArg_ParseTuple(args.ptr(), "O!", &(Part::TopoShapePy::Type), &shape)) {
632
MeshPart::Mesher mesher(static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->getShape());
633
#if defined (HAVE_NETGEN)
634
mesher.setMethod(MeshPart::Mesher::Netgen);
636
mesher.setMethod(MeshPart::Mesher::Mefisto);
637
mesher.setRegular(true);
639
return runMesher(mesher);
642
throw Py::TypeError("Wrong arguments");
646
PyObject* initModule()
648
return Base::Interpreter().addModule(new Module);
651
} // namespace MeshPart