Salome HOME
Merge branch 'agy/arch2_ic0'
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 4 Feb 2021 15:22:49 +0000 (16:22 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 4 Feb 2021 15:22:49 +0000 (16:22 +0100)
CMakeCommon/FindSalomeQt5.cmake
src/ExchangePlugin/doc/examples/export.py
src/ExchangePlugin/doc/exportFeature.rst
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp
src/FeaturesPlugin/Test/Test22847.py [new file with mode: 0644]
src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp
src/ModuleBase/ModuleBase_ResultPrs.cpp

index 9fd4549681e409e4ca09f60d10485937ca2c6a78..bd1516a40d22dc74efc0d7488900b5829b7ccfb5 100644 (file)
@@ -32,6 +32,7 @@ SET(QT_DEFINITIONS)
 SET(QT_LIBRARIES)
 # Find Qt5Core to get Qt version
 SET(Qt5_FIND_COMPONENTS QtCore)
+SET(Qt5_OPTIONAL_COMPONENTS)
 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5Core Qt5Core_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
 IF(Qt5Core_FOUND)
   LIST(APPEND QT_INCLUDES    ${Qt5Core_INCLUDE_DIRS})
@@ -40,15 +41,22 @@ IF(Qt5Core_FOUND)
   SET(QT_VERSION "${Qt5Core_VERSION}")
 ENDIF()
 
-SET(Qt5_FIND_COMPONENTS Gui Widgets Network Xml OpenGL PrintSupport Help Test Sql Sensors Positioning Quick Qml Multimedia MultimediaWidgets WebChannel UiTools)
+# Add mandatory Qt 5 components below
+SET(Qt5_FIND_COMPONENTS Gui Widgets Network Xml OpenGL PrintSupport Help Test)
+# Add optional Qt 5 components below
+SET(Qt5_OPTIONAL_COMPONENTS)
 
 IF ("${QT_VERSION}" VERSION_LESS "5.6.0")
+  # QtWebKit package is used with Qt < 5.6
   LIST(APPEND Qt5_FIND_COMPONENTS WebKit WebKitWidgets)
 ELSE()
-  LIST(APPEND Qt5_OPTIONAL_COMPONENTS WebEngine WebEngineWidgets)
+  # QtWebEngine package is (optionally) used with Qt >= 5.6
+  # Anyway, not available with Python 3
+  LIST(APPEND Qt5_OPTIONAL_COMPONENTS WebEngineCore WebEngine WebEngineWidgets)
 ENDIF()
 
 IF(NOT WIN32)
+  ## QtX11Extras package is used on Linux only
   LIST(APPEND Qt5_FIND_COMPONENTS X11Extras)
 ENDIF()
 
@@ -58,7 +66,7 @@ FOREACH(_Qt5_COMPONENT_ ${Qt5_FIND_COMPONENTS} ${Qt5_OPTIONAL_COMPONENTS})
   IF(${idx} GREATER -1)
    SET(Salome${_Qt5_COMPONENT}_FIND_QUIETLY TRUE)
   ENDIF()
-  SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(${_Qt5_COMPONENT} ${_Qt5_COMPONENT}_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
+  FIND_PACKAGE(${_Qt5_COMPONENT})
   LIST(APPEND QT_INCLUDES    ${${_Qt5_COMPONENT}_INCLUDE_DIRS})
   LIST(APPEND QT_DEFINITIONS ${${_Qt5_COMPONENT}_DEFINITIONS})
   LIST(APPEND QT_LIBRARIES   ${${_Qt5_COMPONENT}_LIBRARIES})
@@ -71,7 +79,7 @@ MARK_AS_ADVANCED(QT_LRELEASE_EXECUTABLE)
 GET_FILENAME_COMPONENT(QT_BINARY_DIR ${QT_LRELEASE_EXECUTABLE} DIRECTORY)
 MARK_AS_ADVANCED(QT_BINARY_DIR)
 
-# This is only needed to correctly detect Qt help generator tool, to workaround an error 
+# This is only needed to correctly detect Qt help generator tool, to workaround an error
 # coming from ParaView detection procedure
 FIND_PROGRAM(QT_HELP_GENERATOR
     qhelpgenerator
@@ -80,7 +88,7 @@ FIND_PROGRAM(QT_HELP_GENERATOR
     DOC "qhelpgenerator used to compile Qt help project files")
 MARK_AS_ADVANCED(QT_HELP_GENERATOR)
 
-IF(Qt5Core_FOUND) 
+IF(Qt5Core_FOUND)
   SALOME_ACCUMULATE_HEADERS(QT_INCLUDES)
   SALOME_ACCUMULATE_ENVIRONMENT(PATH ${LINGUIST_PATH})
   SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${Qt5Core_LIBRARIES})
index 1f9b7c2b5e125854519004e7cb67e49a3c5f198e..2a807f26331339a59f3bc0dcc1abebc0e3ef35f6 100644 (file)
@@ -9,5 +9,9 @@ Part_1_doc = Part_1.document()
 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
 Export_1 = model.exportToFile(Part_1_doc, file_path,
                               [model.selection("SOLID", "Box_1_1")])
+
+file_xao = os.path.join(os.getenv("DATA_DIR"), "test.xao")
+Export_2 = model.exportToXAO(Part_1_doc, file_xao,
+                             model.selection("SOLID", "Box_1_1"), "author", "box")
 model.do()
 model.end()
index 5867d1bf5081ca6d543f88349660022aa6c7fa82..e4deafb4f346a9d5e566f97ee7771bcf64e1e314 100644 (file)
@@ -95,6 +95,7 @@ In case of first choice the format of exported file will be defined according to
 
 Selection list in the property panel contains a list of exported objects which can be selected in a viewer or object browser.
 
+*Note*: For XAO format, selection list is not available, the whole part is exported.
 
 **Apply** button exports the file.
   
@@ -109,20 +110,14 @@ Selection list in the property panel contains a list of exported objects which c
     :param list: A list of exporting objects
 
 
-.. py:function:: model.exportToXAO(Part_doc, FileNameString, [ObjectsList, Author, GeometryName])
+.. py:function:: model.exportToXAO(Part_doc, FileNameString, Author="", GeometryName="")
+.. py:function:: model.exportToXAO(Part_doc, FileNameString, Object, Author="", GeometryName="")
 
     :param part: The current part object
     :param string: The file name
-    :param list: A list of exporting objects, if necessary
-    :param string: The name of the author 
-    :param string: The name for the shape processed in GEOMETRY module
-
-Result
-""""""
-
-The Result of operation is an exported file.
-
-**See Also** a sample TUI Script of :ref:`tui_export_file` operation.
+    :param object: An exporting object, if necessary
+    :param string: The name of the author, empty by default
+    :param string: The name for the shape processed in GEOMETRY module, empty by default
 
 Result
 """"""
index 1dce791a91c48cc0b07a8e657e6e0f197598d6e1..ae6ccc7ceb29442c65895d7992c7afbe69a4b1ef 100644 (file)
@@ -688,4 +688,5 @@ ADD_UNIT_TESTS(TestExtrusion.py
                Test20245_2.py
                Test20245_3.py
                Test20247.py
+               Test22847.py
 )
index e00351b73037df9e32d8d5417f07a22356040868..f34e5242f8f3685338f4fce1fc8bda226d8c51d2 100644 (file)
@@ -290,7 +290,9 @@ void FeaturesPlugin_RemoveSubShapes::execute()
 
   // Store result.
   ResultBodyPtr aResultBody = document()->createBody(data());
-  aResultBody->storeModified(aBaseShape, aResultShape);
+  std::list<GeomShapePtr> anOldShapes;
+  anOldShapes.push_back(aBaseShape);
+  aResultBody->storeModified(anOldShapes, aResultShape, aMakeShapeList);
   for (std::set<GeomAPI_Shape::ShapeType>::iterator aTypeIter = aTypes.begin();
        aTypeIter != aTypes.end();
        ++aTypeIter)
diff --git a/src/FeaturesPlugin/Test/Test22847.py b/src/FeaturesPlugin/Test/Test22847.py
new file mode 100644 (file)
index 0000000..9efcf3d
--- /dev/null
@@ -0,0 +1,66 @@
+# Copyright (C) 2020  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()
+
+### Create Part
+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(22, 23, 60, 70)
+SketchLine_2 = Sketch_1.addLine(60, 70, 90, 23)
+Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(90, 23, 22, 23)
+Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
+Sketch_1.setHorizontal(SketchLine_3.result())
+SketchLine_4 = Sketch_1.addLine(60, 72, 54, 23)
+Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_3.result())
+Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_2.startPoint())
+model.do()
+
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0, "Faces|Wires")
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 60, 2, model.selection("EDGE", "PartSet/OX"), 75, 2, keepSubResults = True)
+
+### Create Group
+Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "LinearCopy_1_1_1_2/MF:Translated&Sketch_1/SketchLine_2")])
+
+### Create Remove_SubShapes
+Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "LinearCopy_1_1"))
+Remove_SubShapes_1.setSubShapesToRemove([model.selection("SOLID", "LinearCopy_1_1_4_2")])
+model.end()
+
+# Move the group to the end of history
+model.begin()
+Part_1_doc.moveFeature(Group_1.feature(), Remove_SubShapes_1.feature())
+model.end()
+
+# check that all groups are correct
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+
+assert(aFactory.validate(Group_1.feature()))
+assert(Group_1.groupList().size() == 1)
+assert(Group_1.groupList().value(0).value().shapeTypeStr() == "FACE")
+assert(len(Group_1.groupList().value(0).namingName()) > 0)
+
+assert(model.checkPythonDump())
index a7b31394536b0c2bd46787c69c2278ba1240ab7f..2a6c42497fcdc364666f3b24fec93a51477667ea 100644 (file)
@@ -34,7 +34,6 @@
 #include <TopoDS_Wire.hxx>
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
-#include <ShapeFix_Wire.hxx>
 
 #include <cmath>
 #include <map>
