0022743: EDF GEOM: Regression in MakePipeTShapeChamfer: Some faces are missing in a GetShapesOnCylinder result

This commit is contained in:
vsr 2014-12-08 11:57:28 +03:00
parent 4b06093853
commit fc58f61296
5 changed files with 46 additions and 18 deletions

View File

@ -45,6 +45,26 @@
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
// VSR 08/12/2014: debug PipeTShape function
// Uncomment the macro below to correct tolerance of resulting face after creating fillet
#define FIX_FACE_TOLERANCE
namespace
{
bool FixShape( TopoDS_Shape& shape,
TopAbs_ShapeEnum type = TopAbs_SHAPE,
Standard_Real tolerance = Precision::Confusion() )
{
ShapeFix_ShapeTolerance aSFT;
aSFT.LimitTolerance( shape, tolerance, tolerance, type );
Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape( shape );
aSfs->Perform();
shape = aSfs->Shape();
BRepCheck_Analyzer ana( shape, false );
return ana.IsValid();
}
}
//======================================================================= //=======================================================================
//function : GetID //function : GetID
//purpose : //purpose :
@ -135,20 +155,16 @@ Standard_Integer GEOMImpl_FilletDriver::Execute(TFunction_Logbook& log) const
if (aShape.IsNull()) return 0; if (aShape.IsNull()) return 0;
#ifdef FIX_FACE_TOLERANCE
bool isOk = FixShape(aShape, TopAbs_FACE);
#else
// Check shape validity // Check shape validity
BRepCheck_Analyzer ana (aShape, false); BRepCheck_Analyzer ana(aShape, false);
if (!ana.IsValid()) { // 08.07.2008 added by skl during fixing bug 19761 from Mantis
// 08.07.2008 added by skl during fixing bug 19761 from Mantis bool isOk = ana.IsValid() || FixShape(aShape);
ShapeFix_ShapeTolerance aSFT; #endif
aSFT.LimitTolerance(aShape, Precision::Confusion(), if ( !isOk )
Precision::Confusion(), TopAbs_SHAPE); StdFail_NotDone::Raise("Fillet algorithm have produced an invalid shape result");
Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
aSfs->Perform();
aShape = aSfs->Shape();
ana.Init(aShape);
if (!ana.IsValid())
StdFail_NotDone::Raise("Fillet algorithm have produced an invalid shape result");
}
aFunction->SetValue(aShape); aFunction->SetValue(aShape);

View File

