From: dbv Date: Mon, 30 May 2016 16:12:49 +0000 (+0300) Subject: Issue #1517: Fixed extra segments selected by Wire / Add contour X-Git-Tag: V_2.3.1~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c782d00ac4c46d04bd56a665fa843736c09b1151;p=modules%2Fshaper.git Issue #1517: Fixed extra segments selected by Wire / Add contour --- diff --git a/src/BuildPlugin/BuildPlugin_Wire.cpp b/src/BuildPlugin/BuildPlugin_Wire.cpp index 523c81a03..14d515894 100644 --- a/src/BuildPlugin/BuildPlugin_Wire.cpp +++ b/src/BuildPlugin/BuildPlugin_Wire.cpp @@ -149,28 +149,29 @@ bool BuildPlugin_Wire::addContour() std::shared_ptr anEdgeInList(new GeomAPI_Edge(aSelection->value())); ResultConstructionPtr aConstruction = std::dynamic_pointer_cast(aSelection->context()); - std::shared_ptr aPlanarEdges = std::dynamic_pointer_cast(aConstruction->shape()); - // Iterate on faces and add face with this edge. - std::shared_ptr aFoundFace; + // Iterate on wires and add wire with this edge. + std::shared_ptr aFoundWire; for(int anIndex = 0; anIndex < aConstruction->facesNum(); ++anIndex) { std::shared_ptr aFace = aConstruction->face(anIndex); - for(GeomAPI_ShapeExplorer anExp(aFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { - std::shared_ptr anEdgeOnFace(new GeomAPI_Edge(anExp.current())); - if(anEdgeInList->isEqual(anEdgeOnFace)) { - aFoundFace = aFace; - break; + for(GeomAPI_ShapeExplorer aWireExp(aFace, GeomAPI_Shape::WIRE); aWireExp.more(); aWireExp.next()) { + GeomShapePtr aWireOnFace = aWireExp.current(); + for(GeomAPI_ShapeExplorer anExp(aWireOnFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { + std::shared_ptr anEdgeOnFace(new GeomAPI_Edge(anExp.current())); + if(anEdgeInList->isEqual(anEdgeOnFace)) { + aFoundWire = aWireOnFace; + break; + } } } - - if(aFoundFace.get()) { + if(aFoundWire.get()) { break; } } - // If face with the same edge found. Add all other edges to list. - if(aFoundFace.get()) { - for(GeomAPI_ShapeExplorer anExp(aFoundFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { + // If wire with the same edge found. Add all other edges to list. + if(aFoundWire.get()) { + for(GeomAPI_ShapeExplorer anExp(aFoundWire, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { std::shared_ptr anEdgeOnFace(new GeomAPI_Edge(anExp.current())); ListOfShape::const_iterator anEdgesIt = anAddedEdges.cbegin(); for(; anEdgesIt != anAddedEdges.cend(); ++anEdgesIt) {