]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1515: Fixed face with hole creation.
authordbv <dbv@opencascade.com>
Mon, 30 May 2016 15:58:44 +0000 (18:58 +0300)
committerdbv <dbv@opencascade.com>
Mon, 30 May 2016 15:59:08 +0000 (18:59 +0300)
src/BuildPlugin/BuildPlugin_Face.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h

index 14314ddbaaa2e77f71989bcef38dac407d780bf4..fddd223f053a505c2d48cb5b063e7b2a70dbb38f 100644 (file)
@@ -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.
index 476f15214f38d76d8dbe5d514ad35f0175dea685..fd16671cfcfe941a3881485a93739b894e30e0a3 100644 (file)
@@ -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);
index 6d00e70eb12ffcec29d75d6c92fba6d2ef9f3a78..21530babb2dd0694624728d1e0616285b98b8cb3 100644 (file)
@@ -25,6 +25,7 @@
 #include <BRepCheck_Analyzer.hxx>
 #include <BRepExtrema_DistShapeShape.hxx>
 #include <BRepGProp.hxx>
+#include <BRepTools.hxx>
 #include <BRepTopAdaptor_FClass2d.hxx>
 #include <Geom_Curve.hxx>
 #include <Geom2d_Curve.hxx>
@@ -614,4 +615,22 @@ bool GeomAlgoAPI_ShapeTools::isShapeValid(const std::shared_ptr<GeomAPI_Shape> t
 
   BRepCheck_Analyzer aChecker(theShape->impl<TopoDS_Shape>());
   return (aChecker.IsValid() == Standard_True);
-}
\ No newline at end of file
+}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeTools::getFaceOuterWire(const std::shared_ptr<GeomAPI_Shape> theFace)
+{
+  GeomShapePtr anOuterWire;
+
+  if(!theFace.get() || !theFace->isFace()) {
+    return anOuterWire;
+  }
+
+  TopoDS_Face aFace = TopoDS::Face(theFace->impl<TopoDS_Shape>());
+  TopoDS_Wire aWire = BRepTools::OuterWire(aFace);
+
+  anOuterWire.reset(new GeomAPI_Shape());
+  anOuterWire->setImpl(new TopoDS_Shape(aWire));
+
+  return anOuterWire;
+}
index 8df74080a76f06a7c83d88a0e283d85010a287d9..bc02ecb92b9c25160fcf384cc2309376bec1545b 100644 (file)
@@ -94,6 +94,9 @@ public:
   /// \return true if theShape is valid.
   GEOMALGOAPI_EXPORT static bool isShapeValid(const std::shared_ptr<GeomAPI_Shape> theShape);
 
+  /// \return outer wire for face. If theShape has different type returns empty pointer.
+  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> getFaceOuterWire(const std::shared_ptr<GeomAPI_Shape> theFace);
+
 };
 
 #endif