From: skv Date: Fri, 11 Oct 2013 10:45:43 +0000 (+0000) Subject: 22307: fix of source shape modification by Cut X-Git-Tag: BR_hydro_v_0_3_1~93 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bdbb7196fa908406246f8e0f79120abafc141ff2;p=modules%2Fgeom.git 22307: fix of source shape modification by Cut --- diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx index a6cf81408..af5a144dd 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -131,7 +131,14 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected"); #endif - aShape = performOperation (aShape1, aShape2, aType); + // Make a copy to prevent the original shape changes. + TopoDS_Shape aShapeCopy1; + TopoDS_Shape aShapeCopy2; + TColStd_IndexedDataMapOfTransientTransient aMapTShapes; + TNaming_CopyShape::CopyTool(aShape1, aMapTShapes, aShapeCopy1); + TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy2); + + aShape = performOperation (aShapeCopy1, aShapeCopy2, aType); if (aShape.IsNull()) return 0; @@ -172,6 +179,14 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected"); } #endif + + // Copy shape + TopoDS_Shape aShapeCopy; + TColStd_IndexedDataMapOfTransientTransient aMapTShapes; + + TNaming_CopyShape::CopyTool(aShape, aMapTShapes, aShapeCopy); + aShape = aShapeCopy; + for (i = 2; i <= nbShapes; i++) { aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(i)); aShape2 = aRefShape->GetValue(); @@ -190,7 +205,9 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected"); } #endif - aShape = performOperation (aShape, aShape2, aSimpleType); + // Copy shape + TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy); + aShape = performOperation (aShape, aShapeCopy, aSimpleType); if (aShape.IsNull()) { return 0; @@ -226,6 +243,12 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected"); } #endif + // Copy shape + TopoDS_Shape aShapeCopy; + TColStd_IndexedDataMapOfTransientTransient aMapTShapes; + + TNaming_CopyShape::CopyTool(aShape, aMapTShapes, aShapeCopy); + aShape = aShapeCopy; Handle(TColStd_HSequenceOfTransient) aTools = aCI.GetShapes(); const Standard_Integer nbShapes = aTools->Length(); @@ -252,7 +275,9 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const } #endif - aShape = performOperation (aShape, aTool, BOOLEAN_CUT); + // Copy shape + TNaming_CopyShape::CopyTool(aTool, aMapTShapes, aShapeCopy); + aShape = performOperation (aShape, aShapeCopy, BOOLEAN_CUT); if (aShape.IsNull()) { return 0;