X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_Sewing.cpp;h=0375e399d335716f8b697369601d39ab87a76eed;hb=fc72d43b677baa05ae7fd317346fd8b723b799ed;hp=24fc81624b9355d7731cbc1a18da1af01c54a269;hpb=7de5c8e6406baa5fe74087a91ddb54b6d1754608;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp index 24fc81624..0375e399d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2023 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -29,10 +29,17 @@ //================================================================================================== GeomAlgoAPI_Sewing::GeomAlgoAPI_Sewing(const ListOfShape& theShapes) { + myBuildShell = true; build(theShapes); } -void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes) +GeomAlgoAPI_Sewing::GeomAlgoAPI_Sewing(const ListOfShape& theShapes, const bool theAllowNonManifold, const double theTolerance) +{ + myBuildShell = false; + build(theShapes, theAllowNonManifold, theTolerance); +} + +void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes, const bool theAllowNonManifold, const double theTolerance) { if(theShapes.empty()) { return; @@ -41,6 +48,14 @@ void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes) BRepBuilderAPI_Sewing* aSewingBuilder = new BRepBuilderAPI_Sewing(); this->setImpl(aSewingBuilder); + if (!myBuildShell) + { + aSewingBuilder->SetTolerance(theTolerance); + aSewingBuilder->SetFaceMode(Standard_True); + aSewingBuilder->SetFloatingEdgesMode(Standard_False); + aSewingBuilder->SetNonManifoldMode(theAllowNonManifold); + } + for(ListOfShape::const_iterator anIt = theShapes.cbegin(); anIt != theShapes.cend(); ++anIt) { const TopoDS_Shape& aShape = (*anIt)->impl(); aSewingBuilder->Add(aShape); @@ -49,27 +64,30 @@ void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes) aSewingBuilder->Perform(); TopoDS_Shape aResult = aSewingBuilder->SewedShape(); - BRep_Builder aBuilder; - if(aResult.ShapeType() == TopAbs_COMPOUND) { - TopoDS_Compound aResultCompound; - aBuilder.MakeCompound(aResultCompound); - for(TopoDS_Iterator anIt(aResult); anIt.More(); anIt.Next()) { - const TopoDS_Shape aSubShape = anIt.Value(); - if(aSubShape.ShapeType() == TopAbs_SHELL) { - aBuilder.Add(aResultCompound, aSubShape); - } else if (aSubShape.ShapeType() == TopAbs_FACE) { - TopoDS_Shell aShell; - aBuilder.MakeShell(aShell); - aBuilder.Add(aShell, aSubShape); - aBuilder.Add(aResultCompound, aShell); + if (myBuildShell) + { + BRep_Builder aBuilder; + if(aResult.ShapeType() == TopAbs_COMPOUND) { + TopoDS_Compound aResultCompound; + aBuilder.MakeCompound(aResultCompound); + for(TopoDS_Iterator anIt(aResult); anIt.More(); anIt.Next()) { + const TopoDS_Shape aSubShape = anIt.Value(); + if(aSubShape.ShapeType() == TopAbs_SHELL) { + aBuilder.Add(aResultCompound, aSubShape); + } else if (aSubShape.ShapeType() == TopAbs_FACE) { + TopoDS_Shell aShell; + aBuilder.MakeShell(aShell); + aBuilder.Add(aShell, aSubShape); + aBuilder.Add(aResultCompound, aShell); + } } + aResult = aResultCompound; + } else if(aResult.ShapeType() == TopAbs_FACE) { + TopoDS_Shell aShell; + aBuilder.MakeShell(aShell); + aBuilder.Add(aShell, aResult); + aResult = aShell; } - aResult = aResultCompound; - } else if(aResult.ShapeType() == TopAbs_FACE) { - TopoDS_Shell aShell; - aBuilder.MakeShell(aShell); - aBuilder.Add(aShell, aResult); - aResult = aShell; } std::shared_ptr aShape(new GeomAPI_Shape()); @@ -84,7 +102,6 @@ void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes) void GeomAlgoAPI_Sewing::modified(const std::shared_ptr theShape, ListOfShape& theHistory) { - static int anIndex = 0; if(!theShape.get()) { return; }