try to fix tolerance if shape is broken after fillet/chamfer operation

This commit is contained in:
wmayer
2017-07-24 12:29:46 +02:00
parent dce81a6038
commit 91cc8a4817
2 changed files with 24 additions and 6 deletions

View File

@@ -32,7 +32,9 @@
# include <TopTools_IndexedMapOfShape.hxx>
# include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
# include <TopTools_ListOfShape.hxx>
#include <BRep_Tool.hxx>
# include <BRep_Tool.hxx>
# include <ShapeFix_Shape.hxx>
# include <ShapeFix_ShapeTolerance.hxx>
#endif
#include <Base/Console.h>
@@ -112,7 +114,14 @@ App::DocumentObjectExecReturn *Chamfer::execute(void)
TopTools_ListOfShape aLarg;
aLarg.Append(baseShape.getShape());
if (!BRepAlgo::IsValid(aLarg, shape, Standard_False, Standard_False)) {
return new App::DocumentObjectExecReturn("Resulting shape is invalid");
ShapeFix_ShapeTolerance aSFT;
aSFT.LimitTolerance(shape, Precision::Confusion(), Precision::Confusion(), TopAbs_SHAPE);
Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(shape);
aSfs->Perform();
shape = aSfs->Shape();
if (!BRepAlgo::IsValid(aLarg, shape, Standard_False, Standard_False)) {
return new App::DocumentObjectExecReturn("Resulting shape is invalid");
}
}
this->Shape.setValue(getSolid(shape));

View File

@@ -29,9 +29,11 @@
# include <TopoDS.hxx>
# include <TopoDS_Edge.hxx>
# include <TopTools_ListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
# include <TopTools_IndexedMapOfShape.hxx>
# include <TopExp.hxx>
# include <BRep_Tool.hxx>
# include <ShapeFix_Shape.hxx>
# include <ShapeFix_ShapeTolerance.hxx>
#endif
#include <Base/Console.h>
@@ -106,7 +108,14 @@ App::DocumentObjectExecReturn *Fillet::execute(void)
TopTools_ListOfShape aLarg;
aLarg.Append(baseShape.getShape());
if (!BRepAlgo::IsValid(aLarg, shape, Standard_False, Standard_False)) {
return new App::DocumentObjectExecReturn("Resulting shape is invalid");
ShapeFix_ShapeTolerance aSFT;
aSFT.LimitTolerance(shape, Precision::Confusion(), Precision::Confusion(), TopAbs_SHAPE);
Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(shape);
aSfs->Perform();
shape = aSfs->Shape();
if (!BRepAlgo::IsValid(aLarg, shape, Standard_False, Standard_False)) {
return new App::DocumentObjectExecReturn("Resulting shape is invalid");
}
}
this->Shape.setValue(getSolid(shape));