]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Task 2.5. Combination operations on Groups (issue #2935)
authorazv <azv@opencascade.com>
Thu, 8 Aug 2019 10:14:38 +0000 (13:14 +0300)
committerazv <azv@opencascade.com>
Thu, 8 Aug 2019 10:28:55 +0000 (13:28 +0300)
Implement Group Intersection feature.

16 files changed:
src/CollectionAPI/CMakeLists.txt
src/CollectionAPI/CollectionAPI.i
src/CollectionAPI/CollectionAPI_GroupAddition.h
src/CollectionAPI/CollectionAPI_GroupIntersection.cpp [new file with mode: 0644]
src/CollectionAPI/CollectionAPI_GroupIntersection.h [new file with mode: 0644]
src/CollectionPlugin/CMakeLists.txt
src/CollectionPlugin/CollectionPlugin_GroupIntersection.cpp [new file with mode: 0644]
src/CollectionPlugin/CollectionPlugin_GroupIntersection.h [new file with mode: 0644]
src/CollectionPlugin/CollectionPlugin_Plugin.cpp
src/CollectionPlugin/CollectionPlugin_msg_en.ts
src/CollectionPlugin/Test/TestGroupIntersection.py [new file with mode: 0644]
src/CollectionPlugin/Test/TestGroupIntersection_Error.py [new file with mode: 0644]
src/CollectionPlugin/group_addition_widget.xml
src/CollectionPlugin/group_intersection_widget.xml
src/CollectionPlugin/plugin-Collection.xml
src/PythonAPI/model/collection/__init__.py

index f9ca6033bd8e731332821580257816fb001e3127..0bf7bffa4ff751c3b2d09d53d9f7843e54d3ec89 100644 (file)
@@ -23,12 +23,14 @@ SET(PROJECT_HEADERS
   CollectionAPI.h
   CollectionAPI_Group.h
   CollectionAPI_GroupAddition.h
+  CollectionAPI_GroupIntersection.h
   CollectionAPI_Field.h
 )
 
 SET(PROJECT_SOURCES
   CollectionAPI_Group.cpp
   CollectionAPI_GroupAddition.cpp
+  CollectionAPI_GroupIntersection.cpp
   CollectionAPI_Field.cpp
 )
 
index 2dee7dd08610cd66c0abcf2fc8502cd03b1a318b..a4fbd35ec080e0d1db14dd9fd14165509644f886 100644 (file)
@@ -30,6 +30,7 @@
   #include "CollectionAPI.h"
   #include "CollectionAPI_Group.h"
   #include "CollectionAPI_GroupAddition.h"
+  #include "CollectionAPI_GroupIntersection.h"
   #include "CollectionAPI_Field.h"
 
 #endif // CollectionAPI_swig_H_
 // shared pointers
 %shared_ptr(CollectionAPI_Group)
 %shared_ptr(CollectionAPI_GroupAddition)
+%shared_ptr(CollectionAPI_GroupIntersection)
 %shared_ptr(CollectionAPI_Field)
 
 // all supported interfaces
 %include "CollectionAPI_Group.h"
 %include "CollectionAPI_GroupAddition.h"
+%include "CollectionAPI_GroupIntersection.h"
 %include "CollectionAPI_Field.h"
index c6395300d2e0371cdbe9ac7bbaab8c1eb5c7f6d0..102e84afae3192afa70674b3ed173ca8e9eeefc2 100644 (file)
@@ -32,7 +32,7 @@ class ModelHighAPI_Selection;
 
 /// \class CollectionAPI_GroupAddition
 /// \ingroup CPPHighAPI
-/// \brief Interface for Group feature.
+/// \brief Interface for Group Addition feature.
 class CollectionAPI_GroupAddition : public ModelHighAPI_Interface
 {
 public:
@@ -71,4 +71,4 @@ COLLECTIONAPI_EXPORT
 GroupAdditionPtr addGroupAddition(const std::shared_ptr<ModelAPI_Document>& thePart,
                                   const std::list<ModelHighAPI_Selection>& theGroupsList);
 
-#endif // CollectionAPI_Group_H_
+#endif // CollectionAPI_GroupAddition_H_
diff --git a/src/CollectionAPI/CollectionAPI_GroupIntersection.cpp b/src/CollectionAPI/CollectionAPI_GroupIntersection.cpp
new file mode 100644 (file)
index 0000000..7d4fad7
--- /dev/null
@@ -0,0 +1,71 @@
+// 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
+//
+
+#include "CollectionAPI_GroupIntersection.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Tools.h>
+
+CollectionAPI_GroupIntersection::CollectionAPI_GroupIntersection(
+    const std::shared_ptr<ModelAPI_Feature>& theFeature)
+  : ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+CollectionAPI_GroupIntersection::CollectionAPI_GroupIntersection(
+    const std::shared_ptr<ModelAPI_Feature>& theFeature,
+    const std::list<ModelHighAPI_Selection>& theGroupList)
+  : ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    setGroupList(theGroupList);
+  }
+}
+
+CollectionAPI_GroupIntersection::~CollectionAPI_GroupIntersection()
+{
+}
+
+void CollectionAPI_GroupIntersection::setGroupList(
+    const std::list<ModelHighAPI_Selection>& theGroupList)
+{
+  fillAttribute(theGroupList, mygroupList);
+  execute();
+}
+
+void CollectionAPI_GroupIntersection::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+  const std::string& aDocName = theDumper.name(aBase->document());
+
+  AttributeSelectionListPtr anAttrList =
+      aBase->selectionList(CollectionPlugin_GroupIntersection::LIST_ID());
+
+  theDumper << aBase << " = model.addGroupIntersection(" << aDocName << ", "
+            << anAttrList << ")" << std::endl;
+}
+
+GroupIntersectionPtr addGroupIntersection(const std::shared_ptr<ModelAPI_Document>& thePart,
+                                          const std::list<ModelHighAPI_Selection>& theGroupList)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+      thePart->addFeature(CollectionAPI_GroupIntersection::ID());
+  return GroupIntersectionPtr(new CollectionAPI_GroupIntersection(aFeature, theGroupList));
+}
diff --git a/src/CollectionAPI/CollectionAPI_GroupIntersection.h b/src/CollectionAPI/CollectionAPI_GroupIntersection.h
new file mode 100644 (file)
index 0000000..007853c
--- /dev/null
@@ -0,0 +1,74 @@
+// 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
+//
+
+#ifndef CollectionAPI_GroupIntersection_H_
+#define CollectionAPI_GroupIntersection_H_
+
+#include "CollectionAPI.h"
+
+#include <CollectionPlugin_GroupIntersection.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Dumper;
+class ModelHighAPI_Selection;
+
+/// \class CollectionAPI_GroupIntersection
+/// \ingroup CPPHighAPI
+/// \brief Interface for Group Intersection feature.
+class CollectionAPI_GroupIntersection : public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  COLLECTIONAPI_EXPORT
+  explicit CollectionAPI_GroupIntersection(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  COLLECTIONAPI_EXPORT
+  CollectionAPI_GroupIntersection(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                  const std::list<ModelHighAPI_Selection>& theGroupList);
+
+  /// Destructor.
+  COLLECTIONAPI_EXPORT
+  virtual ~CollectionAPI_GroupIntersection();
+
+  INTERFACE_1(CollectionPlugin_GroupIntersection::ID(),
+              groupList, CollectionPlugin_GroupIntersection::LIST_ID(),
+              ModelAPI_AttributeSelectionList, /** Group list*/)
+
+  /// Set main objects.
+  COLLECTIONAPI_EXPORT
+  void setGroupList(const std::list<ModelHighAPI_Selection>& theGroupList);
+
+  /// Dump wrapped feature
+  COLLECTIONAPI_EXPORT
+  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Group Addition object.
+typedef std::shared_ptr<CollectionAPI_GroupIntersection> GroupIntersectionPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Group Intersection feature.
+COLLECTIONAPI_EXPORT
+GroupIntersectionPtr addGroupIntersection(const std::shared_ptr<ModelAPI_Document>& thePart,
+                                          const std::list<ModelHighAPI_Selection>& theGroupsList);
+
+#endif // CollectionAPI_GroupIntersection_H_
index a19513883a395a360fc992cf93eab3bed0bf6bba..77ef3615db4970732709ba0656d2c9edceb217f5 100644 (file)
@@ -32,6 +32,7 @@ SET(PROJECT_HEADERS
     CollectionPlugin_Plugin.h
     CollectionPlugin_Group.h
     CollectionPlugin_GroupAddition.h
+    CollectionPlugin_GroupIntersection.h
     CollectionPlugin_Field.h
     CollectionPlugin_WidgetCreator.h
     CollectionPlugin_WidgetField.h
@@ -46,6 +47,7 @@ SET(PROJECT_SOURCES
     CollectionPlugin_Plugin.cpp
     CollectionPlugin_Group.cpp
     CollectionPlugin_GroupAddition.cpp
+    CollectionPlugin_GroupIntersection.cpp
     CollectionPlugin_Field.cpp
     CollectionPlugin_WidgetCreator.cpp
     CollectionPlugin_WidgetField.cpp
@@ -135,4 +137,6 @@ ADD_UNIT_TESTS(
                TestGroupShareTopology.py
                TestGroupAddition.py
                TestGroupAddition_Error.py
+               TestGroupIntersection.py
+               TestGroupIntersection_Error.py
 )
diff --git a/src/CollectionPlugin/CollectionPlugin_GroupIntersection.cpp b/src/CollectionPlugin/CollectionPlugin_GroupIntersection.cpp
new file mode 100644 (file)
index 0000000..e74ba47
--- /dev/null
@@ -0,0 +1,103 @@
+// 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
+//
+
+#include "CollectionPlugin_GroupIntersection.h"
+
+#include <ModelAPI_Data.h>
+#include <ModelAPI_Document.h>
+#include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_ResultGroup.h>
+
+#include <GeomAPI_ShapeIterator.h>
+#include <GeomAlgoAPI_CompoundBuilder.h>
+#include <GeomAlgoAPI_ShapeTools.h>
+
+typedef std::set<GeomShapePtr, GeomAPI_Shape::ComparatorWithOri> SetOfShape;
+
+CollectionPlugin_GroupIntersection::CollectionPlugin_GroupIntersection()
+{
+}
+
+void CollectionPlugin_GroupIntersection::initAttributes()
+{
+  data()->addAttribute(CollectionPlugin_GroupIntersection::LIST_ID(),
+                       ModelAPI_AttributeSelectionList::typeId());
+}
+
+static void explodeCompound(const GeomShapePtr& theCompound, SetOfShape& theSet)
+{
+  for (GeomAPI_ShapeIterator anIt(theCompound); anIt.more(); anIt.next())
+    theSet.insert(anIt.current());
+}
+
+static void keepCommonShapes(const GeomShapePtr& theCompound, ListOfShape& theShapes)
+{
+  if (theShapes.empty()) {
+    for (GeomAPI_ShapeIterator anIt(theCompound); anIt.more(); anIt.next())
+      theShapes.push_back(anIt.current());
+  }
+  else {
+    SetOfShape aSubs;
+    explodeCompound(theCompound, aSubs);
+
+    ListOfShape::iterator anIt = theShapes.begin();
+    while (anIt != theShapes.end()) {
+      if (aSubs.find(*anIt) == aSubs.end()) {
+        // the shape is not found
+        ListOfShape::iterator aRemoveIt = anIt++;
+        theShapes.erase(aRemoveIt);
+      }
+      else
+        ++anIt;
+    }
+  }
+}
+
+void CollectionPlugin_GroupIntersection::execute()
+{
+  ResultGroupPtr aGroup = document()->createGroup(data());
+  // clean the result of the operation
+  aGroup->store(GeomShapePtr());
+
+  // shapes containing in each group
+  ListOfShape aCommon;
+
+  // collect shapes containing in all groups
+  AttributeSelectionListPtr aSelectedGroups = selectionList(LIST_ID());
+  for (int anIndex = 0; anIndex < aSelectedGroups->size(); ++anIndex) {
+    AttributeSelectionPtr aCurSelection = aSelectedGroups->value(anIndex);
+    ResultGroupPtr aCurGroup =
+        std::dynamic_pointer_cast<ModelAPI_ResultGroup>(aCurSelection->context());
+    keepCommonShapes(aCurGroup->shape(), aCommon);
+    if (aCommon.empty())
+      break;
+  }
+
+  if (aCommon.empty()) {
+    setError("Error: Empty result.");
+    removeResults(0);
+  }
+  else {
+    GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aCommon);
+    aGroup->store(aCompound);
+    setResult(aGroup);
+  }
+}
diff --git a/src/CollectionPlugin/CollectionPlugin_GroupIntersection.h b/src/CollectionPlugin/CollectionPlugin_GroupIntersection.h
new file mode 100644 (file)
index 0000000..115f3f5
--- /dev/null
@@ -0,0 +1,67 @@
+// 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
+//
+
+#ifndef COLLECTIONPLUGIN_GROUPINTERSECTION_H_
+#define COLLECTIONPLUGIN_GROUPINTERSECTION_H_
+
+#include "CollectionPlugin.h"
+#include "CollectionPlugin_Group.h"
+
+/**\class CollectionPlugin_GroupIntersection
+ * \ingroup Plugins
+ * \brief Merge several groups of same shape type into single group.
+ */
+class CollectionPlugin_GroupIntersection : public CollectionPlugin_Group
+{
+ public:
+  /// Extrusion kind
+  inline static const std::string& ID()
+  {
+    static const std::string MY_GROUP_ID("GroupIntersection");
+    return MY_GROUP_ID;
+  }
+  /// attribute name of selected entities list
+  inline static const std::string& LIST_ID()
+  {
+    static const std::string MY_GROUP_LIST_ID("group_list");
+    return MY_GROUP_LIST_ID;
+  }
+
+  /// Returns the kind of a feature
+  COLLECTIONPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = CollectionPlugin_GroupIntersection::ID();
+    return MY_KIND;
+  }
+
+  /// Creates a new group result if needed
+  COLLECTIONPLUGIN_EXPORT virtual void execute();
+
+  /// Request for initialization of data model of the feature: adding all attributes
+  COLLECTIONPLUGIN_EXPORT virtual void initAttributes();
+
+  /// Result of groups is created on the fly and don't stored to the document
+  COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return true;}
+
+  /// Use plugin manager for features creation
+  CollectionPlugin_GroupIntersection();
+
+};
+
+#endif
index 560615e5ecccbb1ae81830b50b5ceb1a8bb8ed17..d8514f518b583a19fb6c97de7db4608bb97fd94b 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <CollectionPlugin_Group.h>
 #include <CollectionPlugin_GroupAddition.h>
