]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Task 3.3. Recovering Compsolids and Compounds
authorazv <azv@opencascade.com>
Mon, 20 May 2019 07:36:40 +0000 (10:36 +0300)
committerazv <azv@opencascade.com>
Tue, 28 May 2019 18:30:53 +0000 (21:30 +0300)
13 files changed:
src/FeaturesAPI/FeaturesAPI_Recover.cpp
src/FeaturesAPI/FeaturesAPI_Recover.h
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_Recover.cpp
src/FeaturesPlugin/FeaturesPlugin_Recover.h
src/FeaturesPlugin/Test/TestRecover_Compound.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestRecover_Compsolid1.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestRecover_Compsolid2.py [new file with mode: 0644]
src/FeaturesPlugin/icons/recover_compound_32x32.png [new file with mode: 0644]
src/FeaturesPlugin/icons/recover_default_32x32.png [new file with mode: 0644]
src/FeaturesPlugin/recover_widget.xml
src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp
src/ModuleBase/ModuleBase_WidgetConcealedObjects.h

index 3699e131e14a2a8f176ff2daf0d1ce81b330265d..6a99ac3bbc942b525c10cbd427f3e76dcdaa5ef9 100644 (file)
@@ -33,10 +33,15 @@ FeaturesAPI_Recover::FeaturesAPI_Recover(const std::shared_ptr<ModelAPI_Feature>
 //=================================================================================================
 FeaturesAPI_Recover::FeaturesAPI_Recover(const std::shared_ptr<ModelAPI_Feature>& theFeature,
   const ModelHighAPI_Reference& theBaseFeature,
-  const std::list<ModelHighAPI_Selection>& theRecoveredList, const bool thePersistent)
+  const std::list<ModelHighAPI_Selection>& theRecoveredList,
+  const bool theRecoverCompound)
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
+    std::string aMethod = theRecoverCompound ? FeaturesPlugin_Recover::METHOD_COMPOUND()
+                                             : FeaturesPlugin_Recover::METHOD_DEFAULT();
+    fillAttribute(aMethod, theFeature->string(FeaturesPlugin_Recover::METHOD()));
+
     setBaseFeature(theBaseFeature);
     setRecoveredList(theRecoveredList);
   }
@@ -75,15 +80,22 @@ void FeaturesAPI_Recover::dump(ModelHighAPI_Dumper& theDumper) const
   FeaturePtr aFeature = ModelAPI_Feature::feature(anAttrBaseFeature->value());
 
   theDumper << aBase << " = model.addRecover(" << aDocName << ", "
-            << aFeature << ", " << anAttrRecoveredEntities << ")" << std::endl;
+            << aFeature << ", " << anAttrRecoveredEntities;
+
+  AttributeStringPtr aMethod = aBase->string(FeaturesPlugin_Recover::METHOD());
+  if (aMethod && aMethod->isInitialized() &&
+      aMethod->value() != FeaturesPlugin_Recover::METHOD_DEFAULT())
+    theDumper << ", " << true;
+
+  theDumper << ")" << std::endl;
 }
 
 //=================================================================================================
 RecoverPtr addRecover(const std::shared_ptr<ModelAPI_Document>& thePart,
   const ModelHighAPI_Reference& theBaseFeature,
-  const std::list<ModelHighAPI_Selection>& theRecoveredList, const bool thePersistent)
+  const std::list<ModelHighAPI_Selection>& theRecoveredList, const bool theRecoverCompound)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Recover::ID());
   return RecoverPtr(new FeaturesAPI_Recover(
-    aFeature, theBaseFeature, theRecoveredList, thePersistent));
+    aFeature, theBaseFeature, theRecoveredList, theRecoverCompound));
 }
index 95335fb29c9dce4719bc5cfc2f47aba47144b348..b4b16578ee0cf6b1352f32cd4c51d4d4d2df30f8 100644 (file)
@@ -45,7 +45,7 @@ public:
   FeaturesAPI_Recover(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                       const ModelHighAPI_Reference& theBaseFeature,
                       const std::list<ModelHighAPI_Selection>& theRecoveredList,
-                      const bool thePersistent = false);
+                      const bool theRecoverCompound = false);
 
   /// Destructor.
   FEATURESAPI_EXPORT
