+ attribute Tolerance added to vertex, edge and face

+ method 'add' added to wire

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5401 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer
2012-01-12 12:09:45 +00:00
parent 148de30579
commit 5c23a97737
9 changed files with 113 additions and 16 deletions

View File

@@ -42,6 +42,7 @@
#include "BSplineCurvePy.h"
#include "TopoShape.h"
#include "TopoShapeShellPy.h"
#include "TopoShapeEdgePy.h"
#include "TopoShapeWirePy.h"
#include "TopoShapeWirePy.cpp"
@@ -135,6 +136,39 @@ int TopoShapeWirePy::PyInit(PyObject* args, PyObject* /*kwd*/)
return -1;
}
PyObject* TopoShapeWirePy::add(PyObject *args)
{
PyObject* edge;
if (!PyArg_ParseTuple(args, "O!",&(TopoShapePy::Type), &edge))
return 0;
const TopoDS_Wire& w = TopoDS::Wire(getTopoShapePtr()->_Shape);
BRepBuilderAPI_MakeWire mkWire(w);
const TopoDS_Shape& sh = static_cast<Part::TopoShapePy*>(edge)->getTopoShapePtr()->_Shape;
if (sh.IsNull()) {
PyErr_SetString(PyExc_TypeError, "given shape is invalid");
return 0;
}
if (sh.ShapeType() == TopAbs_EDGE)
mkWire.Add(TopoDS::Edge(sh));
else if (sh.ShapeType() == TopAbs_WIRE)
mkWire.Add(TopoDS::Wire(sh));
else {
PyErr_SetString(PyExc_TypeError, "shape is neither edge nor wire");
return 0;
}
try {
getTopoShapePtr()->_Shape = mkWire.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;