From 828a75f2280fa20235acae49af4cb2f0876d71e9 Mon Sep 17 00:00:00 2001 From: drazmyslovich Date: Wed, 7 Aug 2019 13:25:15 +0200 Subject: [PATCH] 0030873: Make ReShape tool resistant to replacement loops --- src/BRepTools/BRepTools_ReShape.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/BRepTools/BRepTools_ReShape.cxx b/src/BRepTools/BRepTools_ReShape.cxx index fbfa18a8b8..e5128ee363 100644 --- a/src/BRepTools/BRepTools_ReShape.cxx +++ b/src/BRepTools/BRepTools_ReShape.cxx @@ -156,6 +156,13 @@ void BRepTools_ReShape::replace (const TopoDS_Shape& ashape, TopoDS_Shape shape = ashape; TopoDS_Shape newshape = anewshape; 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) { @@ -181,7 +188,9 @@ void BRepTools_ReShape::replace (const TopoDS_Shape& ashape, #ifdef OCCT_DEBUG if ( IsRecorded ( shape ) && ((myConsiderLocation && ! Value ( shape ).IsPartner ( newshape )) || (!myConsiderLocation && ! Value ( shape ).IsSame ( newshape )))) + { cout << "Warning: BRepTools_ReShape::Replace: shape already recorded" << endl; + } #endif myShapeToReplacement.Bind(shape, TReplacement(newshape, theKind)); -- 2.39.5