@@ -79,6 +79,6 @@ FEATURESAPI_EXPORT
 RecoverPtr addRecover(const std::shared_ptr<ModelAPI_Document>& thePart,
                       const ModelHighAPI_Reference& theBaseFeature,
                       const std::list<ModelHighAPI_Selection>& theRecoveredList,
-                      const bool thePersistent = false);
+                      const bool theRecoverCompound = false);
 
 #endif // FeaturesAPI_Recover_H_
index 1b383d5450893f195205060deb4956e56dd9a0fe..5317c2a3c7e920ad8b24bbfc8b1a3bb352fa9ec9 100644 (file)
@@ -263,6 +263,9 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestPipe_Compound.py
                TestPipe_ErrorMsg.py
                TestRecover.py
+               TestRecover_Compound.py
+               TestRecover_Compsolid1.py
+               TestRecover_Compsolid2.py
                TestRecover1798.py
                TestSplitEdgeVertex.py
                TestSplitEdgeEdge.py
index 4cebf871bb4201c544d3d1964a212d918e23b981..1721e05b6ba21634de84ff9e295d6f6f4bbb3f83 100644 (file)
@@ -24,6 +24,7 @@
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeString.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Result.h>
@@ -41,6 +42,8 @@ void FeaturesPlugin_Recover::initAttributes()
   data()->addAttribute(BASE_FEATURE(), ModelAPI_AttributeReference::typeId());
   data()->addAttribute(RECOVERED_ENTITIES(), ModelAPI_AttributeRefList::typeId());
 
+  data()->addAttribute(METHOD(), ModelAPI_AttributeString::typeId());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), METHOD());
 }
 
 void FeaturesPlugin_Recover::execute()
@@ -81,3 +84,9 @@ void FeaturesPlugin_Recover::execute()
 
   removeResults(aResultIndex);
 }
+
+void FeaturesPlugin_Recover::attributeChanged(const std::string& theID)
+{
+  if (theID == METHOD())
+    reflist(RECOVERED_ENTITIES())->clear();
+}
index de1937a157aca646dfbffb3e1f2a32323728542e..ac2de898c1a744a2aa402873a5a27b89009889a3 100644 (file)
@@ -59,6 +59,26 @@ class FeaturesPlugin_Recover : public ModelAPI_Feature
     return MY_RECOVERED_ENTITIES_ID;
   }
 