+#include <CollectionPlugin_GroupIntersection.h>
 #include <CollectionPlugin_Field.h>
 #include <CollectionPlugin_Validators.h>
 #include <ModelAPI_Session.h>
@@ -61,6 +62,8 @@ FeaturePtr CollectionPlugin_Plugin::createFeature(std::string theFeatureID)
     return FeaturePtr(new CollectionPlugin_Field);
   } else if (theFeatureID == CollectionPlugin_GroupAddition::ID()) {
     return FeaturePtr(new CollectionPlugin_GroupAddition);
+  } else if (theFeatureID == CollectionPlugin_GroupIntersection::ID()) {
+    return FeaturePtr(new CollectionPlugin_GroupIntersection);
   }
 
   // feature of such kind is not found
index 061f3923dee325bbad096d981a30234e417c17fb..3c2d28234f0d7a1e12046faff1037271fad59caa 100644 (file)
       <translation>Components are not selected</translation>
     </message>
   </context>
+  <context>
+    <name>GroupIntersection:EmptyResult</name>
+    <message>
+      <source>Error: Empty result.</source>
+      <translation>Error: Empty result.</translation>
+    </message>
+  </context>
 
 </TS>
diff --git a/src/CollectionPlugin/Test/TestGroupIntersection.py b/src/CollectionPlugin/Test/TestGroupIntersection.py
new file mode 100644 (file)
index 0000000..e53bfb1
--- /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, 10, 10, 10)
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")])
+Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")])
+Group_3_objects = [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Top")]
+Group_3 = model.addGroup(Part_1_doc, Group_3_objects)
+GroupIntersection_1_objects = [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2"), model.selection("COMPOUND", "Group_3")]
+GroupIntersection_1 = model.addGroupIntersection(Part_1_doc, GroupIntersection_1_objects)
+model.end()
+
+from GeomAPI import *
+
+model.testNbResults(GroupIntersection_1, 1)
+model.testNbSubResults(GroupIntersection_1, [0])
+model.testNbSubShapes(GroupIntersection_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(GroupIntersection_1, GeomAPI_Shape.FACE, [1])
+model.testNbSubShapes(GroupIntersection_1, GeomAPI_Shape.EDGE, [4])
+model.testNbSubShapes(GroupIntersection_1, GeomAPI_Shape.VERTEX, [8])
+model.testResultsVolumes(GroupIntersection_1, [100])
+
+assert(model.checkPythonDump())
diff --git a/src/CollectionPlugin/Test/TestGroupIntersection_Error.py b/src/CollectionPlugin/Test/TestGroupIntersection_Error.py
new file mode 100644 (file)
index 0000000..cfa9601
--- /dev/null
@@ -0,0 +1,34 @@
+# 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, 10, 10, 10)
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")])
+Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")])
+Group_3 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Right")])
+GroupIntersection_1_objects = [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2"), model.selection("COMPOUND", "Group_3")]
+GroupIntersection_1 = model.addGroupIntersection(Part_1_doc, GroupIntersection_1_objects)
+model.end()
+
+assert(GroupIntersection_1.feature().error() != "")
index 510e6953cc485dd292215c9f5c5b319d215a4a94..6274511c08d658e3d1ea9d444e16cc6a86492c4f 100644 (file)
@@ -8,4 +8,4 @@
                   type_choice="objects">
     <validator id="CollectionPlugin_OperationAttribute"/>
   </multi_selector>
-</source>
\ No newline at end of file
+</source>
index 3a1f83feb772573df3df2b5e9777b445eddd0ea6..6274511c08d658e3d1ea9d444e16cc6a86492c4f 100644 (file)
@@ -1,15 +1,11 @@
 <source>
   <namevalue id="name"
-    label="Name"
-    placeholder="Please input the group name">
+             label="Name"
+             placeholder="Please input the group name">
   </namevalue>
   <multi_selector id="group_list"
-    tooltip="Select a set of objects"
-    type_choice="Vertices Edges Faces Solids"
-    use_choice="true"
-    clear_in_neutral_point="false"
-    filter_points="false"
-    same_topology="true">
-    <validator id="GeomValidators_BodyShapes"/>
+                  tooltip="Select a set of groups"
+                  type_choice="objects">
+    <validator id="CollectionPlugin_OperationAttribute"/>
   </multi_selector>
-</source>
\ No newline at end of file
+</source>
index 9ec5c5dd6602e612d2b122c920c1a5b744babe4b..29520489847df724966e59066d934c4cf4159558 100644 (file)
         helpfile="groupAdditionFeature.html">
         <source path="group_addition_widget.xml"/>
       </feature>
+
+      <feature id="GroupIntersection"
+        title="Group Intersection"
+        tooltip="Get elements existing in all groups"
+        icon="icons/Collection/group_intersection.png"
+        apply_continue="true"
+        helpfile="groupIntersectionFeature.html">
+        <source path="group_intersection_widget.xml"/>
+      </feature>
     </group>
   </workbench>
 </plugin>
index 96b7089cea35993c65872f60f0b84e236e07eb81..3e96808fd88800f976f3e6b8b574f0dcac62b6b6 100644 (file)
@@ -20,4 +20,4 @@
 """
 
 from CollectionAPI import addGroup, addField
-from CollectionAPI import addGroupAddition
+from CollectionAPI import addGroupAddition, addGroupIntersection