Bug 20423: fix Same Parameter after the chamfer operation.

This commit is contained in:
jfa 2009-09-18 09:34:25 +00:00
parent 52739f4c69
commit 1ba0a9935e

View File

@ -18,20 +18,25 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx>
#include <GEOMImpl_ChamferDriver.hxx>
#include <GEOMImpl_IChamfer.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_ILocalOperations.hxx>
#include <GEOM_Function.hxx>
#include <GEOMImpl_Block6Explorer.hxx>
#include <GEOM_Function.hxx>
#include <BRepLib.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <BRepFilletAPI_MakeChamfer.hxx>
#include <ShapeFix_Shape.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
#include <TopAbs.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
@ -133,7 +138,8 @@ Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const
M.FindFromIndex(i).Extent() == 2)
fill.Add(aD, E, F);
}
}else if (aType == CHAMFER_SHAPE_EDGE || aType == CHAMFER_SHAPE_EDGE_AD) {
}
else if (aType == CHAMFER_SHAPE_EDGE || aType == CHAMFER_SHAPE_EDGE_AD) {
// chamfer on edges, common to two faces, with D1 on the first face
TopoDS_Shape aFace1, aFace2;
@ -197,6 +203,7 @@ Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const
if (!BRepTools::IsReallyClosed(E, F) &&
!BRep_Tool::Degenerated(E) &&
M.FindFromKey(E).Extent() == 2)
{
if (aType == CHAMFER_SHAPE_FACES)
{
double aD1 = aCI.GetD1();
@ -215,7 +222,8 @@ Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const
}
}
}
else if (aType == CHAMFER_SHAPE_EDGES || aType == CHAMFER_SHAPE_EDGES_AD)
}
else if (aType == CHAMFER_SHAPE_EDGES || aType == CHAMFER_SHAPE_EDGES_AD)
{
// chamfer on selected edges with lenght param D1 & D2.
@ -259,6 +267,17 @@ else if (aType == CHAMFER_SHAPE_EDGES || aType == CHAMFER_SHAPE_EDGES_AD)
if (aShape.IsNull()) return 0;
// reduce tolerances
ShapeFix_ShapeTolerance aSFT;
aSFT.LimitTolerance(aShape, Precision::Confusion(),
Precision::Confusion(), TopAbs_SHAPE);
Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
aSfs->Perform();
aShape = aSfs->Shape();
// fix SameParameter flag
BRepLib::SameParameter(aShape, 1.E-5, Standard_True);
aFunction->SetValue(aShape);
log.SetTouched(Label());
@ -306,5 +325,5 @@ const Handle(GEOMImpl_ChamferDriver) Handle(GEOMImpl_ChamferDriver)::DownCast(co
}
}
return _anOtherObject ;
return _anOtherObject;
}