+ add some repair functions for wires

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5404 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer
2012-01-12 21:31:14 +00:00
parent d8109df4c7
commit e4eb1cefe9
4 changed files with 87 additions and 0 deletions

View File

@@ -28,6 +28,8 @@
# include <BRepAdaptor_CompCurve.hxx>
# include <BRepBuilderAPI_MakeWire.hxx>
# include <BRepOffsetAPI_MakeOffset.hxx>
# include <Precision.hxx>
# include <ShapeFix_Wire.hxx>
# include <TopoDS.hxx>
# include <TopoDS_Wire.hxx>
# include <gp_Ax1.hxx>
@@ -42,6 +44,7 @@
#include "BSplineCurvePy.h"
#include "TopoShape.h"
#include "TopoShapeShellPy.h"
#include "TopoShapeFacePy.h"
#include "TopoShapeEdgePy.h"
#include "TopoShapeWirePy.h"
#include "TopoShapeWirePy.cpp"
@@ -169,6 +172,40 @@ PyObject* TopoShapeWirePy::add(PyObject *args)
}
}
PyObject* TopoShapeWirePy::fixWire(PyObject *args)
{
PyObject* face=0;
double tol = Precision::Confusion();
if (!PyArg_ParseTuple(args, "|O!d",&(TopoShapeFacePy::Type), &face, &tol))
return 0;
try {
ShapeFix_Wire aFix;
const TopoDS_Wire& w = TopoDS::Wire(getTopoShapePtr()->_Shape);
if (face) {
const TopoDS_Face& f = TopoDS::Face(static_cast<TopoShapePy*>(face)->getTopoShapePtr()->_Shape);
aFix.Init(w, f, tol);
}
else {
aFix.SetPrecision(tol);
aFix.Load(w);
}
aFix.FixReorder();
aFix.FixConnected();
aFix.FixClosed();
getTopoShapePtr()->_Shape = aFix.Wire();
Py_Return;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
return 0;
}
}
PyObject* TopoShapeWirePy::makeOffset(PyObject *args)
{
float dist;