@@ -165,15 +164,8 @@ GeomAlgoAPI_WireBuilder::GeomAlgoAPI_WireBuilder(const ListOfShape& theShapes,
     setImpl(aWireBuilder);
     setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
 
-    // fix edges order (bos #20546)
-    TopoDS_Wire aWire = aWireBuilder->Wire();
-    Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire;
-    aFW->Load(aWire);
-    aFW->FixReorder();
-    if (aFW->StatusReorder(ShapeExtend_DONE))
-      aWire = aFW->WireAPIMake();
-
     // split the result wire
+    TopoDS_Wire aWire = aWireBuilder->Wire();
     if (isSplitWire && BRep_Tool::IsClosed(aWire)) {
       TopoDS_Wire aNewWire;
       BRep_Builder aBuilder;
@@ -293,4 +285,4 @@ bool GeomAlgoAPI_WireBuilder::isSelfIntersected(const GeomShapePtr& theWire)
   }
 
   return false;
-}
+}
\ No newline at end of file
index 10f3d798b25145243c6853cb21a2df92a9c2d29d..447be6b7b6427cfebe9b2abb27bb14de7729bfa4 100644 (file)
@@ -101,9 +101,11 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
   }
   Set(aShape);
 
-  // Activate individual repaintng if this is a part of compsolid
-  ResultBodyPtr aResOwner = ModelAPI_Tools::bodyOwner(myResult);
-  SetAutoHilight(aResOwner.get() == NULL);
+  // VSV: bos22744: The AutoHilight mode is swithced off because it produces different
+  // behaviour of selection for simple shape and compound. For example when selection mode
+  // is Vertex the shape is selected by vertex, but compound is selected by whole shape
+  //ResultBodyPtr aResOwner = ModelAPI_Tools::bodyOwner(myResult);
+  //SetAutoHilight(aResOwner.get() == NULL);
 
   // Set own free boundaries aspect in order to have free
   // and unfree boundaries with different colors