1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0033398: Modeling Algorithms - ShapeUpgrade_UnifySameDomain throws exception on specific STEP model

Added additional checking in static method FindCoordBounds to avoid processing null pcurves
This commit is contained in:
akaftasev 2023-08-01 15:05:10 +01:00 committed by jokwajeb
parent 5e53920228
commit 96d1fe2b05
2 changed files with 36 additions and 12 deletions

View File

@ -340,16 +340,22 @@ static Standard_Real ComputeMinEdgeSize(const TopTools_SequenceOfShape& theEdges
return MinSize;
}
static void FindCoordBounds(const TopTools_SequenceOfShape& theFaces,
const TopoDS_Face& theRefFace,
const TopTools_IndexedDataMapOfShapeListOfShape& theMapEF,
const TopTools_MapOfShape& theEdgesMap,
const Standard_Integer theIndCoord,
const Standard_Real thePeriod,
Standard_Real& theMinCoord,
Standard_Real& theMaxCoord,
Standard_Integer& theNumberOfIntervals,
Standard_Integer& theIndFaceMax)
//=======================================================================
//function : FindCoordBounds
//purpose : Searching for origin of U in 2d space
// Returns Standard_False if could not find curve on surface
// Returns Standard_True if succeed
//=======================================================================
static Standard_Boolean FindCoordBounds(const TopTools_SequenceOfShape& theFaces,
const TopoDS_Face& theRefFace,
const TopTools_IndexedDataMapOfShapeListOfShape& theMapEF,
const TopTools_MapOfShape& theEdgesMap,
const Standard_Integer theIndCoord,
const Standard_Real thePeriod,
Standard_Real& theMinCoord,
Standard_Real& theMaxCoord,
Standard_Integer& theNumberOfIntervals,
Standard_Integer& theIndFaceMax)
{
NCollection_Sequence<std::pair<Standard_Real, Standard_Real>> aPairSeq;
@ -372,6 +378,10 @@ static void FindCoordBounds(const TopTools_SequenceOfShape& theFaces,
continue;
Standard_Real fpar, lpar;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, theRefFace, fpar, lpar);
if (aPCurve.IsNull())
{
return Standard_False;
}
UpdateBoundaries (aPCurve, fpar, lpar, theIndCoord, aMinCoord, aMaxCoord);
}
@ -436,6 +446,7 @@ static void FindCoordBounds(const TopTools_SequenceOfShape& theFaces,
theMinCoord = aPairSeq(1).first;
theMaxCoord = aPairSeq(1).second;
return Standard_True;
}
static void RelocatePCurvesToNewUorigin(const TopTools_SequenceOfShape& theEdges,
@ -3297,8 +3308,11 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
//so that all the faces are in [origin, origin + Uperiod]
Standard_Real aMinCoord, aMaxCoord; //Umin, Umax;
Standard_Integer aNumberOfIntervals, i_face_max;
FindCoordBounds (faces, F_RefFace, aMapEF, edgesMap, ii+1, aPeriods[ii],
aMinCoord, aMaxCoord, aNumberOfIntervals, i_face_max);
if (!FindCoordBounds(faces, F_RefFace, aMapEF, edgesMap, ii + 1, aPeriods[ii],
aMinCoord, aMaxCoord, aNumberOfIntervals, i_face_max))
{
break;
}
if (aMaxCoord - aMinCoord > aPeriods[ii] - 1.e-5)
anIsSeamFound[ii] = Standard_True;

10
tests/bugs/heal/bug33398 Normal file
View File

@ -0,0 +1,10 @@
puts "========================================="
puts "0033398: Modeling Algorithms - ShapeUpgrade_UnifySameDomain fails on specific STEP model"
puts "========================================="
puts ""
testreadstep [locate_data_file bug33398.step] s
unifysamedom result s
checknbshapes result -vertex 506 -edge 908 -wire 394 -face 382 -shell 4 -solid 4
checkview -display result -2d -path ${imagedir}/${test_image}.png