@ -541,6 +541,8 @@ void GEOMImpl_HealingDriver::LimitTolerance (GEOMImpl_IHealing* theHI,
TopoDS_Shape& theOutShape) const TopoDS_Shape& theOutShape) const
{ {
Standard_Real aTol = theHI->GetTolerance(); Standard_Real aTol = theHI->GetTolerance();
TopAbs_ShapeEnum aType = theHI->GetType();
if (aTol < Precision::Confusion()) if (aTol < Precision::Confusion())
aTol = Precision::Confusion(); aTol = Precision::Confusion();
@ -551,7 +553,7 @@ void GEOMImpl_HealingDriver::LimitTolerance (GEOMImpl_IHealing* theHI,
// 2. Limit tolerance. // 2. Limit tolerance.
ShapeFix_ShapeTolerance aSFT; ShapeFix_ShapeTolerance aSFT;
aSFT.LimitTolerance(aShapeCopy, aTol, aTol, TopAbs_SHAPE); aSFT.LimitTolerance(aShapeCopy, aTol, aTol, aType);
// 3. Fix obtained shape. // 3. Fix obtained shape.
Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy); Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy);
@ -902,6 +904,7 @@ GetCreationInformation(std::string& theOperationName,
theOperationName = "LIMIT_TOLERANCE"; theOperationName = "LIMIT_TOLERANCE";
AddParam( theParams, "Selected shape", aCI.GetOriginal() ); AddParam( theParams, "Selected shape", aCI.GetOriginal() );
AddParam( theParams, "Tolerance", aCI.GetTolerance() ); AddParam( theParams, "Tolerance", aCI.GetTolerance() );
AddParam( theParams, "Type", aCI.GetType() );
break; break;
case FUSE_COLLINEAR_EDGES: case FUSE_COLLINEAR_EDGES:
theOperationName = "FUSE_EDGES"; theOperationName = "FUSE_EDGES";

View File

@ -24,7 +24,8 @@
#include <TColStd_HArray1OfInteger.hxx> #include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfExtendedString.hxx> #include <TColStd_HArray1OfExtendedString.hxx>
#include "TColStd_HSequenceOfTransient.hxx" #include <TColStd_HSequenceOfTransient.hxx>
#include <TopAbs.hxx>
class GEOMImpl_IHealing class GEOMImpl_IHealing
{ {
@ -41,7 +42,8 @@ public:
ARG_DEV_EDGE_VALUE = 8, ARG_DEV_EDGE_VALUE = 8,
ARG_IS_BY_PARAMETER = 9, ARG_IS_BY_PARAMETER = 9,
ARG_SUBSHAPE_INDEX = 10, ARG_SUBSHAPE_INDEX = 10,
ARG_LIST_SHAPES = 11 ARG_LIST_SHAPES = 11,
ARG_TYPE = 12
}; };
GEOMImpl_IHealing(Handle(GEOM_Function) theFunction): _func(theFunction) {} GEOMImpl_IHealing(Handle(GEOM_Function) theFunction): _func(theFunction) {}
@ -73,6 +75,9 @@ public:
void SetTolerance( Standard_Real val ) { _func->SetReal(ARG_TOLERANCE, val); } void SetTolerance( Standard_Real val ) { _func->SetReal(ARG_TOLERANCE, val); }
Standard_Real GetTolerance() { return _func->GetReal(ARG_TOLERANCE); } Standard_Real GetTolerance() { return _func->GetReal(ARG_TOLERANCE); }
void SetType( TopAbs_ShapeEnum val ) { _func->SetInteger(ARG_TYPE, (Standard_Integer)val); }
TopAbs_ShapeEnum GetType() { TopAbs_ShapeEnum type = (TopAbs_ShapeEnum)(_func->GetInteger(ARG_TYPE)); return _func->IsDone() ? type : TopAbs_SHAPE; }
void SetDevideEdgeValue( Standard_Real val ) { _func->SetReal(ARG_DEV_EDGE_VALUE, val); } void SetDevideEdgeValue( Standard_Real val ) { _func->SetReal(ARG_DEV_EDGE_VALUE, val); }
Standard_Real GetDevideEdgeValue() { return _func->GetReal(ARG_DEV_EDGE_VALUE); } Standard_Real GetDevideEdgeValue() { return _func->GetReal(ARG_DEV_EDGE_VALUE); }

View File

@ -1056,7 +1056,8 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientationCopy (Handle(G
*/ */
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_IHealingOperations::LimitTolerance (Handle(GEOM_Object) theObject, Handle(GEOM_Object) GEOMImpl_IHealingOperations::LimitTolerance (Handle(GEOM_Object) theObject,
double theTolerance) double theTolerance,
TopAbs_ShapeEnum theType)
{ {
// Set error code, check parameters // Set error code, check parameters
SetErrorCode(KO); SetErrorCode(KO);
@ -1084,6 +1085,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::LimitTolerance (Handle(GEOM_Obj
GEOMImpl_IHealing HI (aFunction); GEOMImpl_IHealing HI (aFunction);
HI.SetOriginal(aLastFunction); HI.SetOriginal(aLastFunction);
HI.SetTolerance(theTolerance); HI.SetTolerance(theTolerance);
HI.SetType(theType);
// Compute // Compute
try { try {

View File

@ -27,6 +27,7 @@
#include "GEOM_Engine.hxx" #include "GEOM_Engine.hxx"
#include "GEOM_Object.hxx" #include "GEOM_Object.hxx"
#include <TopAbs.hxx>
#include <TColStd_HArray1OfExtendedString.hxx> #include <TColStd_HArray1OfExtendedString.hxx>
#include <TColStd_HArray1OfInteger.hxx> #include <TColStd_HArray1OfInteger.hxx>
@ -96,7 +97,8 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations {
Standard_EXPORT Handle(GEOM_Object) ChangeOrientationCopy( Handle(GEOM_Object) theObject); Standard_EXPORT Handle(GEOM_Object) ChangeOrientationCopy( Handle(GEOM_Object) theObject);
Standard_EXPORT Handle(GEOM_Object) LimitTolerance( Handle(GEOM_Object) theObject, Standard_EXPORT Handle(GEOM_Object) LimitTolerance( Handle(GEOM_Object) theObject,
double theTolerance ); double theTolerance,
TopAbs_ShapeEnum theType = TopAbs_SHAPE );
}; };