From: dbv Date: Mon, 30 May 2016 15:58:44 +0000 (+0300) Subject: Issue #1515: Fixed face with hole creation. X-Git-Tag: V_2.3.1~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eca73b85b6b9e96c4227b52566697d5f9ea4897c;p=modules%2Fshaper.git Issue #1515: Fixed face with hole creation. --- diff --git a/src/BuildPlugin/BuildPlugin_Face.cpp b/src/BuildPlugin/BuildPlugin_Face.cpp index 14314ddba..fddd223f0 100644 --- a/src/BuildPlugin/BuildPlugin_Face.cpp +++ b/src/BuildPlugin/BuildPlugin_Face.cpp @@ -65,9 +65,13 @@ void BuildPlugin_Face::execute() // Get wires from faces. ListOfShape aWires; for(ListOfShape::const_iterator anIt = aFaces.cbegin(); anIt != aFaces.cend(); ++anIt) { - for(GeomAPI_ShapeExplorer anExp(*anIt, GeomAPI_Shape::WIRE); anExp.more(); anExp.next()) { - aWires.push_back(anExp.current()); - } + aWires.push_back(GeomAlgoAPI_ShapeTools::getFaceOuterWire(*anIt)); + //for(GeomAPI_ShapeExplorer anExp(*anIt, GeomAPI_Shape::WIRE); anExp.more(); anExp.next()) { + // if(anExp.current()->orientation() == GeomAPI_Shape::REVERSED) { + // continue; + // } + // aWires.push_back(anExp.current()); + //} } // Make faces with holes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index 476f15214..fd16671cf 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -206,7 +206,7 @@ void FeaturesPlugin_CompositeSketch::getBaseShapes(ListOfShape& theBaseShapesLis } // Searching faces with common edges. - if(theIsMakeShells) { + if(theIsMakeShells && aBaseFacesList.size() > 1) { ListOfShape aShells; ListOfShape aFreeFaces; GeomShapePtr aFacesCompound = GeomAlgoAPI_CompoundBuilder::compound(aBaseFacesList); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index 6d00e70eb..21530babb 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -614,4 +615,22 @@ bool GeomAlgoAPI_ShapeTools::isShapeValid(const std::shared_ptr t BRepCheck_Analyzer aChecker(theShape->impl()); return (aChecker.IsValid() == Standard_True); -} \ No newline at end of file +} + +//================================================================================================== +std::shared_ptr GeomAlgoAPI_ShapeTools::getFaceOuterWire(const std::shared_ptr theFace) +{ + GeomShapePtr anOuterWire; + + if(!theFace.get() || !theFace->isFace()) { + return anOuterWire; + } + + TopoDS_Face aFace = TopoDS::Face(theFace->impl()); + TopoDS_Wire aWire = BRepTools::OuterWire(aFace); + + anOuterWire.reset(new GeomAPI_Shape()); + anOuterWire->setImpl(new TopoDS_Shape(aWire)); + + return anOuterWire; +} diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h index 8df74080a..bc02ecb92 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h @@ -94,6 +94,9 @@ public: /// \return true if theShape is valid. GEOMALGOAPI_EXPORT static bool isShapeValid(const std::shared_ptr theShape); + /// \return outer wire for face. If theShape has different type returns empty pointer. + GEOMALGOAPI_EXPORT static std::shared_ptr getFaceOuterWire(const std::shared_ptr theFace); + }; #endif