Fix pb with 'make test' (complex_objs_ex06.py script): a regression has been introduced with implementation of issue 0022745

This commit is contained in:
vsr 2015-02-05 13:57:09 +03:00
parent 189cfead74
commit 3150ecbf3b
2 changed files with 23 additions and 36 deletions

View File

@ -450,26 +450,19 @@ Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing* theHI,
{
Standard_Real aTol = theHI->GetTolerance();
TopoDS_Compound faceCompound;
TopoDS_Compound aCompound;
BRep_Builder builder;
builder.MakeCompound( faceCompound );
builder.MakeCompound( aCompound );
TopExp_Explorer faceExp( theOriginalShape, TopAbs_FACE );
for ( ; faceExp.More(); faceExp.Next() )
builder.Add( faceCompound, faceExp.Current() );
builder.Add( aCompound, theOriginalShape );
Handle(TColStd_HSequenceOfTransient) otherObjs = theHI->GetShapes();
for ( int ind = 1; ind <= otherObjs->Length(); ind++)
{
Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(otherObjs->Value(ind));
TopoDS_Shape aShape = aRefShape->GetValue();
if (aShape.IsNull())
Standard_NullObject::Raise("Null object given");
for ( faceExp.Init( aShape, TopAbs_FACE ); faceExp.More(); faceExp.Next() )
builder.Add( faceCompound, faceExp.Current() );
builder.Add( aCompound, aRefShape->GetValue() );
}
ShHealOper_Sewing aHealer (faceCompound, aTol);
ShHealOper_Sewing aHealer (aCompound, aTol);
// Set non-manifold mode.
aHealer.SetNonManifoldMode(isAllowNonManifold);

View File

@ -37,12 +37,26 @@
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_MapOfShape.hxx>
namespace
{
bool cmpNbSubShapes( const TopoDS_Shape& s1, const TopoDS_Shape& s2, TopAbs_ShapeEnum t)
{
int nbNew = 0, nbOld = 0;
TopExp_Explorer exp;
TopTools_MapOfShape shMap;
for ( exp.Init( s1, t ); exp.More(); exp.Next() ) if ( shMap.Add( exp.Current() ) ) ++nbNew;
shMap.Clear();
for ( exp.Init( s2, t ); exp.More(); exp.Next() ) if ( shMap.Add( exp.Current() ) ) ++nbOld;
return nbNew != nbOld;
}
}
//=======================================================================
//function : ShHealOper_Sewing()
//purpose : Constructor
//=======================================================================
ShHealOper_Sewing::ShHealOper_Sewing (const TopoDS_Shape& theShape,
const Standard_Real theTolerance)
{
@ -248,29 +262,9 @@ Standard_Boolean ShHealOper_Sewing::getModifications(const TopoDS_Shape& theShap
Standard_Boolean ShHealOper_Sewing::isSewed(const TopoDS_Shape& theShape) const
{
// Standard_Integer nbNewShells =0;
// Standard_Integer nbOldShells =0;
// TopExp_Explorer aExpShells(theShape,TopAbs_SHELL);
// for( ; aExpShells.More(); aExpShells.Next())
// nbNewShells++;
// for( aExpShells.Init(myInitShape,TopAbs_SHELL); aExpShells.More(); aExpShells.Next())
// nbOldShells++;
// return (nbNewShells != nbOldShells);
// EAP, 22745: [EDF] Improvement of Sewing operation
// now myInitShape is ALWAYS a compound of faces -> no shells
int nbNew = 0, nbOld = 0;
TopExp_Explorer exp;
for ( exp.Init( theShape, TopAbs_VERTEX ); exp.More(); exp.Next() ) ++nbNew;
for ( exp.Init( myInitShape, TopAbs_VERTEX ); exp.More(); exp.Next() ) ++nbOld;
if ( nbNew != nbOld )
return true;
for ( exp.Init( theShape, TopAbs_EDGE ); exp.More(); exp.Next() ) ++nbNew;
for ( exp.Init( myInitShape, TopAbs_EDGE ); exp.More(); exp.Next() ) ++nbOld;
if ( nbNew != nbOld )
return true;
return false;
return cmpNbSubShapes( theShape, myInitShape, TopAbs_SHELL ) ||
cmpNbSubShapes( theShape, myInitShape, TopAbs_EDGE ) ||
cmpNbSubShapes( theShape, myInitShape, TopAbs_VERTEX );
}
//=======================================================================