Salome HOME
Task 3.2. Concealment into multi-level Compounds
authorazv <azv@opencascade.com>
Mon, 13 May 2019 05:11:47 +0000 (08:11 +0300)
committerazv <azv@opencascade.com>
Mon, 13 May 2019 05:11:47 +0000 (08:11 +0300)
Update behavior of CUT operation to keep hierarchy of compounds.

15 files changed:
src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp
src/FeaturesAPI/FeaturesAPI_BooleanCut.h
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp
src/FeaturesPlugin/FeaturesPlugin_Boolean.h
src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp
src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp
src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h
src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp
src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v20190506_2.py
src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound0.py [deleted file]
src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_1.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_2.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_1.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_2.py [new file with mode: 0644]

index 5b81a2be3ed55df17b9b723e152c1f0f9654f12f..b0bbd4cb613c5ed0d3a3c4a98f092b9346fd00ef 100644 (file)
@@ -34,10 +34,12 @@ FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Fe
 FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(
   const std::shared_ptr<ModelAPI_Feature>& theFeature,
   const std::list<ModelHighAPI_Selection>& theMainObjects,
-  const std::list<ModelHighAPI_Selection>& theToolObjects)
+  const std::list<ModelHighAPI_Selection>& theToolObjects,
+  const int theVersion)
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
+    fillAttribute(theVersion, theFeature->integer(FeaturesPlugin_Boolean::VERSION_ID()));
     fillAttribute(theMainObjects, mymainObjects);
     fillAttribute(theToolObjects, mytoolObjects);
 
@@ -79,17 +81,26 @@ void FeaturesAPI_BooleanCut::dump(ModelHighAPI_Dumper& theDumper) const
     aBase->selectionList(FeaturesPlugin_BooleanCut::OBJECT_LIST_ID());
   AttributeSelectionListPtr aTools =
     aBase->selectionList(FeaturesPlugin_BooleanCut::TOOL_LIST_ID());
+  AttributeIntegerPtr aVersion =
+    aBase->integer(FeaturesPlugin_BooleanCut::VERSION_ID());
 
-  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools;
+
+  if (aVersion && aVersion->isInitialized())
+    theDumper << ", " << aVersion->value();
+
+  theDumper << ")" << std::endl;
 }
 
 //==================================================================================================
 BooleanCutPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
                      const std::list<ModelHighAPI_Selection>& theMainObjects,
-                     const std::list<ModelHighAPI_Selection>& theToolObjects)
+                     const std::list<ModelHighAPI_Selection>& theToolObjects,
+                     const int theVersion)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCut::ID());
   return BooleanCutPtr(new FeaturesAPI_BooleanCut(aFeature,
                                                   theMainObjects,
-                                                  theToolObjects));
+                                                  theToolObjects,
+                                                  theVersion));
 }
index 82eb5ad992e73d5549a13f8371ce9ca1c7c6adb7..b7d113aac7ff2a4b275ba0071addc290a85f474e 100644 (file)
@@ -44,7 +44,8 @@ public:
   FEATURESAPI_EXPORT
   FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                          const std::list<ModelHighAPI_Selection>& theMainObjects,
-                         const std::list<ModelHighAPI_Selection>& theToolObjects);
+                         const std::list<ModelHighAPI_Selection>& theToolObjects,
+                         const int theVersion = 0);
 
   /// Destructor.
   FEATURESAPI_EXPORT
@@ -77,6 +78,7 @@ typedef std::shared_ptr<FeaturesAPI_BooleanCut> BooleanCutPtr;
 FEATURESAPI_EXPORT
 BooleanCutPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
                      const std::list<ModelHighAPI_Selection>& theMainObjects,
-                     const std::list<ModelHighAPI_Selection>& theToolObjects);
+                     const std::list<ModelHighAPI_Selection>& theToolObjects,
+                     const int theVersion = 0);
 
 #endif // FeaturesAPI_BooleanCut_H_
index 8fbf6f07676cc4f4ebfed7b9204390e9b046f392..3d99fb44628b1774a704675a1a951b211ae0d39b 100644 (file)
@@ -464,7 +464,10 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestBooleanCommon_MultiLevelCompound_v0_2.py
                TestBooleanCommon_MultiLevelCompound_v20190506_1.py
                TestBooleanCommon_MultiLevelCompound_v20190506_2.py
