mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0025766: Exception in BRepAlgo_Section
class TopOpeBRep_FacesIntersector method static void MergeWLinesIfAllSegmentsAlongRestriction(IntPatch_SequenceOfLine& theSlin, const Handle(Adaptor3d_HSurface)& theSurface1, const Handle(Adaptor3d_TopolTool)& theDomain1, const Handle(Adaptor3d_HSurface)& theSurface2, const Handle(Adaptor3d_TopolTool)& theDomain2, const Standard_Real theTolArc) Protection from null wlines has been added. Test-case for issue #25766
This commit is contained in:
parent
e8746a262f
commit
a4d5c9abcc
@ -1167,38 +1167,25 @@ static void MergeWLinesIfAllSegmentsAlongRestriction(IntPatch_SequenceOfLine&
|
||||
Standard_Real Fp = 0., Lp = 0.;
|
||||
|
||||
|
||||
if( WLineRank == 1 )
|
||||
{
|
||||
Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
|
||||
Standard_Integer arcnumber = GetArc(theSlin,WLineRank,theSurface1,theDomain1,theSurface2,testPoint,TolVrtx,aLineOn2S,Fp,Lp);
|
||||
|
||||
if( arcnumber == 0 )
|
||||
return;
|
||||
|
||||
Handle(IntPatch_WLine) anWLine = NULL;
|
||||
anWLine = GetMergedWLineOnRestriction(theSlin,TolVrtx,aLineOn2S);
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "*** TopOpeBRep_FaceIntersector: Merge WLines on Restriction S1 to WLine ***" << endl;
|
||||
Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
|
||||
//
|
||||
Standard_Integer arcnumber = (WLineRank == 1) ?
|
||||
GetArc(theSlin,WLineRank,theSurface1,theDomain1,theSurface2,testPoint,TolVrtx,aLineOn2S,Fp,Lp) :
|
||||
GetArc(theSlin,WLineRank,theSurface2,theDomain2,theSurface1,testPoint,TolVrtx,aLineOn2S,Fp,Lp);
|
||||
//
|
||||
if (arcnumber == 0) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
Handle(IntPatch_WLine) anWLine = GetMergedWLineOnRestriction(theSlin,TolVrtx,aLineOn2S);
|
||||
if (!anWLine.IsNull()) {
|
||||
theSlin.Clear();
|
||||
theSlin.Append(anWLine);
|
||||
#ifdef DEB
|
||||
cout << "*** TopOpeBRep_FaceIntersector: Merge WLines on Restriction "
|
||||
<< ((WLineRank == 1) ? "S1" : "S2") << " to WLine***" << endl;
|
||||
#endif
|
||||
theSlin.Clear();
|
||||
theSlin.Append(anWLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
|
||||
Standard_Integer arcnumber = GetArc(theSlin,WLineRank,theSurface2,theDomain2,theSurface1,testPoint,TolVrtx,aLineOn2S,Fp,Lp);
|
||||
|
||||
if( arcnumber == 0 )
|
||||
return;
|
||||
|
||||
Handle(IntPatch_WLine) anWLine = NULL;
|
||||
anWLine = GetMergedWLineOnRestriction(theSlin,TolVrtx,aLineOn2S);
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "*** TopOpeBRep_FaceIntersector: Merge WLines on Restriction S2 to WLine***" << endl;
|
||||
#endif
|
||||
theSlin.Clear();
|
||||
theSlin.Append(anWLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================================
|
||||
@ -1498,6 +1485,11 @@ static Handle(IntPatch_WLine) GetMergedWLineOnRestriction(IntPatch_SequenceOfLin
|
||||
const Standard_Real& theVrtxTol,
|
||||
const Handle(IntSurf_LineOn2S)& theLineOn2S)
|
||||
{
|
||||
Handle(IntPatch_WLine) mWLine;
|
||||
if (theLineOn2S->NbPoints() == 0) {
|
||||
return mWLine;
|
||||
}
|
||||
//
|
||||
IntSurf_TypeTrans trans1 = IntSurf_Undecided;
|
||||
IntSurf_TypeTrans trans2 = IntSurf_Undecided;
|
||||
Standard_Integer i = 0;
|
||||
@ -1515,7 +1507,7 @@ static Handle(IntPatch_WLine) GetMergedWLineOnRestriction(IntPatch_SequenceOfLin
|
||||
trans2 = aWLine->TransitionOnS2();
|
||||
}
|
||||
|
||||
Handle(IntPatch_WLine) mWLine = new IntPatch_WLine(theLineOn2S, Standard_False, trans1, trans2);
|
||||
mWLine = new IntPatch_WLine(theLineOn2S, Standard_False, trans1, trans2);
|
||||
|
||||
Standard_Integer NbPnts = mWLine->NbPnts();
|
||||
IntPatch_Point aFirstVertex, aLastVertex;
|
||||
|
11
tests/bugs/modalg_5/bug25766
Normal file
11
tests/bugs/modalg_5/bug25766
Normal file
@ -0,0 +1,11 @@
|
||||
puts "========"
|
||||
puts "OCC25766"
|
||||
puts "========"
|
||||
puts ""
|
||||
########################################################################################
|
||||
# Exception is raised during building section using BRepAlgo_Section on attached faces
|
||||
########################################################################################
|
||||
|
||||
restore [locate_data_file OCC25766_surface1.brep] b1
|
||||
restore [locate_data_file OCC25766_surface2.brep] b2
|
||||
section r b1 b2
|
Loading…
x
Reference in New Issue
Block a user