add methods firstVertex and lastVertex to TopoEdge

This commit is contained in:
wmayer
2017-04-04 10:05:46 +02:00
parent d27bb9955e
commit 59682f31a7
2 changed files with 40 additions and 1 deletions

View File

@@ -69,7 +69,25 @@
<UserDocu>Set the tolerance for the edge.</UserDocu>
</Documentation>
</Methode>
<Methode Name="discretize" Const="true" Keyword="true">
<Methode Name="firstVertex">
<Documentation>
<UserDocu>Vertex = firstVertex(Orientation=False)
Returns the Vertex of orientation FORWARD in this edge.
If there is none a Null shape is returned.
Orientation = True : taking into account the edge orientation
</UserDocu>
</Documentation>
</Methode>
<Methode Name="lastVertex">
<Documentation>
<UserDocu>Vertex = lastVertex(Orientation=False)
Returns the Vertex of orientation REVERSED in this edge.
If there is none a Null shape is returned.
Orientation = True : taking into account the edge orientation
</UserDocu>
</Documentation>
</Methode>
<Methode Name="discretize" Const="true" Keyword="true">
<Documentation>
<UserDocu>Discretizes the edge and returns a list of points.
The function accepts keywords as argument:

View File

@@ -49,6 +49,7 @@
# include <gp_Hypr.hxx>
# include <gp_Parab.hxx>
# include <gp_Lin.hxx>
# include <TopExp.hxx>
# include <TopoDS.hxx>
# include <TopoDS_Shape.hxx>
# include <TopoDS_Edge.hxx>
@@ -668,6 +669,26 @@ PyObject* TopoShapeEdgePy::setTolerance(PyObject *args)
Py_Return;
}
PyObject* TopoShapeEdgePy::firstVertex(PyObject *args)
{
PyObject* orient = Py_False;
if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &orient))
return 0;
const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape());
TopoDS_Vertex v = TopExp::FirstVertex(e, PyObject_IsTrue(orient) ? Standard_True : Standard_False);
return new TopoShapeVertexPy(new TopoShape(v));
}
PyObject* TopoShapeEdgePy::lastVertex(PyObject *args)
{
PyObject* orient = Py_False;
if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &orient))
return 0;
const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape());
TopoDS_Vertex v = TopExp::LastVertex(e, PyObject_IsTrue(orient) ? Standard_True : Standard_False);
return new TopoShapeVertexPy(new TopoShape(v));
}
// ====== Attributes ======================================================================
Py::Float TopoShapeEdgePy::getTolerance(void) const