From 5068b37334bd19be92b8d55c4fe73beeb131b380 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 25 Mar 2017 00:16:53 +0100
Subject: [PATCH] with we Delete the object/tool in a boolean operation, use a
 copy of the object/tool

---
 Geo/GModelIO_OCC.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp
index f89f7d6915..82c960534a 100644
--- a/Geo/GModelIO_OCC.cpp
+++ b/Geo/GModelIO_OCC.cpp
@@ -1710,17 +1710,20 @@ bool OCC_Internals::applyBooleanOperator
   TopoDS_Shape result;
 
 #if OCC_VERSION_HEX >= 0x060900
+  // if we remove the tool or object, we should act on copies, so that syncing
+  // with GModel is not confused if the boolean operation does not modify some
+  // of the shapes that would already have been imported before
   TopTools_ListOfShape objectShapes, toolShapes;
   for(int dim = 0; dim < 4; dim++){
     for(unsigned int i = 0; i < objects[dim].size(); i++){
-      if(tolerance > 0.)
-        objectShapes.Append(BRepBuilderAPI_Copy(objects[dim][i]).Shape());
+      if(removeTool || tolerance > 0.)
+        objectShapes.Append(BRepBuilderAPI_Copy(objects[dim][i], false).Shape());
       else
         objectShapes.Append(objects[dim][i]);
     }
     for(unsigned int i = 0; i < tools[dim].size(); i++){
-      if(tolerance > 0.)
-        toolShapes.Append(BRepBuilderAPI_Copy(tools[dim][i]).Shape());
+      if(removeObject || tolerance > 0.)
+        toolShapes.Append(BRepBuilderAPI_Copy(tools[dim][i], false).Shape());
       else
         toolShapes.Append(tools[dim][i]);
     }
-- 
GitLab