From af47a94528d48b267a789133bf9f51a145257948 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=A9rald=20NICOLAS?= Date: Thu, 11 May 2023 13:38:41 +0200 Subject: [PATCH] modif --- src/FeaturesAPI/CMakeLists.txt | 2 + src/FeaturesAPI/FeaturesAPI.i | 2 + src/FeaturesAPI/FeaturesAPI_swig.h | 1 + src/FeaturesPlugin/CMakeLists.txt | 9 ++ .../FeaturesPlugin_BooleanCut.cpp | 1 + src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp | 6 + src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts | 122 ++++++++++++++++++ src/FeaturesPlugin/plugin-Features.xml | 8 ++ src/FeaturesPlugin/tests.set | 1 + src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp | 17 +++ src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h | 5 + 11 files changed, 174 insertions(+) diff --git a/src/FeaturesAPI/CMakeLists.txt b/src/FeaturesAPI/CMakeLists.txt index 15254f37d..13c520322 100644 --- a/src/FeaturesAPI/CMakeLists.txt +++ b/src/FeaturesAPI/CMakeLists.txt @@ -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 diff --git a/src/FeaturesAPI/FeaturesAPI.i b/src/FeaturesAPI/FeaturesAPI.i index 0e444f027..bab98e950 100644 --- a/src/FeaturesAPI/FeaturesAPI.i +++ b/src/FeaturesAPI/FeaturesAPI.i @@ -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) @@ -245,6 +246,7 @@ %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" diff --git a/src/FeaturesAPI/FeaturesAPI_swig.h b/src/FeaturesAPI/FeaturesAPI_swig.h index a440abd0b..53bdbb86f 100644 --- a/src/FeaturesAPI/FeaturesAPI_swig.h +++ b/src/FeaturesAPI/FeaturesAPI_swig.h @@ -62,5 +62,6 @@ #include "FeaturesAPI_GeometryCalculation.h" #include "FeaturesAPI_BoundingBox.h" #include "FeaturesAPI_LimitTolerance.h" + #include "FeaturesAPI_SharedFaces.h" #endif // FeaturesAPI_swig_H_ diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index d4db12a9d..198f7d82f 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -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} ) diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp index 310f84f12..02b5c0738 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp @@ -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(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp index 5c312469b..9659812ad 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -56,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -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); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts index 41fa7dca7..a01ffc9bc 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts +++ b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts @@ -155,6 +155,10 @@ Bounding box Boîte englobante + + Check shared faces + Vérifier les faces partagées + Placement Placement @@ -5503,6 +5507,124 @@ + + + Shared_faces_macro + + Check shared faces + Vérifier les faces partagées + + + Shared faces + Faces partagées + + + Number of shared faces : + Nombre de faces partagées : + + + + Shared_faces_macro:create_group + + Create group + Créer un groupe + + + + Shared_faces_macro:group_name + + Group name + Nom du groupe + + + + Shared_faces_macro:main_object + + Object + Objet + + + Shared faces + Faces partagées + + + + Shared_faces_macro:group_list + + Shared faces + Faces partagées + + + List of faces : + Liste des faces : + + + + Shared_faces_macro:transparency + + Transparency + Transparence + + + + Shared_faces + + Check shared faces + Vérifier les faces partagées + + + Shared faces + Faces partagées + + + Number of shared faces : + Nombre de faces partagées : + + + + Shared_faces:create_group + + Create group + Créer un groupe + + + + Shared_faces:group_name + + Group name + Nom du groupe + + + + Shared_faces:main_object + + Object + Objet + + + Shared faces + Faces partagées + + + + Shared_faces:group_list + + Shared faces + Faces partagées + + + List of faces : + Liste des faces : + + + + Shared_faces:transparency + + Transparency + Transparence + + + Symmetry diff --git a/src/FeaturesPlugin/plugin-Features.xml b/src/FeaturesPlugin/plugin-Features.xml index 14c8cf727..3bebe12a5 100644 --- a/src/FeaturesPlugin/plugin-Features.xml +++ b/src/FeaturesPlugin/plugin-Features.xml @@ -236,6 +236,14 @@ icon="icons/Features/axis.png" helpfile="normalToFaceFeature.html" internal="1"> + + + + + + diff --git a/src/FeaturesPlugin/tests.set b/src/FeaturesPlugin/tests.set index 98f8623c6..eca27f516 100644 --- a/src/FeaturesPlugin/tests.set +++ b/src/FeaturesPlugin/tests.set @@ -543,6 +543,7 @@ SET(TEST_NAMES_PARA TestBooleanCut_Fuzzy_2.py TestBooleanFuse_Fuzzy.py TestBooleanCommon_Fuzzy.py + TestCheckSharedFaces.py ) SET(TEST_NAMES_SEQ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index 1a10fc353..31087ffc0 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -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(), + 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(new TopoDS_Shape(aMapFS.FindKey(i))); + aSharedFaces.push_back(aFace); + } + } + return aSharedFaces; +} diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h index 0c058e147..b1697bd0c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h @@ -235,6 +235,11 @@ public: const ListOfShape& theBaseShapes, const std::shared_ptr 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 -- 2.39.2