-               TestBooleanCut_MultiLevelCompound0.py
+               TestBooleanCut_MultiLevelCompound_v0_1.py
+               TestBooleanCut_MultiLevelCompound_v0_2.py
+               TestBooleanCut_MultiLevelCompound_v20190506_1.py
+               TestBooleanCut_MultiLevelCompound_v20190506_2.py
                TestBooleanFuse_MultiLevelCompound_v0_1.py
                TestBooleanFuse_MultiLevelCompound_v0_2.py
                TestBooleanFuse_MultiLevelCompound_v0_3.py
index ec55ff5e303f685cdc742988a7a24c24fe851afc..e39c1f99fbbc6a3ed2ec8785a64ee1479861c30a 100644 (file)
@@ -65,6 +65,21 @@ void FeaturesPlugin_Boolean::initAttributes()
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TOOL_LIST_ID());
 }
 
+//=================================================================================================
+void FeaturesPlugin_Boolean::initVersion(const int theVersion)
+{
+  AttributePtr aVerAttr = data()->addAttribute(VERSION_ID(), ModelAPI_AttributeInteger::typeId());
+  aVerAttr->setIsArgument(false);
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VERSION_ID());
+  if (!integer(VERSION_ID())->isInitialized() &&
+      !selectionList(OBJECT_LIST_ID())->isInitialized() &&
+      !selectionList(TOOL_LIST_ID())->isInitialized()) {
+    // this is a newly created feature (not read from file),
+    // so, initialize the latest version
+    integer(VERSION_ID())->setValue(theVersion);
+  }
+}
+
 //=================================================================================================
 FeaturesPlugin_Boolean::OperationType FeaturesPlugin_Boolean::operationType()
 {
@@ -368,6 +383,11 @@ bool FeaturesPlugin_Boolean::processCompound(
   ListOfShape aUsedInOperationShapes;
   ListOfShape aNotUsedShapes;
   theCompoundHierarchy.SplitCompound(theCompound, aUsedInOperationShapes, aNotUsedShapes);
+  if (theResultCompound) {
+    // Not necessary to keep all subs of the current compound,
+    // all unused solids are already stored in the result compound.
+    aNotUsedShapes.clear();
+  }
 
   std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
   std::shared_ptr<GeomAlgoAPI_Boolean> aBoolAlgo(
index f2f11b3541115a2e4453bf7ce0bf097dc4c35a2c..6fe5a24d623432c64a60cba9d3a4fbc00b29c382 100644 (file)
@@ -78,6 +78,11 @@ protected:
   /// Use plugin manager for features creation.
   FeaturesPlugin_Boolean(const OperationType theOperationType);
 
+  /// Initialize version field of the Boolean feature.
+  /// The version is initialized for newly created features,
+  /// not read from previously stored document.
+  void initVersion(const int theVersion);
+
   /// Load Naming data structure of the feature to the document
   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                     const std::shared_ptr<GeomAPI_Shape> theBaseShape,
index 484bd867de85d929c3b0d0f2b0642ddfa45328c2..9dd105a9d5e42a6c606b99d2db199194572f910e 100644 (file)
@@ -54,16 +54,7 @@ void FeaturesPlugin_BooleanCommon::initAttributes()
   data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
   data()->addAttribute(TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
 
-  AttributePtr aVerAttr = data()->addAttribute(VERSION_ID(), ModelAPI_AttributeInteger::typeId());
-  aVerAttr->setIsArgument(false);
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VERSION_ID());
-  if (!integer(VERSION_ID())->isInitialized() &&
-      !selectionList(OBJECT_LIST_ID())->isInitialized() &&
-      !selectionList(TOOL_LIST_ID())->isInitialized()) {
-    // this is a newly created feature (not read from file),
-    // so, initialize the latest version
-    integer(VERSION_ID())->setValue(THE_COMMON_VERSION_1);
-  }
+  initVersion(THE_COMMON_VERSION_1);
 }
 
 //==================================================================================================
index be93d26ec8233e3e33dc7076135108b13e9ecbf1..cb87cb69a2626a41167884ddbea5a5162db9bee4 100644 (file)
 #include <GeomAPI_ShapeExplorer.h>
 #include <GeomAPI_ShapeIterator.h>
 
+static const int THE_CUT_VERSION_1 = 20190506;
+
 //==================================================================================================
 FeaturesPlugin_BooleanCut::FeaturesPlugin_BooleanCut()
 : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_CUT)
 {
 }
 
+//==================================================================================================
+void FeaturesPlugin_BooleanCut::initAttributes()
+{
+  FeaturesPlugin_Boolean::initAttributes();
+  initVersion(THE_CUT_VERSION_1);
+}
+
 //==================================================================================================
 void FeaturesPlugin_BooleanCut::execute()
 {
@@ -60,10 +69,22 @@ void FeaturesPlugin_BooleanCut::execute()
     return;
   }
 
+  // version of CUT feature
+  int aCutVersion = version();
+
   std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
   ListOfShape aResultShapesList;
   std::string anError;
 
+  std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
+
+  GeomShapePtr aResultCompound;
+  if (aCutVersion == THE_CUT_VERSION_1) {
+    // merge hierarchies of compounds containing objects and tools
+    aResultCompound =
+        keepUnusedSubsOfCompound(GeomShapePtr(), anObjects, aTools, aMakeShapeList);
+  }
+
   // For solids cut each object with all tools.
   bool isOk = true;
   for (ObjectHierarchy::Iterator anObjectsIt = anObjects.Begin();
@@ -78,28 +99,60 @@ void FeaturesPlugin_BooleanCut::execute()
         // Compound handling
         isOk = processCompound(GeomAlgoAPI_Tools::BOOL_CUT,
                                anObjects, aParent, aTools.Objects(),
-                               aResultIndex, aResultBaseAlgoList, aResultShapesList);
+                               aResultIndex, aResultBaseAlgoList, aResultShapesList,
+                               aResultCompound);
       }
       else if (aShapeType == GeomAPI_Shape::COMPSOLID) {
         // Compsolid handling
         isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_CUT,
                                 anObjects, aParent, aTools.Objects(), ListOfShape(),
-                                aResultIndex, aResultBaseAlgoList, aResultShapesList);
+                                aResultIndex, aResultBaseAlgoList, aResultShapesList,
+                                aResultCompound);
       }
     } else {
       // process object as is
       isOk = processObject(GeomAlgoAPI_Tools::BOOL_CUT,
                            anObject, aTools.Objects(), aPlanes,
-                           aResultIndex, aResultBaseAlgoList, aResultShapesList);
+                           aResultIndex, aResultBaseAlgoList, aResultShapesList,
+                           aResultCompound);
+    }
+  }
+
+  GeomAPI_ShapeIterator aShapeIt(aResultCompound);
+  if (aShapeIt.more()) {
+    std::shared_ptr<ModelAPI_ResultBody> aResultBody =
+        document()->createBody(data(), aResultIndex);
+
+    ListOfShape anObjectList = anObjects.Objects();
+    ListOfShape aToolsList = aTools.Objects();
+    FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                             anObjectList,
+                                             aToolsList,
+                                             aMakeShapeList,
+                                             aResultCompound);
+    setResult(aResultBody, aResultIndex++);
+
+    // merge algorithms
+    FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+    aRBA.resultBody = aResultBody;
+    aRBA.baseShape = anObjectList.front();
+    for (std::vector<FeaturesPlugin_Tools::ResultBaseAlgo>::iterator
+         aRBAIt = aResultBaseAlgoList.begin();
+         aRBAIt != aResultBaseAlgoList.end(); ++aRBAIt) {
+      aMakeShapeList->appendAlgo(aRBAIt->makeShape);
     }
