mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0030873: Make ReShape tool resistant to replacement loops
This commit is contained in:
@@ -156,6 +156,13 @@ void BRepTools_ReShape::replace (const TopoDS_Shape& ashape,
|
|||||||
TopoDS_Shape shape = ashape;
|
TopoDS_Shape shape = ashape;
|
||||||
TopoDS_Shape newshape = anewshape;
|
TopoDS_Shape newshape = anewshape;
|
||||||
if ( shape.IsNull() || shape == newshape ) return;
|
if ( shape.IsNull() || shape == newshape ) return;
|
||||||
|
if (Apply (newshape) == shape)
|
||||||
|
{
|
||||||
|
#ifdef OCCT_DEBUG
|
||||||
|
cout << "Warning: BRepTools_ReShape::Replace: recording the shape will lead to a loop" << endl;
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (shape.Orientation() == TopAbs_REVERSED)
|
if (shape.Orientation() == TopAbs_REVERSED)
|
||||||
{
|
{
|
||||||
@@ -181,7 +188,9 @@ void BRepTools_ReShape::replace (const TopoDS_Shape& ashape,
|
|||||||
#ifdef OCCT_DEBUG
|
#ifdef OCCT_DEBUG
|
||||||
if ( IsRecorded ( shape ) && ((myConsiderLocation && ! Value ( shape ).IsPartner ( newshape )) ||
|
if ( IsRecorded ( shape ) && ((myConsiderLocation && ! Value ( shape ).IsPartner ( newshape )) ||
|
||||||
(!myConsiderLocation && ! Value ( shape ).IsSame ( newshape ))))
|
(!myConsiderLocation && ! Value ( shape ).IsSame ( newshape ))))
|
||||||
|
{
|
||||||
cout << "Warning: BRepTools_ReShape::Replace: shape already recorded" << endl;
|
cout << "Warning: BRepTools_ReShape::Replace: shape already recorded" << endl;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
myShapeToReplacement.Bind(shape, TReplacement(newshape, theKind));
|
myShapeToReplacement.Bind(shape, TReplacement(newshape, theKind));
|
||||||
|
Reference in New Issue
Block a user