Salome HOME
updated copyright message
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Chamfer.cpp
index e0e24bcb204e28dd6fd51c834afb4de92cf3aabd..e482e088fc0ebac79dce57a849abab4591addcb9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2017-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -18,6 +18,7 @@
 //
 
 #include "GeomAlgoAPI_Chamfer.h"
+#include "GeomAlgoAPI_DFLoader.h"
 
 #include <BRep_Tool.hxx>
 #include <BRepFilletAPI_MakeChamfer.hxx>
@@ -49,13 +50,13 @@ void GeomAlgoAPI_Chamfer::build(const GeomShapePtr& theBaseSolid,
   TopoDS_Shape aShapeBase = theBaseSolid->impl<TopoDS_Shape>();
   TopTools_IndexedDataMapOfShapeListOfShape M;
   TopExp::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M);
+
   // create chamfer builder
   BRepFilletAPI_MakeChamfer* aChamferBuilder =
       new BRepFilletAPI_MakeChamfer(aShapeBase);
   setImpl(aChamferBuilder);
   setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
-  
+
   for (ListOfShape::const_iterator anIt = theChamferShapes.begin();
      anIt != theChamferShapes.end(); ++anIt) {
     if ((*anIt)->isEdge()) {
@@ -63,7 +64,7 @@ void GeomAlgoAPI_Chamfer::build(const GeomShapePtr& theBaseSolid,
       if (theMapEdgeFace.find(*anIt) != theMapEdgeFace.end()) {
         //TopoDS_Face F = (theMapEdgeFace[*anIt])->impl<TopoDS_Face>();
         TopoDS_Face F = (theMapEdgeFace.at(*anIt))->impl<TopoDS_Face>();
-        if (!BRepTools::IsReallyClosed(E,F) && !BRep_Tool::Degenerated(E) && 
+        if (!BRepTools::IsReallyClosed(E,F) && !BRep_Tool::Degenerated(E) &&
               M.FindFromKey(E).Extent() == 2) {
           if (performDistances) {
               aChamferBuilder->Add(theVal1, theVal2, E, F);
@@ -87,7 +88,7 @@ void GeomAlgoAPI_Chamfer::build(const GeomShapePtr& theBaseSolid,
   aChamferBuilder->Build();
   if (!aChamferBuilder->IsDone())
     return;
-  const TopoDS_Shape& aResult = aChamferBuilder->Shape();
+  TopoDS_Shape aResult = GeomAlgoAPI_DFLoader::refineResult(aChamferBuilder->Shape());
 
   std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
   aShape->setImpl(new TopoDS_Shape(aResult));