+    aRBA.makeShape = aMakeShapeList;
+    aResultBaseAlgoList.clear();
+    aResultBaseAlgoList.push_back(aRBA);
   }
 
   // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one
   // result shape has been deleted, but in another it was modified or stayed.
-  GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
+  if (!aResultCompound)
+    aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
   FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList,
                                           aTools.Objects(),
-                                          aResultShapesCompound);
+                                          aResultCompound);
 
   // remove the rest results if there were produced in the previous pass
   removeResults(aResultIndex);
index ffd5c3486a7e3fe8b4ac12b25a69d52be6bec5af..76ffe70b1906a57e9df40350e908f77beb7f4fd8 100644 (file)
@@ -46,6 +46,9 @@ public:
     return MY_KIND;
   }
 
+  /// Request for initialization of data model of the feature: adding all attributes.
+  FEATURESPLUGIN_EXPORT virtual void initAttributes();
+
   /// Creates a new part document if needed.
   FEATURESPLUGIN_EXPORT virtual void execute();
 
index 84df36d061a8ef547e4d8daed7d064d5ee205a78..a68ba8f50324a01fafdbd98f7075aeecd914fc2d 100644 (file)
@@ -62,16 +62,7 @@ void FeaturesPlugin_BooleanFuse::initAttributes()
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), OBJECT_LIST_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TOOL_LIST_ID());
 
