Salome HOME
modif
authorGérald NICOLAS <gerald.nicolas@edf.fr>
Thu, 11 May 2023 11:38:41 +0000 (13:38 +0200)
committerGérald NICOLAS <gerald.nicolas@edf.fr>
Thu, 11 May 2023 11:38:41 +0000 (13:38 +0200)
src/FeaturesAPI/CMakeLists.txt
src/FeaturesAPI/FeaturesAPI.i
src/FeaturesAPI/FeaturesAPI_swig.h
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp
src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp
src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts
src/FeaturesPlugin/plugin-Features.xml
src/FeaturesPlugin/tests.set
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h

index 15254f37d20640ea338e40025660ef56cb742c31..13c520322e516653bdd8da2768e74f6f1a37f2af 100644 (file)
@@ -60,6 +60,7 @@ SET(PROJECT_HEADERS
   FeaturesAPI_GeometryCalculation.h
   FeaturesAPI_BoundingBox.h
   FeaturesAPI_LimitTolerance.h
+  FeaturesAPI_SharedFaces.h
 )
 
 SET(PROJECT_SOURCES
@@ -102,6 +103,7 @@ SET(PROJECT_SOURCES
   FeaturesAPI_GeometryCalculation.cpp
   FeaturesAPI_BoundingBox.cpp
   FeaturesAPI_LimitTolerance.cpp
+  FeaturesAPI_SharedFaces.cpp
 )
 
 SET(PROJECT_LIBRARIES
index 0e444f027fe53407befc722901ae24e330dbed6d..bab98e950b559dc43bd384dd1e0b289a85ddb235 100644 (file)
@@ -99,6 +99,7 @@
 %shared_ptr(FeaturesAPI_Rotation)
 %shared_ptr(FeaturesAPI_Scale)
 %shared_ptr(FeaturesAPI_Sewing)
+%shared_ptr(FeaturesAPI_SharedFaces)
 %shared_ptr(FeaturesAPI_Symmetry)
 %shared_ptr(FeaturesAPI_Translation)
 %shared_ptr(FeaturesAPI_Union)
 %include "FeaturesAPI_Rotation.h"
 %include "FeaturesAPI_Scale.h"
 %include "FeaturesAPI_Sewing.h"
+%include "FeaturesAPI_SharedFaces.h"
 %include "FeaturesAPI_Symmetry.h"
 %include "FeaturesAPI_Translation.h"
 %include "FeaturesAPI_Union.h"
index a440abd0ba77cf56463d935dde9a33c0392a8c3d..53bdbb86feb35d44eb7b747b70b452f04e464cb6 100644 (file)
@@ -62,5 +62,6 @@
   #include "FeaturesAPI_GeometryCalculation.h"
   #include "FeaturesAPI_BoundingBox.h"
   #include "FeaturesAPI_LimitTolerance.h"
+  #include "FeaturesAPI_SharedFaces.h"
 
 #endif // FeaturesAPI_swig_H_
index d4db12a9df572450c8489ae5d864c45805d2fc25..198f7d82f4a9f1012a86ef45a21f7ec53e80371b 100644 (file)
@@ -79,6 +79,9 @@ SET(PROJECT_HEADERS
     FeaturesPlugin_InspectNormalToFace.h
     FeaturesPlugin_GlueFaces.h
     FeaturesPlugin_LimitTolerance.h
+    FeaturesPlugin_CommonSharedFaces.h
+    FeaturesPlugin_GroupSharedFaces.h
+    FeaturesPlugin_SharedFaces.h
 )
 
 SET(PROJECT_SOURCES
@@ -138,6 +141,9 @@ SET(PROJECT_SOURCES
     FeaturesPlugin_InspectNormalToFace.cpp
     FeaturesPlugin_GlueFaces.cpp
     FeaturesPlugin_LimitTolerance.cpp
+    FeaturesPlugin_CommonSharedFaces.cpp
+    FeaturesPlugin_GroupSharedFaces.cpp
+    FeaturesPlugin_SharedFaces.cpp
 )
 
 SET(XML_RESOURCES
@@ -184,6 +190,8 @@ SET(XML_RESOURCES
   normal_to_face_widget.xml
   create_normal_to_face_widget.xml
   limit_tolerance_widget.xml
+  shared_faces_macro_widget.xml
+  shared_faces_widget.xml
 )
 
 SET(TEXT_RESOURCES
@@ -204,6 +212,7 @@ INCLUDE_DIRECTORIES(
   ../ModuleBase
   ../Events
   ../Config
+  ../Locale
   ${OpenCASCADE_INCLUDE_DIR}
 )
 
index 310f84f12313f41cfbf51f4cc8d781b65f0f5494..02b5c0738a85c640c597d57bf4411d960f3b9e22 100644 (file)
@@ -108,6 +108,7 @@ void FeaturesPlugin_BooleanCut::execute()
 
   // When selecting a compound tool object, use its exploded subshapes as tool object instead.
   const ListOfShape aToolList = ExplodeCompounds(aTools.objects());
+
   // For solids cut each object with all tools.
   bool isOk = true;
   for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin();
index 5c312469bd333f97c6161cb6bdab543a75dacd05..9659812ad44c59b0c72470cf40d559b458007f92 100644 (file)
@@ -34,6 +34,7 @@
 #include <FeaturesPlugin_Fillet1D.h>
 #include <FeaturesPlugin_GeometryCalculation.h>
 #include <FeaturesPlugin_GlueFaces.h>
+#include <FeaturesPlugin_GroupSharedFaces.h>
 #include <FeaturesPlugin_InspectBoundingBox.h>
 #include <FeaturesPlugin_InspectNormalToFace.h>
 #include <FeaturesPlugin_Intersection.h>
@@ -56,6 +57,7 @@
 #include <FeaturesPlugin_Rotation.h>
 #include <FeaturesPlugin_Scale.h>
 #include <FeaturesPlugin_Sewing.h>
+#include <FeaturesPlugin_SharedFaces.h>
 #include <FeaturesPlugin_Symmetry.h>
 #include <FeaturesPlugin_Translation.h>
 #include <FeaturesPlugin_Union.h>
@@ -236,6 +238,10 @@ FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID)
     return FeaturePtr(new FeaturesPlugin_PointCloudOnFace);
   } else if (theFeatureID == FeaturesPlugin_LimitTolerance::ID()) {
     return FeaturePtr(new FeaturesPlugin_LimitTolerance);
+  } else if (theFeatureID == FeaturesPlugin_SharedFaces::ID()) {
+    return FeaturePtr(new FeaturesPlugin_SharedFaces);
+  } else if (theFeatureID == FeaturesPlugin_GroupSharedFaces::ID()) {
+    return FeaturePtr(new FeaturesPlugin_GroupSharedFaces);
   }
 
 
index 41fa7dca7e680655f889a68c332aa2810d20c982..a01ffc9bc19e22eb61e295bf8b853174e8889e90 100644 (file)
       <source>Bounding box</source>
       <translation>Boîte englobante</translation>
     </message>
+    <message>
+      <source>Check shared faces</source>
+      <translation>Vérifier les faces partagées</translation>
+    </message>
     <message>
       <source>Placement</source>
       <translation>Placement</translation>
     </message>
   </context>
 
+  <!-- Check shared faces -->
+  <context>
+    <name>Shared_faces_macro</name>
+    <message>
+      <source>Check shared faces</source>
+      <translation>Vérifier les faces partagées</translation>
+    </message>
+    <message>
+      <source>Shared faces</source>
+      <translation>Faces partagées</translation>
+    </message>
+    <message>
+      <source>Number of shared faces : </source>
+      <translation>Nombre de faces partagées : </translation>
+    </message>
+  </context>
+  <context>
+    <name>Shared_faces_macro:create_group</name>
+    <message>
+      <source>Create group</source>
+      <translation>Créer un groupe</translation>
+    </message>
+  </context>
+  <context>
+      <name>Shared_faces_macro:group_name</name>
+    <message>
+      <source>Group name</source>
+      <translation>Nom du groupe</translation>
+    </message>
+  </context>
+  <context>
+    <name>Shared_faces_macro:main_object</name>
+    <message>
+      <source>Object</source>
+      <translation>Objet</translation>
+    </message>
+    <message>
+      <source>Shared faces</source>
+      <translation>Faces partagées</translation>
+    </message>
+  </context>
+  <context>
+      <name>Shared_faces_macro:group_list</name>
+    <message>
+      <source>Shared faces</source>
+      <translation>Faces partagées</translation>
+    </message>   
+    <message>
+      <source>List of faces :</source>
+      <translation>Liste des faces :</translation>
+    </message>
+  </context>
+  <context>
+    <name>Shared_faces_macro:transparency</name>
+    <message>
+      <source>Transparency</source>
+      <translation>Transparence</translation>
+    </message>
+  </context>
+  <context>
+    <name>Shared_faces</name>
+    <message>
+      <source>Check shared faces</source>
+      <translation>Vérifier les faces partagées</translation>
+    </message>
+    <message>
+      <source>Shared faces</source>
+      <translation>Faces partagées</translation>
+    </message>
+    <message>
+      <source>Number of shared faces : </source>
+      <translation>Nombre de faces partagées : </translation>
+    </message>
+  </context>
+  <context>
+    <name>Shared_faces:create_group</name>
+    <message>
+      <source>Create group</source>
+      <translation>Créer un groupe</translation>
+    </message>
+  </context>
+  <context>
+      <name>Shared_faces:group_name</name>
+    <message>
+      <source>Group name</source>
+      <translation>Nom du groupe</translation>
+    </message>
+  </context>
+  <context>
+    <name>Shared_faces:main_object</name>
+    <message>
+      <source>Object</source>
+      <translation>Objet</translation>
+    </message>
+    <message>
+      <source>Shared faces</source>
+      <translation>Faces partagées</translation>
+    </message>
+  </context>
+  <context>
+      <name>Shared_faces:group_list</name>
+    <message>
+      <source>Shared faces</source>
+      <translation>Faces partagées</translation>
+    </message>   
+    <message>
+      <source>List of faces :</source>
+      <translation>Liste des faces :</translation>
+    </message>
+  </context>
+  <context>
+    <name>Shared_faces:transparency</name>
+    <message>
+      <source>Transparency</source>
+      <translation>Transparence</translation>
+    </message>
+  </context>
+
   <!-- Symmetry -->
   <context>
     <name>Symmetry</name>
index 14c8cf72761a0630652a71800ec63a9241182752..3bebe12a5e9fc07aae90ce4b15fa4c208e82cf5a 100644 (file)
                icon="icons/Features/axis.png" helpfile="normalToFaceFeature.html" internal="1">
         <source path="create_normal_to_face_widget.xml"/>
       </feature>
+      <feature id="Shared_faces_macro" title="Check shared faces" tooltip="Check the shared faces" auto_preview="true"
+               icon="icons/Features/shared_shapes.png" helpfile="checkSharedFaceFeature.html">
+        <source path="shared_faces_macro_widget.xml"/>
+      </feature>
+      <feature id="Shared_faces" title="Check shared faces" tooltip="Check the shared faces" auto_preview="true"
+               icon="icons/Features/shared_shapes.png" helpfile="checkSharedFaceFeature.html" internal="1">
+        <source path="shared_faces_widget.xml"/>
+      </feature>
     </group>
   </workbench>
 </plugin>
index 98f8623c6e627e6f85f3dabf1bf004dc4c4e7614..eca27f5167d03bd0fe4c16ace0ee77adf925c600 100644 (file)
@@ -543,6 +543,7 @@ SET(TEST_NAMES_PARA
                TestBooleanCut_Fuzzy_2.py
                TestBooleanFuse_Fuzzy.py
                TestBooleanCommon_Fuzzy.py
+               TestCheckSharedFaces.py
 )
 
 SET(TEST_NAMES_SEQ
index 1a10fc35390f651ba9e8fe7e00340213e0cbb1ad..31087ffc083a621c2c384d1186852ea1528ef11a 100644 (file)
@@ -1781,3 +1781,20 @@ void GeomAlgoAPI_ShapeTools::computeThroughAll(const ListOfShape& theObjects,
     }
   }
 }
+
+ListOfShape GeomAlgoAPI_ShapeTools::getSharedFaces(const GeomShapePtr& theShape)
+{
+  ListOfShape aSharedFaces;
+  TopTools_IndexedDataMapOfShapeListOfShape aMapFS;
+  TopExp::MapShapesAndUniqueAncestors(theShape->impl<TopoDS_Shape>(),
+                                      TopAbs_FACE, TopAbs_SOLID, aMapFS);
+  for (Standard_Integer i = 1; i <= aMapFS.Extent(); i++) {
+    const TopTools_ListOfShape& ancestors = aMapFS.FindFromIndex(i);
+    if (ancestors.Size() > 1) {
+      GeomShapePtr aFace(new GeomAPI_Shape);
+      aFace->setImpl<TopoDS_Shape>(new TopoDS_Shape(aMapFS.FindKey(i)));
+      aSharedFaces.push_back(aFace);
+    }
+  }
+  return aSharedFaces;
+}
index 0c058e147472dcce39bd0b92716dc2fad1f4bf22..b1697bd0c1fc5aeaed2f7dbb49da74effd28df89 100644 (file)
@@ -235,6 +235,11 @@ public:
                                                    const ListOfShape& theBaseShapes,
                                                    const std::shared_ptr<GeomAPI_Dir> theDir,
                                                    double& theToSize, double& theFromSize);
+
+  /// \brief Get shared faces of a shape
+  /// \param[in] theShape shape that should be exploded
+  /// \return list of shared faces
+  GEOMALGOAPI_EXPORT static ListOfShape getSharedFaces(const GeomShapePtr& theShape);
 };
 
 #endif