Skip to content

Commit

Permalink
fixes #3071: List of vertexes returned by wire.OrederedVertexes missi…
Browse files Browse the repository at this point in the history
…ng last vertext in the list
  • Loading branch information
wwmayer committed Sep 30, 2017
1 parent 53168d3 commit 62d98de
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/Mod/Part/App/TopoShapeWirePyImp.cpp
Expand Up @@ -32,6 +32,7 @@
# include <BRepTools_WireExplorer.hxx>
# include <Precision.hxx>
# include <ShapeFix_Wire.hxx>
# include <TopExp.hxx>
# include <TopoDS.hxx>
# include <TopoDS_Wire.hxx>
# include <gp_Ax1.hxx>
Expand Down Expand Up @@ -62,6 +63,11 @@

using namespace Part;

namespace Part {
extern Py::Object shape2pyshape(const TopoDS_Shape &shape);
}


// returns a string which represents the object e.g. when printed in python
std::string TopoShapeWirePy::representation(void) const
{
Expand Down Expand Up @@ -603,7 +609,7 @@ Py::List TopoShapeWirePy::getOrderedEdges(void) const

BRepTools_WireExplorer xp(TopoDS::Wire(getTopoShapePtr()->getShape()));
while (xp.More()) {
ret.append(Py::asObject(new TopoShapeEdgePy(new TopoShape(xp.Current()))));
ret.append(shape2pyshape(xp.Current()));
xp.Next();
}

Expand All @@ -614,12 +620,22 @@ Py::List TopoShapeWirePy::getOrderedVertexes(void) const
{
Py::List ret;

BRepTools_WireExplorer xp(TopoDS::Wire(getTopoShapePtr()->getShape()));
TopoDS_Wire wire = TopoDS::Wire(getTopoShapePtr()->getShape());
BRepTools_WireExplorer xp(wire);
while (xp.More()) {
ret.append(Py::asObject(new TopoShapeVertexPy(new TopoShape(xp.CurrentVertex()))));
ret.append(shape2pyshape(xp.CurrentVertex()));
xp.Next();
}

// special treatment for open wires
TopoDS_Vertex Vfirst, Vlast;
TopExp::Vertices(wire, Vfirst, Vlast);
if (!Vfirst.IsNull() && !Vlast.IsNull()) {
if (!Vfirst.IsSame(Vlast)) {
ret.append(shape2pyshape(Vlast));
}
}

return ret;
}

Expand Down

0 comments on commit 62d98de

Please sign in to comment.