-  AttributePtr aVerAttr = data()->addAttribute(VERSION_ID(), ModelAPI_AttributeInteger::typeId());
-  aVerAttr->setIsArgument(false);
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VERSION_ID());
-  if (!integer(VERSION_ID())->isInitialized() &&
-      !selectionList(OBJECT_LIST_ID())->isInitialized() &&
-      !selectionList(TOOL_LIST_ID())->isInitialized()) {
-    // this is a newly created feature (not read from file),
-    // so, initialize the latest version
-    integer(VERSION_ID())->setValue(THE_FUSE_VERSION_1);
-  }
+  initVersion(THE_FUSE_VERSION_1);
 }
 
 //==================================================================================================
index e95f88f05540e91aebc919f904fd6c5e011d4a83..3c5b105e3e4caa8a341c5f26c17b6cef3189d276 100644 (file)
@@ -112,10 +112,10 @@ from GeomAPI import GeomAPI_Shape
 
 model.testNbResults(Common_1, 1)
 model.testNbSubResults(Common_1, [4])
-model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [7])
-model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [36])
-model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [134])
-model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [268])
-model.testResultsVolumes(Common_1, [22834.734413125825])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [6])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [33])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [128])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [256])
+model.testResultsVolumes(Common_1, [16551.5491059462365])
 
 assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound0.py b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound0.py
