0021514: EDF GEOM: Partition failure. A fix by PKV.

This commit is contained in:
jfa 2012-03-30 12:47:23 +00:00
parent 332a5b2f74
commit f43bdeb895

View File

@ -18,12 +18,10 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: NMTAlgo_WESCorrector.cxx // File: NMTAlgo_WESCorrector.cxx
// Created:
// Author: Peter KURNEV // Author: Peter KURNEV
// <pkv@irinox>
//
#include <GEOMAlgo_WESCorrector.hxx> #include <GEOMAlgo_WESCorrector.hxx>
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
@ -66,7 +64,7 @@ static
static static
Standard_Boolean IsToScale(const TopoDS_Face& aF, Standard_Boolean IsToScale(const TopoDS_Face& aF,
Standard_Real& aScale); Standard_Real& aScale);
//======================================================================= //=======================================================================
// function: // function:
@ -224,21 +222,17 @@ static
aER.Orientation(TopAbs_REVERSED); aER.Orientation(TopAbs_REVERSED);
aLEC.Append(aER); aLEC.Append(aER);
// //
bRegular=Standard_False; bRegular=Standard_False;
} }
else { else {
aLEC.Append(aER); aLEC.Append(aER);
} }
// //
if (bRegular) { if (bRegular) {
//modified by NIZNHY-PKV Wed Oct 20 14:45:52 2010f const TopoDS_Edge& aEx=*((TopoDS_Edge*)&aER);
const TopoDS_Edge& aEx=*((TopoDS_Edge*)&aER); if (!BRep_Tool::Degenerated(aEx)) {
if (!BRep_Tool::Degenerated(aEx)) { TopExp::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER);
TopExp::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER); }
}
//
//TopExp::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER);
//modified by NIZNHY-PKV Wed Oct 20 14:46:48 2010t
} }
}//for (j=1; j<=aNbC; ++j) { }//for (j=1; j<=aNbC; ++j) {
// //
@ -315,7 +309,7 @@ static
aWSC.Perform(); aWSC.Perform();
iErr=aWSC.ErrorStatus(); iErr=aWSC.ErrorStatus();
if (iErr) { if (iErr) {
return; return;
} }
// //
const TopoDS_Face& aFS=aWSC.FaceScaled(); const TopoDS_Face& aFS=aWSC.FaceScaled();
@ -327,31 +321,31 @@ static
aWS.Perform(); aWS.Perform();
iErr=aWS.ErrorStatus(); iErr=aWS.ErrorStatus();
if (iErr) { if (iErr) {
continue; continue;
} }
// //
bIsNothingToDo=aWS.IsNothingToDo(); bIsNothingToDo=aWS.IsNothingToDo();
if (bIsNothingToDo) { if (bIsNothingToDo) {
MakeWire(aLE, aW); MakeWire(aLE, aW);
myNewWES.AddShape (aW); myNewWES.AddShape (aW);
continue; continue;
} }
// //
const BOPTColStd_ListOfListOfShape& aLLSS=aWS.Shapes(); const BOPTColStd_ListOfListOfShape& aLLSS=aWS.Shapes();
aItLLSS.Initialize(aLLSS); aItLLSS.Initialize(aLLSS);
for (; aItLLSS.More(); aItLLSS.Next()) { for (; aItLLSS.More(); aItLLSS.Next()) {
TopTools_ListOfShape aLS; TopTools_ListOfShape aLS;
// //
const TopTools_ListOfShape& aLSS=aItLLSS.Value(); const TopTools_ListOfShape& aLSS=aItLLSS.Value();
aIt.Initialize(aLSS); aIt.Initialize(aLSS);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aES=aIt.Value(); const TopoDS_Shape& aES=aIt.Value();
aE=aWSC.Origin(aES); aE=aWSC.Origin(aES);
aLS.Append(aE); aLS.Append(aE);
} }
// //
MakeWire(aLS, aW); MakeWire(aLS, aW);
myNewWES.AddShape (aW); myNewWES.AddShape (aW);
} }
}//if(bToScale) }//if(bToScale)
// //
@ -362,27 +356,28 @@ static
aWS.Perform(); aWS.Perform();
iErr=aWS.ErrorStatus(); iErr=aWS.ErrorStatus();
if (iErr) { if (iErr) {
continue; continue;
} }
bIsNothingToDo=aWS.IsNothingToDo(); bIsNothingToDo=aWS.IsNothingToDo();
if (bIsNothingToDo) { if (bIsNothingToDo) {
MakeWire(aLE, aW); MakeWire(aLE, aW);
myNewWES.AddShape (aW); myNewWES.AddShape (aW);
continue; continue;
} }
// //
const BOPTColStd_ListOfListOfShape& aSSS=aWS.Shapes(); const BOPTColStd_ListOfListOfShape& aSSS=aWS.Shapes();
//
BOPTColStd_ListIteratorOfListOfListOfShape aWireIt(aSSS); BOPTColStd_ListIteratorOfListOfListOfShape aWireIt(aSSS);
for (; aWireIt.More(); aWireIt.Next()) { for (; aWireIt.More(); aWireIt.Next()) {
const TopTools_ListOfShape& aLEx=aWireIt.Value(); const TopTools_ListOfShape& aLEx=aWireIt.Value();
// //
MakeWire(aLEx, aW); MakeWire(aLEx, aW);
myNewWES.AddShape (aW); myNewWES.AddShape (aW);
} }
}// else }// else
} }
} }
//======================================================================= //=======================================================================
// function: MakeWire // function: MakeWire
// purpose: // purpose:
@ -399,18 +394,15 @@ static
aBB.Add(newWire, aE); aBB.Add(newWire, aE);
} }
} }
//
//======================================================================= //=======================================================================
//function : IsToScale //function : IsToScale
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean IsToScale(const TopoDS_Face& aF, Standard_Boolean IsToScale(const TopoDS_Face& aF,
Standard_Real& aScale) Standard_Real& aScale)
{ {
Standard_Boolean bRet; Standard_Boolean bRet;
Standard_Real aV1, aV2, dV, aTr;
GeomAbs_SurfaceType aType; GeomAbs_SurfaceType aType;
BRepAdaptor_Surface aBAS; BRepAdaptor_Surface aBAS;
// //
@ -420,15 +412,28 @@ Standard_Boolean IsToScale(const TopoDS_Face& aF,
aBAS.Initialize(aF); aBAS.Initialize(aF);
aType=aBAS.GetType(); aType=aBAS.GetType();
if (aType==GeomAbs_Cylinder) { if (aType==GeomAbs_Cylinder) {
Standard_Real aV1, aV2, dV, dU, aTr, aC;
//
aTr=1.e5; aTr=1.e5;
aV1=aBAS.FirstVParameter(); aV1=aBAS.FirstVParameter();
aV2=aBAS.LastVParameter(); aV2=aBAS.LastVParameter();
dV=aV2-aV1; dV=aV2-aV1;
//
if (dV>aTr) { if (dV>aTr) {
bRet=!bRet; bRet=!bRet;
aScale=1./aTr; aScale=1./aTr;
return bRet;
} }
//modified by NIZNHY-PKV Fri Mar 30 10:54:34 2012f
dU=M_PI;
aC=dV/dU;
aTr=25.;
if(aC>aTr){
bRet=!bRet;
aScale=1./aC;
return bRet;
}
//modified by NIZNHY-PKV Fri Mar 30 10:54:35 2012t
} }
return bRet; return bRet;
} }