1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0030795: BRepOffsetAPI_MakePipeShell: hangs on the attached model and produces infinite rails

Added new condition to catch bad shape
This commit is contained in:
akaftasev
2020-08-17 18:44:19 +03:00
committed by bugmaster
parent eca6e7c547
commit 992876e98f
10 changed files with 177 additions and 29 deletions

View File

@@ -2923,38 +2923,46 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
Standard_Real Extend = 0.0;
if (NbTrous==1) Extend = EvalExtrapol(1, Transition);
isDone = BuildShell(Transition,
1, NbPath+1,
1, NbPath+1,
ReversedEdges,
Tapes, Rails,
Extend, Extend);
Extend, Extend);
}
else { // This is done piece by piece
Standard_Integer IFirst = 1, ILast;
for (ii=1, isDone=Standard_True;
ii<=NbPart && isDone; ii++) {
if (ii > NbTrous) ILast = NbPath+1;
else ILast = Trous->Value(ii);
isDone = BuildShell(Transition,
IFirst, ILast,
ii<=NbPart && isDone; ii++) {
if (ii > NbTrous) ILast = NbPath+1;
else ILast = Trous->Value(ii);
isDone = BuildShell(Transition,
IFirst, ILast,
ReversedEdges,
Tapes, Rails,
EvalExtrapol(IFirst, Transition),
EvalExtrapol(ILast, Transition));
if (IFirst>1) {
Translate(myVEdges, IFirst, Bounds, 2);
PerformCorner(IFirst,
Transition, Bounds);
}
IFirst = ILast;
Translate(myVEdges, IFirst, Bounds, 1);
EvalExtrapol(IFirst, Transition),
EvalExtrapol(ILast, Transition));
if (IFirst>1) {
Translate(myVEdges, IFirst, Bounds, 2);
if (!PerformCorner(IFirst,
Transition, Bounds))
{
isDone = Standard_False;
return;
}
}
IFirst = ILast;
Translate(myVEdges, IFirst, Bounds, 1);
}
}
// Management of looping ends
if ( (NbTrous>0) && (myLoc->IsClosed()) &&
(Trous->Value(NbTrous) == NbPath+1) ) {
(Trous->Value(NbTrous) == NbPath+1) ) {
Translate(myVEdges, NbPath+1, Bounds, 1);
Translate(myVEdges, 1, Bounds, 2);
PerformCorner(1, Transition, Bounds);
if (!PerformCorner(1, Transition, Bounds))
{
isDone = Standard_False;
return;
}
Translate(myVEdges, 1, myVEdges, NbPath+1);
}
@@ -3175,12 +3183,14 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
//function : PerformCorner
//purpose : Trim and/or loop a corner
//======================================================================
void BRepFill_Sweep::PerformCorner(const Standard_Integer Index,
const BRepFill_TransitionStyle Transition,
const Handle(TopTools_HArray2OfShape)& Bounds)
Standard_Boolean BRepFill_Sweep::PerformCorner(const Standard_Integer Index,
const BRepFill_TransitionStyle Transition,
const Handle(TopTools_HArray2OfShape)& Bounds)
{
if (Transition == BRepFill_Modified) return; // Do nothing.
if (Transition == BRepFill_Modified) return Standard_True; // Do nothing.
const Standard_Real anAngularTol = 0.025;
BRepFill_TransitionStyle TheTransition = Transition;
Standard_Boolean isTangent=Standard_False;
@@ -3226,11 +3236,15 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
#ifdef OCCT_DEBUG
std::cout << "BRepFill_Sweep::PerformCorner : This is not a corner !" << std::endl;
#endif
return;
return Standard_True;
}
Sortant = t2 - t1;
}
if (T1.Angle(T2) >= M_PI - anAngularTol)
{
return Standard_False;
}
if ((TheTransition == BRepFill_Right)
&& (T1.Angle(T2) > myAngMax) ) {
TheTransition = BRepFill_Round;
@@ -3336,7 +3350,7 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
#ifdef OCCT_DEBUG
std::cout << "Fail of TrimCorner" << std::endl;
#endif
return; // Nothing is touched
return Standard_True; // Nothing is touched
}
if (mySec->IsUClosed())
@@ -3416,7 +3430,7 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
#endif
}
}
return Standard_True;
/*
#if DRAW
if (Affich) {