deleted file mode 100644 (file)
index a9001af..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-from SketchAPI import *
-
-from salome.shaper import model
-
-model.begin()
-partSet = model.moduleDocument()
-Part_1 = model.addPart(partSet)
-Part_1_doc = Part_1.document()
-Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_1 = Sketch_1.addCircle(10, 25, 5)
-SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
-SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 10)
-SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 25)
-SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
-model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
-AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), 30, 2)
-LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face"))
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[LinearCopy_1_1_1_2/MF:Translated&Sketch_1/SketchCircle_1_2][LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face]__cc"), False)
-SketchPoint_2 = SketchProjection_2.createdFeature()
-SketchCircle_2 = Sketch_2.addCircle(-3.839745962155611, 26.65063509461097, 3)
-SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_2.center())
-SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 3)
-model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 5, 5)
-Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1_2")], [model.selection("SOLID", "Extrusion_2_1")])
-model.do()
-model.end()
-
-from GeomAPI import GeomAPI_Shape
-
-model.testNbResults(Cut_1, 1)
-model.testNbSubResults(Cut_1, [2])
-model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [2])
-model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [8])
-model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [18])
-model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [36])
-model.testResultsVolumes(Cut_1, [1429.424657383355906858923844993])
diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_1.py
new file mode 100644 (file)
index 0000000..2acd771
--- /dev/null
@@ -0,0 +1,63 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(10, 25, 5)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 10)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 25)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), 30, 2)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face"))
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[LinearCopy_1_1_1_2/MF:Translated&Sketch_1/SketchCircle_1_2][LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face]__cc"), False)
+SketchPoint_2 = SketchProjection_2.createdFeature()
+SketchCircle_2 = Sketch_2.addCircle(-3.839745962155611, 26.65063509461097, 3)
+SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_2.center())
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 3)
+model.do()
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 5, 5)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1_2")], [model.selection("SOLID", "Extrusion_2_1")])
+
+model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
+
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Cut_1, 1)
+model.testNbSubResults(Cut_1, [2])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [2])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [8])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [18])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [36])
+model.testResultsVolumes(Cut_1, [1429.424657383355906858923844993])
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_2.py
new file mode 100644 (file)
index 0000000..7a29bc0
--- /dev/null
@@ -0,0 +1,121 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_1 = SketchProjection_1.createdFeature()
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 10)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10)
+SketchCircle_2 = Sketch_1.addCircle(10, 0, 10)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center())
+SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1])
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_2 = SketchProjection_2.createdFeature()
+SketchCircle_3 = Sketch_2.addCircle(0, -7, 10)
+SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center())
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10)
+SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7)
+SketchCircle_4 = Sketch_2.addCircle(40, -27, 10)
+SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1])
+SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40)
+SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20)
+model.do()
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")])
+Compound_2.result().subResult(0).setColor(255, 170, 0)
+Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0)
+Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0)
+Compound_2.result().subResult(1).setColor(0, 85, 255)
+Compound_2.result().subResult(1).subResult(0).setColor(0, 85, 255)
+Compound_2.result().subResult(1).subResult(1).setColor(0, 85, 255)
+Compound_2.result().subResult(1).subResult(2).setColor(0, 85, 255)
+Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
+SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0)
+SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5)
+SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5)
+SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0)
+SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result())
+SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result())
+SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_7 = SketchProjection_3.createdFeature()
+SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True)
+SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result())
+SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5)
+SketchLine_8 = Sketch_3.addLine(7, 7, -7.000000000000001, 7)
+SketchLine_9 = Sketch_3.addLine(-7.000000000000001, 7, -7.000000000000001, 10)
+SketchLine_10 = Sketch_3.addLine(-7.000000000000001, 10, 7, 10)
+SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7)
+SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result())
+SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result())
+SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result())
+SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result())
+SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result())
+SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result())
+SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3)
+SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True)
+model.do()
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10)
+Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20)
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2)
+Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")])
+Compound_3.result().subResult(0).setColor(0, 170, 0)
+Compound_3.result().subResult(1).setColor(0, 255, 0)
+Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0)
+Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3")], [model.selection("SOLID", "Compound_3_1_2_2")])
+
+model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
+
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Cut_1, 2)
+model.testNbSubResults(Cut_1, [2, 3])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [2, 3])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [10, 21])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [36, 98])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [72, 196])
+model.testResultsVolumes(Cut_1, [11801.1921223872, 9624.313983209351])
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_1.py b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_1.py
new file mode 100644 (file)
index 0000000..0729e5b
--- /dev/null
@@ -0,0 +1,63 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(10, 25, 5)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 10)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 25)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), 30, 2)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face"))
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[LinearCopy_1_1_1_2/MF:Translated&Sketch_1/SketchCircle_1_2][LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face]__cc"), False)
+SketchPoint_2 = SketchProjection_2.createdFeature()
+SketchCircle_2 = Sketch_2.addCircle(-3.839745962155611, 26.65063509461097, 3)
+SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_2.center())
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 3)
+model.do()
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 5, 5)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1_2")], [model.selection("SOLID", "Extrusion_2_1")], 20190506)
+
+model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
+
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Cut_1, 1)
+model.testNbSubResults(Cut_1, [3])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [4])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [14])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [30])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [60])
+model.testResultsVolumes(Cut_1, [3000.22098417825282])
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_2.py b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_2.py
new file mode 100644 (file)
index 0000000..7c9432f
--- /dev/null
@@ -0,0 +1,121 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_1 = SketchProjection_1.createdFeature()
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 10)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10)
+SketchCircle_2 = Sketch_1.addCircle(10, 0, 10)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center())
+SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1])
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_2 = SketchProjection_2.createdFeature()
+SketchCircle_3 = Sketch_2.addCircle(0, -7, 10)
+SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center())
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10)
+SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7)
+SketchCircle_4 = Sketch_2.addCircle(40, -27, 10)
+SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1])
+SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40)
+SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20)
+model.do()
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")])
+Compound_2.result().subResult(0).setColor(255, 170, 0)
+Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0)
+Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0)
+Compound_2.result().subResult(1).setColor(0, 85, 255)
+Compound_2.result().subResult(1).subResult(0).setColor(0, 85, 255)
+Compound_2.result().subResult(1).subResult(1).setColor(0, 85, 255)
+Compound_2.result().subResult(1).subResult(2).setColor(0, 85, 255)
+Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
+SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0)
+SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5)
+SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5)
+SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0)
+SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result())
+SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result())
+SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_7 = SketchProjection_3.createdFeature()
+SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True)
+SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result())
+SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5)
+SketchLine_8 = Sketch_3.addLine(7, 7, -7.000000000000001, 7)
+SketchLine_9 = Sketch_3.addLine(-7.000000000000001, 7, -7.000000000000001, 10)
+SketchLine_10 = Sketch_3.addLine(-7.000000000000001, 10, 7, 10)
+SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7)
+SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result())
+SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result())
+SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result())
+SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result())
+SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result())
+SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result())
+SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3)
+SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True)
+model.do()
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10)
+Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20)
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2)
+Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")])
+Compound_3.result().subResult(0).setColor(0, 170, 0)
+Compound_3.result().subResult(1).setColor(0, 255, 0)
+Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0)
+Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3")], [model.selection("SOLID", "Compound_3_1_2_2")], 20190506)
+
+model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
+
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Cut_1, 1)
+model.testNbSubResults(Cut_1, [5])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [7])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [43])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [182])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [364])
+model.testResultsVolumes(Cut_1, [27585.506105596567])
+
+assert(model.checkPythonDump())