+  /// Attribute name of the type of recover.
+  inline static const std::string& METHOD()
+  {
+    static const std::string MY_METHOD_ID("method");
+    return MY_METHOD_ID;
+  }
+
+  /// Value of default method, recovering concealed objects only.
+  inline static const std::string& METHOD_DEFAULT()
+  {
+    static const std::string MY_METHOD_ID("default");
+    return MY_METHOD_ID;
+  }
+  /// Value of method, recovering parent compounds of concealed objects.
+  inline static const std::string& METHOD_COMPOUND()
+  {
+    static const std::string MY_METHOD_ID("compound");
+    return MY_METHOD_ID;
+  }
+
   /// Returns the kind of a feature
   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
   {
@@ -72,6 +92,10 @@ class FeaturesPlugin_Recover : public ModelAPI_Feature
   /// Request for initialization of data model of the feature: adding all attributes
   FEATURESPLUGIN_EXPORT virtual void initAttributes();
 
+  /// Called on change of any argument-attribute of this object
+  /// \param theID identifier of changed attribute
+  FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
+
   /// Use plugin manager for features creation
   FeaturesPlugin_Recover();
 
diff --git a/src/FeaturesPlugin/Test/TestRecover_Compound.py b/src/FeaturesPlugin/Test/TestRecover_Compound.py
new file mode 100644 (file)
index 0000000..19703b4
--- /dev/null
@@ -0,0 +1,52 @@
+# 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 salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 50)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50, 2)
+LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 50, 3)
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "([LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_1][LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_2])([LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_1][LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_3])"), False)
+SketchLine_1 = SketchProjection_1.createdFeature()
+SketchCircle_1 = Sketch_1.addCircle(50, 25, 5)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
+SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchCircle_1.center(), SketchLine_1.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 100, 0)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_2_2")], [model.selection("SOLID", "Extrusion_1_1")], 20190506)
+Recover_1 = model.addRecover(Part_1_doc, Cut_1, [LinearCopy_2.result()], True)
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Part_1, 1)
+model.testNbSubResults(Part_1, [0])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.SOLID, [12])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.FACE, [37])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [82])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [164])
+model.testResultsVolumes(Part_1, [186975.51922585917])
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestRecover_Compsolid1.py b/src/FeaturesPlugin/Test/TestRecover_Compsolid1.py
new file mode 100644 (file)
index 0000000..7106ac6
--- /dev/null
@@ -0,0 +1,65 @@
+# 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 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"))
+SketchLine_1 = Sketch_1.addLine(31.9410018961801, -31.48668563219184, -26.28238891138439, -31.48668563219184)
+SketchLine_2 = Sketch_1.addLine(-26.28238891138439, -31.48668563219184, -26.28238891138439, 32.16845339608692)
+SketchLine_3 = Sketch_1.addLine(-26.28238891138439, 32.16845339608692, 31.9410018961801, 32.16845339608692)
+SketchLine_4 = Sketch_1.addLine(31.9410018961801, 32.16845339608692, 31.9410018961801, -31.48668563219184)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchLine_5 = Sketch_1.addLine(-26.28238891138439, -12.06888707668976, 31.9410018961801, 21.15910771625288)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_2.result())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_4.result())
+SketchLine_6 = Sketch_1.addLine(-0.02931756086478185, 2.913698204490415, 1.128717663020605, -31.48668563219184)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_5.result())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_1.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_4"))
+SketchCircle_1 = Sketch_2.addCircle(-4.420087352215441, 24.04732854606771, 12.87676926472621)
+model.do()
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 20, 80)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("SOLID", "Extrusion_2_1")], 20190506)
+Recover_1 = model.addRecover(Part_1_doc, Cut_1, [Extrusion_1.result()], True)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Part_1, 1)
+model.testNbSubResults(Part_1, [0])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.SOLID, [6])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.FACE, [41])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [182])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [364])
+model.testResultsVolumes(Part_1, [354429.714290673])
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestRecover_Compsolid2.py b/src/FeaturesPlugin/Test/TestRecover_Compsolid2.py
new file mode 100644 (file)
index 0000000..25b3799
--- /dev/null
@@ -0,0 +1,45 @@
+# 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 salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 100, 100, 100)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], -50, -50, -50)
+Partition_1_objects = [model.selection("SOLID", "Translation_1_1"), model.selection("FACE", "PartSet/XOY"), model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, 20190506)
+CompSolid_1_objects = [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_5"), model.selection("SOLID", "Partition_1_1_6"), model.selection("SOLID", "Partition_1_1_8")]
+CompSolid_1 = model.addCompSolid(Part_1_doc, CompSolid_1_objects)
+Recover_1 = model.addRecover(Part_1_doc, CompSolid_1, [Partition_1.result()], True)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Part_1, 1)
+model.testNbSubResults(Part_1, [0])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.SOLID, [12])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.FACE, [72])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [288])
+model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [576])
+model.testResultsVolumes(Part_1, [1500000])
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/icons/recover_compound_32x32.png b/src/FeaturesPlugin/icons/recover_compound_32x32.png
new file mode 100644 (file)
index 0000000..88b4752
Binary files /dev/null and b/src/FeaturesPlugin/icons/recover_compound_32x32.png differ
diff --git a/src/FeaturesPlugin/icons/recover_default_32x32.png b/src/FeaturesPlugin/icons/recover_default_32x32.png
new file mode 100644 (file)
index 0000000..caf0317
Binary files /dev/null and b/src/FeaturesPlugin/icons/recover_default_32x32.png differ
index 0e2f865f6e7c32f507448a8748e8e966a5e4ed53..e1f9f957e422a65fc54ec23d5ea7bc51ba2ba3b3 100644 (file)
@@ -4,7 +4,17 @@
                   tooltip="Select a feature that conceals results.">
     <validator id="FeaturesPlugin_ValidatorConcealedResult" parameters="recovered"/>
   </feature_selector>
