// 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.
#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>
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;
+}
/// \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