]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#20441: remove transparency in API python
authorJérôme <jerome.lucas@cesgenslab.fr>
Thu, 10 Dec 2020 19:16:13 +0000 (20:16 +0100)
committerJérôme <jerome.lucas@cesgenslab.fr>
Thu, 10 Dec 2020 19:16:13 +0000 (20:16 +0100)
src/FeaturesAPI/FeaturesAPI_SharedFaces.cpp
src/FeaturesAPI/FeaturesAPI_SharedFaces.h
src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.cpp
src/FeaturesPlugin/Test/TestCheckSharedFaces.py
src/FeaturesPlugin/doc/checkSharedFaceFeature.rst
src/FeaturesPlugin/doc/examples/checkSharedFaces.py

index 92b09330e08bfcfe383197268deb84d30d92f854..b13f623130b1f4a54c2d5a7a652bf0e6012504e0 100644 (file)
@@ -39,13 +39,11 @@ FeaturesAPI_SharedFaces::
 FeaturesAPI_SharedFaces::FeaturesAPI_SharedFaces(
                          const std::shared_ptr<ModelAPI_Feature>& theFeature,
                          const ModelHighAPI_Selection& theobject,
-                         const ModelHighAPI_Integer& theTransparency,
                          const std::string & theNameGroup)
 :ModelHighAPI_Interface(theFeature)
 {
   if (initialize()) {
     fillAttribute(theobject, myobjectselected);
-    fillAttribute(theTransparency, mytransparency);
     fillAttribute(theNameGroup, mygroupname);
     execute();
   }
@@ -66,7 +64,6 @@ void FeaturesAPI_SharedFaces::dump(ModelHighAPI_Dumper& theDumper) const
     anAttrObject = aBase->selection(FeaturesPlugin_GroupSharedFaces::OBJECT_ID());
 
   theDumper << aBase << " = model.getSharedFaces(" << aDocName << ", " << anAttrObject;
-  theDumper << ", " << aBase->integer(FeaturesPlugin_GroupSharedFaces::TRANSPARENCY_ID());
   theDumper << ", " << aBase->string(FeaturesPlugin_GroupSharedFaces::GROUP_NAME_ID());
   theDumper << ")" << std::endl;
 }
@@ -74,7 +71,6 @@ void FeaturesAPI_SharedFaces::dump(ModelHighAPI_Dumper& theDumper) const
 //=================================================================================================
 SharedFacesPtr getSharedFaces(const std::shared_ptr<ModelAPI_Document>& thePart,
                               const ModelHighAPI_Selection& theobject,
-                              const ModelHighAPI_Integer& theTransparency,
                               const std::string & theNameGroup)
 {
 
@@ -84,7 +80,6 @@ SharedFacesPtr getSharedFaces(const std::shared_ptr<ModelAPI_Document>& thePart,
 
   aSharedFaces.reset(new FeaturesAPI_SharedFaces(aFeature,
                                                  theobject,
-                                                 theTransparency,
                                                  theNameGroup));
 
   return aSharedFaces;
index 001a1cbc3a5f879948f7c4981a392ddb640485c1..e5dc89cf114ade88dff37e542da3943b74076eba 100644 (file)
@@ -46,20 +46,16 @@ public:
   FEATURESAPI_EXPORT
   explicit FeaturesAPI_SharedFaces(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                    const ModelHighAPI_Selection& theobject,
-                                   const ModelHighAPI_Integer& theTransparency,
                                    const std::string & theNameGroup);
 
   /// Destructor.
   FEATURESAPI_EXPORT
   virtual ~FeaturesAPI_SharedFaces();
 
-    INTERFACE_3(FeaturesPlugin_GroupSharedFaces::ID(),
+    INTERFACE_2(FeaturesPlugin_GroupSharedFaces::ID(),
                objectselected, FeaturesPlugin_GroupSharedFaces::OBJECT_ID(),
                               ModelAPI_AttributeSelection,
                               /** object selected*/,
-               transparency, FeaturesPlugin_GroupSharedFaces::TRANSPARENCY_ID(),
-                              ModelAPI_AttributeInteger,
-                              /** transparency*/,
                groupname, FeaturesPlugin_GroupSharedFaces::GROUP_NAME_ID(),
                               ModelAPI_AttributeString,
                               /** group name*/)
@@ -80,7 +76,6 @@ typedef std::shared_ptr<FeaturesAPI_SharedFaces> SharedFacesPtr;
 FEATURESAPI_EXPORT
 SharedFacesPtr getSharedFaces(const std::shared_ptr<ModelAPI_Document>& thePart,
                               const ModelHighAPI_Selection& theObject,
-                              const ModelHighAPI_Integer& theTransparency,
                               const std::string & theNameGroup);
 
 #endif // FeaturesAPI_SharedFaces_H_
index 53b576e1fae49826b34b7d1169d30a1707135ab7..0bdc7208f898f59e28e8c8b819e13de3af2b7445 100644 (file)
@@ -58,6 +58,8 @@ void FeaturesPlugin_GroupSharedFaces::initAttributes()
   data()->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeInteger::typeId());
   data()->addAttribute(GROUP_NAME_ID(), ModelAPI_AttributeString::typeId());
 
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TRANSPARENCY_ID());
+
 }
 
 
@@ -99,7 +101,7 @@ void FeaturesPlugin_GroupSharedFaces::execute()
     }
 
   }
-  if (selection(OBJECT_ID())->isInitialized()) {
+  if (selection(OBJECT_ID())->isInitialized() && integer(TRANSPARENCY_ID())->isInitialized()) {
     AttributeSelectionPtr ancompSolidAttr = selection(OBJECT_ID());
     ResultPtr aResult = ancompSolidAttr->context();
 
index 4e04c745431df7507a62b25473dab5f9cec8652a..c0d98ace10575a7d5fdf820c7e0fb5db5446c91a 100644 (file)
@@ -52,7 +52,7 @@ if __name__ == '__main__':
     CompSolid_1 = model.addCompSolid(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")])
 
     ### Create Shared_faces
-    Shared_faces_1 = model.getSharedFaces(Part_1_doc, model.selection("COMPSOLID", "CompSolid_1_1"), 50, "mygroup")
+    Shared_faces_1 = model.getSharedFaces(Part_1_doc, model.selection("COMPSOLID", "CompSolid_1_1"), "mygroup")
 
     model.do()
      # Check results
index e7ca9fac12e4dc19837889fc47d6cd236099f8c6..e1f45530ab0c7f26cd338235265d5ebafdb17e6f 100644 (file)
@@ -32,11 +32,10 @@ Input fields:
 
 **TUI Command**:
 
-.. py:function:: model.getSharedFaces(Part_doc, shape, transparency, nameGroup)
+.. py:function:: model.getSharedFaces(Part_doc, shape, nameGroup)
  
     :param part: The current part object.
     :param object: A composolid or compound in format *model.selection("Type", shape)*.
-    :param number: value for the transparency.
     :param string: name of group created. 
     :return: Created group.
 
index bc541d1dea0268cf146b8dc29da6aba0e83296af..198027331379d566bc032f774c59411658245413 100644 (file)
@@ -15,7 +15,7 @@ Box_2 = model.addBox(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Front][Box_
 CompSolid_1 = model.addCompSolid(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")])
 
 ### Create Shared_faces
-Shared_faces_1 = model.getSharedFaces(Part_1_doc, model.selection("COMPSOLID", "CompSolid_1_1"), 50, "mygroup")
+Shared_faces_1 = model.getSharedFaces(Part_1_doc, model.selection("COMPSOLID", "CompSolid_1_1"), "mygroup")
 
 model.do()
 model.end()