-  <concealed_objects_view id="recovered"
-                  tooltip="Concealed results to be recevered"
-                  base_shape_attribute="base_feature"/>
+  <toolbox id="method">
+    <box id="default" title="Concealed results" icon="icons/Features/recover_default_32x32.png">
+      <concealed_objects_view id="recovered"
+                              tooltip="Concealed results to be recevered"
+                              base_shape_attribute="base_feature"/>
+    </box>
+    <box id="compound" title="Concealed compounds" icon="icons/Features/recover_compound_32x32.png">
+      <concealed_objects_view id="recovered"
+                              tooltip="Concealed results to be recevered"
+                              base_shape_attribute="base_feature"
+                              pick_concealed_parents="1"/>
+    </box>
+  </toolbox>
 </source>
index 5154ea04a4410abce48dca8522c6c22579351dcf..811c7167ce0d166bccb1134a1fa7c205bf9e82f6 100644 (file)
@@ -21,6 +21,7 @@
 #include <ModuleBase_Tools.h>
 
 #include <ModelAPI_Result.h>
+#include <ModelAPI_ResultBody.h>
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_Session.h>
@@ -37,6 +38,8 @@
 #include <QCheckBox>
 #include <QVBoxLayout>
 
+#include <algorithm>
+
 const int DEFAULT_NAME_COLUMN_WIDTH = 200;
 
 ModuleBase_WidgetConcealedObjects::ModuleBase_WidgetConcealedObjects(QWidget* theParent,
@@ -44,6 +47,10 @@ ModuleBase_WidgetConcealedObjects::ModuleBase_WidgetConcealedObjects(QWidget* th
 : ModuleBase_ModelWidget(theParent, theData)
 {
   myBaseShapeAttribute = theData->getProperty("base_shape_attribute");
+  std::string aPickParents = theData->getProperty("pick_concealed_parents");
+  std::transform(aPickParents.begin(), aPickParents.end(), aPickParents.begin(), std::tolower);
+  myPickConcealedParents = aPickParents == "1" || aPickParents == "true" || aPickParents == "yes";
+
   QGridLayout* aMainLay = new QGridLayout(this);
   ModuleBase_Tools::adjustMargins(aMainLay);
 
@@ -92,11 +99,24 @@ bool ModuleBase_WidgetConcealedObjects::restoreValueCustom()
     myBaseFeature = aBaseFeature;
     if (myBaseFeature.get()) {
       std::list<std::shared_ptr<ModelAPI_Result> > aResults;
+      std::set<ResultBodyPtr> aParents;
       ModelAPI_Tools::getConcealedResults(myBaseFeature, aResults);
       std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator anIt = aResults.begin(),
                                                                    aLast = aResults.end();
       for (; anIt != aLast; anIt++) {
         ResultPtr aResult = *anIt;
+        if (myPickConcealedParents) {
+          // pick the parent result of the concealed object
+          ResultBodyPtr aRootParent = ModelAPI_Tools::bodyOwner(aResult, true);
+          if (aRootParent) {
+            if (aParents.find(aRootParent) == aParents.end()) {
+              aResult = aRootParent;
+              aParents.insert(aRootParent);
+            }
+            else // do not add parent compound once again
+              continue;
+          }
+        }
 
         int aRowId = myView->rowCount();
         addViewRow(aResult);
index 9d38d836a99cb85932fd42d17abdf99eb3b13866..f785dada95c24078221fbd57d537800e8d4443a1 100644 (file)
@@ -73,6 +73,7 @@ private slots:
 
 private:
   std::string myBaseShapeAttribute; ///< attribute of the base object
+  bool myPickConcealedParents; ///< select parent compsolid/compounds of concealed objects
   QTableWidget* myView; ///< table view of visibility states
 
   std::shared_ptr<ModelAPI_Feature> myBaseFeature; ///< backup of feature of filling the table view