]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' into cgt/devCEA
authorClarisse Genrault <clarisse.genrault@cea.fr>
Thu, 26 Jan 2017 07:12:47 +0000 (08:12 +0100)
committerClarisse Genrault <clarisse.genrault@cea.fr>
Thu, 26 Jan 2017 07:12:47 +0000 (08:12 +0100)
55 files changed:
CMakeLists.txt
build_Salome_deb.bat
env.sh
src/CollectionPlugin/CollectionPlugin_WidgetField.cpp
src/Config/CMakeLists.txt
src/Config/ConfigAPI.i [new file with mode: 0644]
src/Config/Config_ModuleReader.cpp
src/Config/Config_ModuleReader.h
src/Config/Config_swig.h [new file with mode: 0644]
src/Config/plugins.xml.in
src/ExchangePlugin/CMakeLists.txt
src/FeaturesPlugin/Test/TestRecover1798.py
src/GeomAPI/CMakeLists.txt
src/GeomAPI/GeomAPI_Angle.cpp [deleted file]
src/GeomAPI/GeomAPI_Angle.h [deleted file]
src/GeomAPI/GeomAPI_Edge.cpp
src/GeomAlgoAPI/CMakeLists.txt
src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp
src/Model/Model_AttributeBoolean.cpp
src/Model/Model_AttributeSelection.cpp
src/Model/Model_AttributeSelection.h
src/Model/Model_Session.cpp
src/ModelAPI/CMakeLists.txt
src/ModelAPI/Test/Test1064.py
src/ModelAPI/Test/Test1998.py [new file with mode: 0644]
src/ModelHighAPI/ModelHighAPI.i
src/ModelHighAPI/ModelHighAPI_Selection.cpp
src/ModelHighAPI/ModelHighAPI_Selection.h
src/ParametersAPI/ParametersAPI_Parameter.cpp
src/ParametersAPI/ParametersAPI_Parameter.h
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_Tools.cpp
src/PartSet/PartSet_Tools.h
src/PartSet/PartSet_WidgetPoint2d.cpp
src/PythonAPI/CMakeLists.txt
src/PythonAPI/Test/TestSketcherAddArc.py
src/PythonAPI/examples/Platine.py
src/PythonAPI/initConfig.py [new file with mode: 0644]
src/PythonAPI/model/__init__.py
src/PythonAPI/model/tests/__init__.py [new file with mode: 0644]
src/PythonAPI/model/tests/tests.py [new file with mode: 0644]
src/SHAPERGUI/SHAPERGUI.cpp
src/SHAPERGUI/SHAPERGUI.h
src/SketchAPI/SketchAPI_Projection.cpp
src/SketchAPI/SketchAPI_Projection.h
src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp
src/XAO/CMakeLists.txt
src/XAO/tests/CMakeLists.txt
src/XGUI/XGUI_ActionsMgr.cpp
src/XGUI/XGUI_DataModel.cpp
src/XGUI/XGUI_Selection.cpp
src/XGUI/XGUI_Workshop.cpp
test.models/CMakeLists.txt [new file with mode: 0644]
test.models/bobine_film_reel.py [new file with mode: 0644]

index 39b83ec2590b86032c2aa955a8ce974ff759bec9..4481c42bcf431e84d648b115076eaa8d729df787 100644 (file)
@@ -114,8 +114,14 @@ IF(${HAVE_SALOME})
     ADD_SUBDIRECTORY (src/ConnectorPlugin)
 ENDIF(${HAVE_SALOME})
 
+ADD_SUBDIRECTORY (test.models)
+
 ENABLE_TESTING()
 
+IF(ADD_MODELS_TESTS)
+  ADD_CUSTOM_TARGET(run_unit_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -LE "models_tests")
+ENDIF(ADD_MODELS_TESTS)
+
 # Add the uninstall target for eclipse IDE
 if (CMAKE_GENERATOR MATCHES "NMake Makefiles")
 configure_file("${CMAKE_SOURCE_DIR}/CMakeCommon/cmake_uninstall.cmake.in"
index 76a4b4c805d0db0eea5d321927efa22a175badb4..ddcc88b9b7b11c81c52c9554d4caa22e11597ead 100644 (file)
@@ -14,6 +14,7 @@ call %SRC_DIR%\env_Salome.bat d
 mkdir %ROOT_DIR%\build
 cd %ROOT_DIR%\build
 
+REM Add -DADD_MODELS_TESTS=TRUE to enable test models
 cmake %SRC_DIR% -G "Visual Studio 10 Win64" -DPYTHON_EXECUTABLE=%PYTHONHOME%\python.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=%ROOT_DIR%\install
 
 start "" %MSVC_EXE% SHAPER.sln
diff --git a/env.sh b/env.sh
index 55c6be7d3303d8d11c817e3fdcc5c8f0204bb717..1ca116132b6fe4d80316ee2ad259b50bd4293807 100644 (file)
--- a/env.sh
+++ b/env.sh
@@ -11,6 +11,10 @@ export AUT_DIR=$(pwd)
 export TOOLS_DIR=$(pwd)
 
 export HOME_OLD=$HOME
+# to use patched OCCT 7.1.0 for SHAPER
+export CUSTOM_CAS_ROOT=1
+export ENV_FOR_LAUNCH=1
+
 source /dn64/series8x/work/init.sh 2016-12-26
 export HOME=$HOME_OLD
 
@@ -20,4 +24,4 @@ export SHAPER_PDIR=/dn48/newgeom/common/products
 export SHAPER_ROOT_DIR=$(cd ${SOURCES_DIR}/.. && pwd)/install
 
 source ${TOOLS_DIR}/env_linux.sh
-source ${TOOLS_DIR}/env_salome.sh
\ No newline at end of file
+source ${TOOLS_DIR}/env_salome.sh
index 7d091f00c31505f41d8a589473daeebcd7433ca1..59a2dc16b3d8419ae160ae99a68ebbb65aba4002 100644 (file)
@@ -826,8 +826,12 @@ bool CollectionPlugin_WidgetField::
   for (anIt = theValues.begin(); anIt != theValues.end(); anIt++) {
     ModuleBase_ViewerPrsPtr aValue = *anIt;
     ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aValue->object());
-    if (theToValidate && aRes.get() && acceptSubShape(aValue->shape(), aRes))
-      aSelected.append(aValue);
+    if (theToValidate && aRes.get()) {
+      if (myShapeTypeCombo->currentIndex() > 3)
+        aSelected.append(aValue);
+      else if (acceptSubShape(aValue->shape(), aRes))
+        aSelected.append(aValue);
+    }
   }
   AttributeSelectionListPtr aSelList =
     myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID());
index 5e0123e9c57aca894ffb7004a54f2eb352a6b1e8..831f62020162a31695440230b84bc2034865adbb 100644 (file)
@@ -2,6 +2,8 @@
 
 INCLUDE(Common)
 INCLUDE(XMLProcessing)
+FIND_PACKAGE(SWIG REQUIRED)
+INCLUDE(${SWIG_USE_FILE})
 
 INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Events
                      ${PYTHON_INCLUDE_DIR})
@@ -46,6 +48,23 @@ SET(PROJECT_SOURCES
   Config_Translator.cpp
 )
 
+SET(CMAKE_SWIG_FLAGS -threads -Wall)
+SET_SOURCE_FILES_PROPERTIES(ConfigAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(ConfigAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+SET(SWIG_SCRIPTS
+  ${CMAKE_CURRENT_BINARY_DIR}/ConfigAPI.py
+)
+SET(SWIG_LINK_LIBRARIES
+  Config
+  ${PYTHON_LIBRARIES}
+)
+SWIG_ADD_MODULE(ConfigAPI python ConfigAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(ConfigAPI ${SWIG_LINK_LIBRARIES})
+IF(WIN32)
+  SET_TARGET_PROPERTIES(_ConfigAPI PROPERTIES DEBUG_OUTPUT_NAME _ConfigAPI_d)
+ENDIF(WIN32)
+
+
 SET(XML_RESOURCES
   ${CMAKE_CURRENT_BINARY_DIR}/plugins.xml
   dataModel.xml
@@ -106,3 +125,6 @@ CONFIGURE_FILE(
 
 INSTALL(TARGETS Config DESTINATION ${SHAPER_INSTALL_BIN})
 INSTALL(FILES ${XML_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
+
+INSTALL(TARGETS _ConfigAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG})
diff --git a/src/Config/ConfigAPI.i b/src/Config/ConfigAPI.i
new file mode 100644 (file)
index 0000000..26d5fc3
--- /dev/null
@@ -0,0 +1,14 @@
+/* Config.i */
+
+%module ConfigAPI
+%{
+  #include "Config_swig.h"
+%}
+
+// to avoid error on this
+#define CONFIG_EXPORT
+
+%include "typemaps.i"
+%include "std_string.i"
+
+%include "Config_ModuleReader.h"
index ddb2742407438828378759086cc03fde739aff55..9e8549cdb43bd7d7aea303add9f452ed95bf922c 100644 (file)
@@ -172,7 +172,7 @@ void Config_ModuleReader::loadPlugin(const std::string& thePluginName)
   }
 }
 
-void Config_ModuleReader::loadScript(const std::string& theFileName)
+void Config_ModuleReader::loadScript(const std::string& theFileName, bool theSendErr)
 {
   /* acquire python thread */
   PyGILState_STATE gstate = PyGILState_Ensure();
@@ -195,7 +195,8 @@ void Config_ModuleReader::loadScript(const std::string& theFileName)
       Py_XDECREF(pvalue);
       Py_XDECREF(ptraceback);
     }
-    Events_InfoMessage("Config_ModuleReader", anErrorMsg).send();
+    if (theSendErr)
+      Events_InfoMessage("Config_ModuleReader", anErrorMsg).send();
   }
 
   /* release python thread */
index 881a10d2db1e293adb24fca476bc5493df4a2438..75aa0f6364bf1a2120d51630bf8512a9c1f0227a 100644 (file)
@@ -49,7 +49,9 @@ class Config_ModuleReader : public Config_XMLReader
   /// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform
   CONFIG_EXPORT static void loadLibrary(const std::string& theLibName);
   /// loads the python module with specified name
-  CONFIG_EXPORT static void loadScript(const std::string& theFileName);
+  /// \param theFileName name of the script
+  /// \param theSendErr send error message in case of faile
+  CONFIG_EXPORT static void loadScript(const std::string& theFileName, bool theSendErr = true);
   /*!
    * Extends set of modules,  used for dependency checking (if there is no
    * required module in the set, a plugin will not be loaded)
diff --git a/src/Config/Config_swig.h b/src/Config/Config_swig.h
new file mode 100644 (file)
index 0000000..00c8ae2
--- /dev/null
@@ -0,0 +1,12 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:    Config_swig.h
+// Created: Jan 16, 2017
+// Author:  Vitaly SMETANNIKOV
+
+#ifndef SRC_CONFIG_SWIG_H_
+#define SRC_CONFIG_SWIG_H_
+
+  #include "Config_ModuleReader.h"
+
+#endif /* SRC_CONFIG_SWIG_H_ */
index e2b18a79c289e4bc0326ad46c9deb5de04c0c011..2969b9da6eeec9f779173f80e708f4a4e65ab53c 100644 (file)
@@ -13,7 +13,7 @@
   <plugin library="CollectionPlugin" configuration="plugin-Collection.xml"/>
   <plugin library="ExchangePlugin" configuration="plugin-Exchange.xml"/>
   <plugin script="addons_Features" configuration="addons_Features.xml"/>
-  <plugin script="ConnectorPlugin" configuration="plugin-Connector.xml" dependency="Geometry"/>
+  <plugin script="ConnectorPlugin" configuration="plugin-Connector.xml" dependency="GEOM"/>
   <plugin library="ParametersPlugin" configuration="plugin-Parameters.xml"/>
 @DEFAULT_SOLVER@
 <!--
index 2e11f037530f328897f399b0215658bcccf55b1c..f304e5bf7ae915f185714ac10eeab92940f3aba9 100644 (file)
@@ -47,7 +47,7 @@ SET(PROJECT_LIBRARIES
     ModelHighAPI
     GeomAPI
     GeomAlgoAPI
-    XAO
+    XAOShaper
 )
 SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES})
 
index 2e9a23b3de89adbb8927e4ac647d469c271f3a7e..6d81692fc2d852933a83f89f28e0d82c75e71e60 100644 (file)
@@ -185,7 +185,7 @@ SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_2.results()[1], 10)
 SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_1.results()[1], 10)
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_24f-SketchLine_28f-SketchLine_26f-SketchLine_27f-SketchArc_1_2f-SketchArc_2_2f-SketchArc_3_2f-SketchArc_4_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/To_Face_1"), -30, model.selection(), 0)
-Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "Extrusion_1_1/From_Face_1&Extrusion_1_1/Generated_Face_1"), "inclinaison")
+Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "Extrusion_1_1/From_Face_1&Extrusion_1_1/Generated_Face_8"), "inclinaison")
 Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_1_1")], model.selection("EDGE", "PartSet/OZ"), "angle1")
 Recover_1 = model.addRecover(Part_1_doc, Rotation_2, [Rotation_1.result()])
 Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_1_1")], model.selection("EDGE", "PartSet/OZ"), "angle2")
index 767eb4922715df0cbe9fafa352f414ed9983ca16..3332171b0ca1317d620fe2ad888a292deb926806 100644 (file)
@@ -36,7 +36,6 @@ SET(PROJECT_HEADERS
     GeomAPI_Ax2.h
     GeomAPI_Ax3.h
     GeomAPI_Trsf.h
-    GeomAPI_Angle.h
     GeomAPI_Angle2d.h
     GeomAPI_Wire.h
 )
@@ -71,7 +70,6 @@ SET(PROJECT_SOURCES
     GeomAPI_Ax3.cpp
     GeomAPI_IPresentable.cpp
     GeomAPI_Trsf.cpp
-    GeomAPI_Angle.cpp
     GeomAPI_Angle2d.cpp
     GeomAPI_Wire.cpp
 )
diff --git a/src/GeomAPI/GeomAPI_Angle.cpp b/src/GeomAPI/GeomAPI_Angle.cpp
deleted file mode 100644 (file)
index 9849b9e..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright (C) 2016-20xx CEA/DEN, EDF R&D
-
-// File:        GeomAPI_Angle.cpp
-// Created:     19 April 2016
-// Author:      Artem ZHIDKOV
-
-#include <GeomAPI_Angle.h>
-#include <GeomAPI_Dir.h>
-#include <GeomAPI_Lin.h>
-#include <GeomAPI_Pnt.h>
-#include <GeomAPI_XYZ.h>
-
-#include <gp_Dir.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_XYZ.hxx>
-
-/// \struct ThreePoints
-/// \brief Used to store info about angle point and state.
-struct ThreePoints {
-  gp_Pnt myCenter;
-  gp_Pnt myFirst;
-  gp_Pnt mySecond;
-  bool myReversed[2];
-};
-
-#define MY_ANGLE implPtr<ThreePoints>()
-#define PI 3.1415926535897932
-
-static ThreePoints* newAngle(const std::shared_ptr<GeomAPI_Pnt>& theCenter,
-                             const std::shared_ptr<GeomAPI_Pnt>& theFirst,
-                             const std::shared_ptr<GeomAPI_Pnt>& theSecond)
-{
-  ThreePoints* aResult = new ThreePoints;
-  aResult->myCenter = gp_Pnt(theCenter->x(), theCenter->y(), theCenter->z());
-  aResult->myFirst  = gp_Pnt(theFirst->x(), theFirst->y(), theFirst->z());
-  aResult->mySecond = gp_Pnt(theSecond->x(), theSecond->y(), theSecond->z());
-  aResult->myReversed[0] = aResult->myReversed[1] = false;
-  return aResult;
-}
-
-static ThreePoints* newAngle(const std::shared_ptr<GeomAPI_Pnt>& theStart1,
-                             const std::shared_ptr<GeomAPI_Pnt>& theEnd1,
-                             const std::shared_ptr<GeomAPI_Pnt>& theStart2,
-                             const std::shared_ptr<GeomAPI_Pnt>& theEnd2)
-{
-  std::shared_ptr<GeomAPI_Lin> aLine1(new GeomAPI_Lin(theStart1, theEnd1));
-  std::shared_ptr<GeomAPI_Lin> aLine2(new GeomAPI_Lin(theStart2, theEnd2));
-  std::shared_ptr<GeomAPI_Pnt> aCenter = aLine1->intersect(aLine2);
-  bool isParallel = !aCenter;
-  if (isParallel)
-    aCenter = theStart1;
-  std::shared_ptr<GeomAPI_Pnt> aPoint1, aPoint2;
-  if (isParallel)
-    aPoint1 = aPoint2 = theEnd1;
-  else {
-    aPoint1 = theStart1->distance(aCenter) < theEnd1->distance(aCenter) ? theEnd1 : theStart1;
-    aPoint2 = theStart2->distance(aCenter) < theEnd2->distance(aCenter) ? theEnd2 : theStart2;
-  }
-  ThreePoints* anAngle = newAngle(aCenter, aPoint1, aPoint2);
-  anAngle->myReversed[0] = aPoint1 == theStart1;
-  anAngle->myReversed[1] = !isParallel && aPoint2 == theStart2;
-  return anAngle;
-}
-
-static ThreePoints* newAngle(const std::shared_ptr<GeomAPI_Lin>& theLine1, bool theReversed1,
-                             const std::shared_ptr<GeomAPI_Lin>& theLine2, bool theReversed2)
-{
-  std::shared_ptr<GeomAPI_Pnt> aCenter = theLine1->intersect(theLine2);
-  if (!aCenter)
-    aCenter = theLine1->location();
-  double aCoeff = theReversed1 ? -1.0 : 1.0;
-  std::shared_ptr<GeomAPI_Pnt> aPoint1(new GeomAPI_Pnt(
-      aCenter->xyz()->added(theLine1->direction()->xyz()->multiplied(aCoeff))));
-  aCoeff = theReversed2 ? -1.0 : 1.0;
-  std::shared_ptr<GeomAPI_Pnt> aPoint2(new GeomAPI_Pnt(
-      aCenter->xyz()->added(theLine2->direction()->xyz()->multiplied(aCoeff))));
-  ThreePoints* anAngle = newAngle(aCenter, aPoint1, aPoint2);
-  anAngle->myReversed[0] = theReversed1;
-  anAngle->myReversed[1] = theReversed2;
-  return anAngle;
-}
-
-
-
-GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr<GeomAPI_Pnt>& theStartLine1,
-                             const std::shared_ptr<GeomAPI_Pnt>& theEndLine1,
-                             const std::shared_ptr<GeomAPI_Pnt>& theStartLine2,
-                             const std::shared_ptr<GeomAPI_Pnt>& theEndLine2)
-    : GeomAPI_Interface(newAngle(theStartLine1, theEndLine1, theStartLine2, theEndLine2))
-{
-}
-
-GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr<GeomAPI_Lin>& theLine1, bool theReversed1,
-                             const std::shared_ptr<GeomAPI_Lin>& theLine2, bool theReversed2)
-    : GeomAPI_Interface(newAngle(theLine1, theReversed1, theLine2, theReversed2))
-{
-}
-
-GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr<GeomAPI_Pnt>& theCenter,
-                             const std::shared_ptr<GeomAPI_Pnt>& thePoint1,
-                             const std::shared_ptr<GeomAPI_Pnt>& thePoint2)
-    : GeomAPI_Interface(newAngle(theCenter, thePoint1, thePoint2))
-{
-}
-
-std::shared_ptr<GeomAPI_Pnt> GeomAPI_Angle::center()
-{
-  gp_Pnt aPnt = MY_ANGLE->myCenter;
-  return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z()));
-}
-
-std::shared_ptr<GeomAPI_Pnt> GeomAPI_Angle::firstPoint()
-{
-  gp_Pnt aPnt = MY_ANGLE->myFirst;
-  return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z()));
-}
-
-std::shared_ptr<GeomAPI_Pnt> GeomAPI_Angle::secondPoint()
-{
-  gp_Pnt aPnt = MY_ANGLE->mySecond;
-  return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z()));
-}
-
-double GeomAPI_Angle::angleDegree()
-{
-  return angleRadian() * 180.0 / PI;
-}
-
-double GeomAPI_Angle::angleRadian()
-{
-  ThreePoints* anAngle = MY_ANGLE;
-  gp_Dir aDir1(anAngle->myFirst.XYZ() - anAngle->myCenter.XYZ());
-  gp_Dir aDir2(anAngle->mySecond.XYZ() - anAngle->myCenter.XYZ());
-  return aDir1.Angle(aDir2);
-}
-
-bool GeomAPI_Angle::isReversed(int theIndex)
-{
-  return MY_ANGLE->myReversed[theIndex & 0x1];
-}
diff --git a/src/GeomAPI/GeomAPI_Angle.h b/src/GeomAPI/GeomAPI_Angle.h
deleted file mode 100644 (file)
index 8d87433..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (C) 2016-20xx CEA/DEN, EDF R&D
-
-// File:        GeomAPI_Angle.h
-// Created:     19 April 2016
-// Author:      Artem ZHIDKOV
-
-#ifndef GeomAPI_Angle_H_
-#define GeomAPI_Angle_H_
-
-#include <GeomAPI_Interface.h>
-
-class GeomAPI_Lin;
-class GeomAPI_Pnt;
-
-/// \class GeomAPI_Angle
-/// \ingroup DataModel
-/// \brief Build an angle in 3D
-class GeomAPI_Angle : public GeomAPI_Interface
-{
-public:
-  /// Creation of an angle defined by two lines' start, end points
-  GEOMAPI_EXPORT
-  GeomAPI_Angle(const std::shared_ptr<GeomAPI_Pnt>& theStartLine1,
-                const std::shared_ptr<GeomAPI_Pnt>& theEndLine1,
-                const std::shared_ptr<GeomAPI_Pnt>& theStartLine2,
-                const std::shared_ptr<GeomAPI_Pnt>& theEndLine2);
-  /// Creation of an angle defined by two lines taking into account their orientation
-  GEOMAPI_EXPORT
-  GeomAPI_Angle(const std::shared_ptr<GeomAPI_Lin>& theLine1, bool theReversed1,
-                const std::shared_ptr<GeomAPI_Lin>& theLine2, bool theReversed2);
-  /// Creation of an angle defined by three points
-  GEOMAPI_EXPORT
-  GeomAPI_Angle(const std::shared_ptr<GeomAPI_Pnt>& theCenter,
-                const std::shared_ptr<GeomAPI_Pnt>& thePoint1,
-                const std::shared_ptr<GeomAPI_Pnt>& thePoint2);
-
-  /// Returns central point of the angle
-  GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Pnt> center();
-  /// Returns point on the first edge
-  GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Pnt> firstPoint();
-  /// Returns point on the second edge
-  GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Pnt> secondPoint();
-
-  /// Returns value of the angle in degrees
-  GEOMAPI_EXPORT double angleDegree();
-  /// Returns value of the angle in radians
-  GEOMAPI_EXPORT double angleRadian();
-
-  /// Returns \c true if the line is reversed during angle calculation.
-  /// If theIndex = 0, the result corresponds to the first line,
-  /// if theIndex = 1, the to the second line
-  GEOMAPI_EXPORT bool isReversed(int theIndex);
-};
-
-#endif
-
index 21aa2c5eda234030ebe7eebed5edc733133ef618..0ce6340051477195687fb07664200515d6c41ea5 100644 (file)
@@ -193,6 +193,8 @@ bool GeomAPI_Edge::isInPlane(std::shared_ptr<GeomAPI_Pln> thePlane) const
   double aFirst, aLast;
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
   Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast);
+  if (aCurve.IsNull())
+    return false;
 
   double A, B, C, D;
   thePlane->coefficients(A, B, C, D);
index 352e5738d62924973eb000cfdf200efc032327b3..47a4266decdfab4eb7531f0514355c54f5309026 100644 (file)
@@ -101,7 +101,7 @@ SET(PROJECT_LIBRARIES
     GeomAPI
     GeomAlgoImpl
     ModelAPI
-    XAO
+    XAOShaper
     ${CAS_OCAF}
     ${CAS_SHAPE}
     ${CAS_TKBO}
index 3b3b4d5489c9180e3863883ad115cedc53a44bdd..62a879f57861deb95c3905a9947eec048feb0178 100644 (file)
@@ -11,6 +11,7 @@
 #include <BRep_Builder.hxx>
 #include <BRepTopAdaptor_FClass2d.hxx>
 #include <Geom_Plane.hxx>
+#include <Geom_TrimmedCurve.hxx>
 #include <Precision.hxx>
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
@@ -46,6 +47,45 @@ static TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape)
   return aStart;
 }
 
+static TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape,
+    const std::list<std::shared_ptr<GeomAPI_Shape> >& theInitialShapes)
+{
+  // Try to find edge lying on the one of original edges.
+  // First found edge will be taken as a start edge for the result wire
+  std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator aFeatIt = theInitialShapes.begin();
+  for (; aFeatIt != theInitialShapes.end(); aFeatIt++) {
+    std::shared_ptr<GeomAPI_Shape> aShape(*aFeatIt);
+    const TopoDS_Edge& anEdge = aShape->impl<TopoDS_Edge>();
+    if (anEdge.ShapeType() != TopAbs_EDGE)
+      continue;
+
+    double aFirst, aLast;
+    Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
+    if (aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve))
+      aCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve)->BasisCurve();
+
+    TopExp_Explorer anExp(theShape, TopAbs_EDGE);
+    for (; anExp.More(); anExp.Next()) {
+      const TopoDS_Edge& aShapeEdge = TopoDS::Edge(anExp.Current());
+      double aF, aL;
+      Handle(Geom_Curve) aShapeCurve = BRep_Tool::Curve(aShapeEdge, aF, aL);
+      if (aShapeCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve))
+        aShapeCurve = Handle(Geom_TrimmedCurve)::DownCast(aShapeCurve)->BasisCurve();
+
+      if (aCurve != aShapeCurve)
+        continue;
+
+      // the edge is found, search vertex
+      TopoDS_Vertex aV1, aV2;
+      TopExp::Vertices(aShapeEdge, aV1, aV2);
+      return fabs(aF - aFirst) <= fabs(aL - aFirst) ? aV1 : aV2;
+    }
+  }
+
+  // start vertex is not found, use algorithm to search vertex with the greatest coordinates
+  return findStartVertex(theShape);
+}
+
 void GeomAlgoAPI_SketchBuilder::createFaces(
     const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
     const std::shared_ptr<GeomAPI_Dir>& theDirX,
@@ -99,8 +139,8 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
       TopoDS_Wire aWire = TopoDS::Wire(aWireExp.Current());
 
       // to make faces equal on different platforms, we will find
-      // a vertex with greater coordinates and start wire from it
-      TopoDS_Vertex aStartVertex = findStartVertex(aWire);
+      // a vertex lying on an edge with the lowest index in the list of initial edges
+      TopoDS_Vertex aStartVertex = findStartVertex(aWire, theFeatures);
 
       TopoDS_Wire aNewWire;
       aBuilder.MakeWire(aNewWire);
index f7111f127c63aaabd88ce7b50576a2def0851ec7..666b8bb232cbfb5be1e174d33039a3de8f804bab 100644 (file)
@@ -10,7 +10,7 @@
 
 void Model_AttributeBoolean::setValue(bool theValue)
 {
-  Standard_Boolean aValue = theValue ? Standard_True : Standard_False;
+  Standard_Integer aValue = theValue ? 1 : 0;
   if (!myIsInitialized || myBool->Get() != aValue) {
     if (myBool.IsNull())
       myBool = TDataStd_Integer::Set(myLab, 0);
@@ -21,7 +21,7 @@ void Model_AttributeBoolean::setValue(bool theValue)
 
 bool Model_AttributeBoolean::value()
 {
-  return myIsInitialized && myBool->Get() == Standard_True ;
+  return myIsInitialized && myBool->Get() == 1;
 }
 
 Model_AttributeBoolean::Model_AttributeBoolean(TDF_Label& theLabel)
index 8fc2d5e77296ff285f37c758a5a1bafae4262cea..39d1d45576add598a4012ff2761f9f365affde07 100644 (file)
@@ -399,6 +399,32 @@ static bool setInvalidIfFalse(TDF_Label& theLab, const bool theFlag) {
   return theFlag;
 }
 
+void Model_AttributeSelection::split(
+  ResultPtr theContext, TopoDS_Shape theNewShape, TopAbs_ShapeEnum theType)
+{
+  TopTools_ListOfShape aSubs;
+  for(TopoDS_Iterator anExplorer(theNewShape); anExplorer.More(); anExplorer.Next()) {
+    if (!anExplorer.Value().IsNull() &&
+      anExplorer.Value().ShapeType() == theType) {
+        aSubs.Append(anExplorer.Value());
+    } else { // invalid case; bad result shape, so, impossible to split easily
+      aSubs.Clear();
+      break;
+    }
+  }
+  if (aSubs.Extent() > 1) { // ok to split
+    TopTools_ListIteratorOfListOfShape aSub(aSubs);
+    GeomShapePtr aSubSh(new GeomAPI_Shape);
+    aSubSh->setImpl(new TopoDS_Shape(aSub.Value()));
+    setValue(theContext, aSubSh);
+    for(aSub.Next(); aSub.More(); aSub.Next()) {
+      GeomShapePtr aSubSh(new GeomAPI_Shape);
+      aSubSh->setImpl(new TopoDS_Shape(aSub.Value()));
+      myParent->append(theContext, aSubSh);
+    }
+  }
+}
+
 bool Model_AttributeSelection::update()
 {
   TDF_Label aSelLab = selectionLabel();
@@ -464,28 +490,9 @@ bool Model_AttributeSelection::update()
       // shape type shoud not not changed: if shape becomes compound of such shapes, then split
       if (myParent && !anOldShape.IsNull() && !aNewShape.IsNull() &&
           anOldShape.ShapeType() != aNewShape.ShapeType() &&
-          aNewShape.ShapeType() == TopAbs_COMPOUND) {
-        TopTools_ListOfShape aSubs;
-        for(TopoDS_Iterator anExplorer(aNewShape); anExplorer.More(); anExplorer.Next()) {
-          if (!anExplorer.Value().IsNull() &&
-              anExplorer.Value().ShapeType() == anOldShape.ShapeType()) {
-            aSubs.Append(anExplorer.Value());
-          } else { // invalid case; bad result shape, so, impossible to split easily
-            aSubs.Clear();
-            break;
-          }
-        }
-        if (aSubs.Extent() > 1) { // ok to split
-          TopTools_ListIteratorOfListOfShape aSub(aSubs);
-          GeomShapePtr aSubSh(new GeomAPI_Shape);
-          aSubSh->setImpl(new TopoDS_Shape(aSub.Value()));
-          setValue(aContext, aSubSh);
-          for(aSub.Next(); aSub.More(); aSub.Next()) {
-            GeomShapePtr aSubSh(new GeomAPI_Shape);
-            aSubSh->setImpl(new TopoDS_Shape(aSub.Value()));
-            myParent->append(aContext, aSubSh);
-          }
-        }
+          (aNewShape.ShapeType() == TopAbs_COMPOUND || aNewShape.ShapeType() == TopAbs_COMPSOLID))
+      {
+        split(aContext, aNewShape, anOldShape.ShapeType());
       }
       owner()->data()->sendAttributeUpdated(this);  // send updated if shape is changed
     }
@@ -904,22 +911,38 @@ void Model_AttributeSelection::selectConstruction(
                   if (aFaceCurve == aCurve) {
                     int anOrient = Model_SelectionNaming::edgeOrientation(aSubShape, anEdge);
                     anOrientations[anID] = anOrient;
-                    registerSubShape(
-                      selectionLabel(), anEdge, anID, aContextFeature, aMyDoc, anOrientations,
-                      aSubNames, Handle(TDataStd_IntPackedMap)(), anOrient);
+
+                    TDF_Label aLab = selectionLabel().FindChild(anID);
+                    std::string aName = "Edge-" + Model_SelectionNaming::shortName(aConstr, 0);
+                    TNaming_Builder aBuilder(aLab);
+                    aBuilder.Generated(anEdge);
+                    aMyDoc->addNamingName(aLab, aName.c_str());
+                    TDataStd_Name::Set(aLab, aName.c_str());
+
+                    if (anOrient != 0) {
+                      // store the orientation of edge relatively to face if needed
+                      TDataStd_Integer::Set(aLab, anOrient);
+                    }
                   }
                 }
               } else { // put vertices of the selected edge to sub-labels
                 // add edges to sub-label to support naming for edges selection
-                TopExp_Explorer anEdgeExp(aSubShape, TopAbs_VERTEX);
+                int aDelta = kSTART_VERTEX_DELTA;
                 int aTagIndex = anID + kSTART_VERTEX_DELTA;
-                for(; anEdgeExp.More(); anEdgeExp.Next(), aTagIndex += kSTART_VERTEX_DELTA) {
+                for(TopExp_Explorer anEdgeExp(aSubShape, TopAbs_VERTEX);
+                    anEdgeExp.More();
+                    anEdgeExp.Next(),
+                    aTagIndex += kSTART_VERTEX_DELTA,
+                    aDelta += kSTART_VERTEX_DELTA) {
                   TopoDS_Vertex aV = TopoDS::Vertex(anEdgeExp.Current());
 
-                  std::stringstream anAdditionalName;
-                  registerSubShape(
-                    selectionLabel(), aV, aTagIndex, aContextFeature, aMyDoc, anOrientations,
-                    aSubNames);
+                  TDF_Label aLab = selectionLabel().FindChild(aTagIndex);
+                  std::string aName = "Vertex-"
+                      + Model_SelectionNaming::shortName(aConstr, aDelta / kSTART_VERTEX_DELTA);
+                  TNaming_Builder aBuilder(aLab);
+                  aBuilder.Generated(aV);
+                  aMyDoc->addNamingName(aLab, aName.c_str());
+                  TDataStd_Name::Set(aLab, aName.c_str());
                 }
               }
             }
@@ -1202,6 +1225,19 @@ void Model_AttributeSelection::updateInHistory()
     // update scope to reset to a new one
     myScope.Clear();
     myRef.setValue(aModifierResFound);
+    // if context shape type is changed to more complicated and this context is selected, split
+    if (myParent &&!aSubShape.get() && aModifierResFound->shape().get() && aContext->shape().get())
+    {
+      TopoDS_Shape anOldShape = aContext->shape()->impl<TopoDS_Shape>();
+      TopoDS_Shape aNewShape = aModifierResFound->shape()->impl<TopoDS_Shape>();
+      if (!anOldShape.IsNull() && !aNewShape.IsNull() &&
+        anOldShape.ShapeType() != aNewShape.ShapeType() &&
+        (aNewShape.ShapeType() == TopAbs_COMPOUND || aNewShape.ShapeType() == TopAbs_COMPSOLID)) {
+        // prepare for split in "update"
+        TDF_Label aSelLab = selectionLabel();
+        split(aContext, aNewShape, anOldShape.ShapeType());
+      }
+    }
     update(); // it must recompute a new sub-shape automatically
   }
 }
index a24ca2d818c6d3bc639862b9ce21e0d2f8c86eae..93fb9876e0888bd5a6c85e607163a367c605f3f2 100644 (file)
@@ -11,6 +11,7 @@
 #include "Model_AttributeReference.h"
 #include <ModelAPI_AttributeSelection.h>
 #include <TDF_LabelMap.hxx>
+#include <TopoDS_Shape.hxx>
 
 class Model_AttributeSelectionList;
 
@@ -121,6 +122,9 @@ protected:
   /// Sets the parent attribute
   void setParent(Model_AttributeSelectionList* theParent);
 
+  /// Splits theNewShape into sub-shapes of theType type (for the list parent of this attribute)
+  void split(ResultPtr theContext, TopoDS_Shape theNewShape, TopAbs_ShapeEnum theType);
+
   friend class Model_Data;
   friend class Model_AttributeSelectionList;
 };
index 7081ebd418b4cdbfb0dee22917dec9040c1f5d4d..ee29017f4a82f52015d66d2253215adb31f3e273 100644 (file)
@@ -191,6 +191,7 @@ std::shared_ptr<ModelAPI_Document> Model_Session::moduleDocument()
   if (aFirstCall) {
     // to be sure that plugins are loaded,
     // even before the first "createFeature" call (in unit tests)
+
     LoadPluginsInfo();
     // creation of the root document is always outside of the transaction, so, avoid checking it
     setCheckTransactions(false);
@@ -434,7 +435,7 @@ void Model_Session::LoadPluginsInfo()
 {
   if (myPluginsInfoLoaded)  // nothing to do
     return;
-
+  Config_ModuleReader::loadScript("salome.shaper.initConfig", false);
   // Read plugins information from XML files
   Config_ModuleReader aModuleReader(Config_FeatureMessage::MODEL_EVENT());
   aModuleReader.readAll();
index 6fbe8f77e0b606137e6e517bfcee17e2ef94f2d3..0e90444bce704ed2e23aaea427b1a0801c80acdd 100644 (file)
@@ -141,4 +141,5 @@ ADD_UNIT_TESTS(TestConstants.py
                Test1512.py
                TestDoubleArray.py
                Test1757.py
+               Test1998.py
 )
index f0af7ad980d981f0e51351c9eb70dede2c992d1e..14ad14b444bf8036e8c0e32f934e9951acac4710 100644 (file)
@@ -73,7 +73,7 @@ aSession.setActiveDocument(aPartSet)
 aPlane = aPartSet.addFeature("Plane")
 aPlane.string("creation_method").setValue("by_other_plane")
 aPlane.string("by_other_plane_option").setValue("by_distance_from_other")
-aPlane.selection("plane").selectSubShape("face", "Part_1/Extrusion_1_1/Generated_Face_3")
+aPlane.selection("plane").selectSubShape("face", "Part_1/Extrusion_1_1/Generated_Face_1")
 aPlane.real("distance").setValue(0.001)
 aPlane.boolean("reverse").setValue(False)
 aSession.finishOperation()
diff --git a/src/ModelAPI/Test/Test1998.py b/src/ModelAPI/Test/Test1998.py
new file mode 100644 (file)
index 0000000..3c67c62
--- /dev/null
@@ -0,0 +1,14 @@
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+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(-106.3464837049742, -78.0445969125214, -108.0617495711835, 165.5231560891939)
+model.do()
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s")])
+model.end()
+
+assert(model.checkPythonDump())
index e7b448bc39d2453618b32173645607a3ce7551b1..734b426bba8a7f445acbe7be204f097ca8150828 100644 (file)
@@ -28,6 +28,7 @@
 // standard definitions
 %include "typemaps.i"
 %include "std_list.i"
+%include "std_pair.i"
 %include "std_string.i"
 %include "std_shared_ptr.i"
 
 %template(RefAttrList) std::list<ModelHighAPI_RefAttr>;
 %template(RefList) std::list<ModelHighAPI_Reference>;
 
+// std::pair -> []
+%template(ResultSubShapePair) std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> >;
+
 
 // fix compilarion error: ‘res*’ was not declared in this scope
 %typemap(freearg) const std::list<ModelHighAPI_RefAttr> & {}
index e63c40ec8b3b1c5d1577dc4045d1d2c67286983a..e446cff41b16ea33f764baf76007f2fb14d22a2b 100644 (file)
@@ -104,8 +104,13 @@ std::string ModelHighAPI_Selection::shapeType() const
 //==================================================================================================
 void ModelHighAPI_Selection::setName(const std::string& theName)
 {
-  if (myVariantType == VT_ResultSubShapePair)
-    myResultSubShapePair.first->data()->setName(theName);
+  if (myVariantType == VT_ResultSubShapePair) {
+    std::shared_ptr<ModelAPI_Result> aResult = myResultSubShapePair.first;
+    if(!aResult.get()) {
+      return;
+    }
+    aResult->data()->setName(theName);
+  }
 }
 
 void ModelHighAPI_Selection::setColor(int theRed, int theGreen, int theBlue)
@@ -132,7 +137,20 @@ void ModelHighAPI_Selection::setDeflection(double theValue)
   aDeflectionAttr->setValue(theValue);
 }
 
-ModelHighAPI_Selection ModelHighAPI_Selection::subResult(int theIndex)
+int ModelHighAPI_Selection::numberOfSubs() const
+{
+  if (myVariantType != VT_ResultSubShapePair)
+    return 0;
+
+  ResultCompSolidPtr aCompSolid =
+      std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(myResultSubShapePair.first);
+  if (!aCompSolid)
+    return 0;
+
+  return aCompSolid->numberOfSubs();
+}
+
+ModelHighAPI_Selection ModelHighAPI_Selection::subResult(int theIndex) const
 {
   if (myVariantType != VT_ResultSubShapePair)
     return ModelHighAPI_Selection();
index 7d898698397a0e4b75e0cf2fbe11ebe585867873..c807cb19c4d65fef8596cde12d27889426390a8a 100644 (file)
@@ -91,9 +91,13 @@ public:
   MODELHIGHAPI_EXPORT
   void setDeflection(double theValue);
 
-  /// Return sub-result for ResultCompSolid
+  /// Returns the number of sub-elements.
   MODELHIGHAPI_EXPORT
-  ModelHighAPI_Selection subResult(int theIndex);
+  int numberOfSubs() const;
+
+  /// Returns the sub-result by zero-base index.
+  MODELHIGHAPI_EXPORT
+  ModelHighAPI_Selection subResult(int theIndex) const;
 
 private:
   VariantType myVariantType;
index b6b9374feaae0314e6353198737177a820e609a7..f4047896ec3e12d79bb6723d5f3ff45264344e5d 100644 (file)
@@ -10,6 +10,7 @@
 //--------------------------------------------------------------------------------------
 #include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Tools.h>
+#include <ModelAPI_ResultParameter.h>
 //--------------------------------------------------------------------------------------
 ParametersAPI_Parameter::ParametersAPI_Parameter(
     const std::shared_ptr<ModelAPI_Feature> & theFeature)
@@ -35,6 +36,22 @@ ParametersAPI_Parameter::ParametersAPI_Parameter(
   }
 }
 
+void ParametersAPI_Parameter::setValue(const double theValue)
+{
+  // convert value to the expression string
+  std::ostringstream aValueStr;
+  aValueStr<<theValue;
+  fillAttribute(aValueStr.str(), expression());
+  execute();
+}
+
+double ParametersAPI_Parameter::value() {
+  ResultParameterPtr aRes =
+    std::dynamic_pointer_cast<ModelAPI_ResultParameter>(feature()->firstResult());
+  // it may raise an exception if result is invalid
+  return aRes->data()->real(ModelAPI_ResultParameter::VALUE())->value();
+}
+
 ParametersAPI_Parameter::~ParametersAPI_Parameter()
 {
 }
index e9122a10777ac836e71788c37279f923a1b3c6f3..82bfce5f04d646a29c62c0c761e4d9eaf9f5e23b 100644 (file)
@@ -47,6 +47,11 @@ public:
               ModelAPI_AttributeString, /** Comment */
   )
 
+  /// Just sets the numeric value to the parameter (it resets the previous expression)
+  PARAMETERSAPI_EXPORT void setValue(const double theValue);
+  /// Returns the current value of the parameter: the expression result.
+  PARAMETERSAPI_EXPORT double value();
+
   /// Dump wrapped feature
   PARAMETERSAPI_EXPORT
   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
index 51bcec762811c2ca6803d7958fb780426fc17963..c08cce43cc3d981b83b9114dab31a5bcb13417d9 100755 (executable)
@@ -1195,10 +1195,6 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
           }
         }
       }
-
-      ResultBodyPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aObject);
-      if( aResult.get() )
-        theMenu->addAction(myMenuMgr->action("SELECT_PARENT_CMD"));
     }
   }
   bool aNotDeactivate = (aCurrentOp == 0);
index 81945bbd47f3d1625bacd730172936e98d31d288..ccd18aed06d71d54fbe0cc7bfe22897e8b049710 100755 (executable)
@@ -903,6 +903,8 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
 
   // Display sketcher objects
   QStringList anInfo;
+  Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+  const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
   for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
     FeaturePtr aFeature = myCurrentSketch->subFeature(i);
 #ifdef DEBUG_SKETCHER_ENTITIES
@@ -911,9 +913,16 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
     std::list<ResultPtr> aResults = aFeature->results();
     std::list<ResultPtr>::const_iterator aIt;
     for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
-      (*aIt)->setDisplayed(true);
+      if ((*aIt)->isDisplayed())
+        // Display object if it was created outside of GUI
+        aECreator->sendUpdated((*aIt), EVENT_DISP);
+      else
+        (*aIt)->setDisplayed(true);
     }
-    aFeature->setDisplayed(true);
+    if (aFeature->isDisplayed())
+      aECreator->sendUpdated(aFeature, EVENT_DISP);
+    else
+      aFeature->setDisplayed(true);
   }
 #ifdef DEBUG_SKETCHER_ENTITIES
   QString anInfoStr = anInfo.join(";\t");
index b5b5163ff4809fe9dae83572dbe889e0eb601e12..de6b4bdea529999a760bf98fbd6bbf262f09a2d3 100755 (executable)
@@ -563,16 +563,6 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap
         (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
 
       ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
-      /// check external line created on Trihedron Axis
-      /// selection of a point on external edge referenced to AIS_Trihedron axis
-      /// should be prohibited or point should be replaced to "Origin". The second
-      /// case is implemented because of not correct AIS_Trihedron origin point highlight
-      /// When AIS is corrected(exactly priority of origin and stayed vertex by highlight)
-      /// the next check should be moved to Partset 2d point widget in isValidSelectionCustom
-      bool isAxis = isAxisSelected(theObject);
-      if (isAxis)
-        aRes = ResultPtr(); // to rely on code below that found the Origin result
-
       // if there is no object,
       // it means that this is the origin point: search it in the module document
       if (!aRes.get()) {
@@ -628,29 +618,6 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap
   return ResultPtr();
 }
 
-bool PartSet_Tools::isAxisSelected(const ObjectPtr& theObject)
-{
-  bool isAxis = false;
-  ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
-  if (aRes.get()) {
-    // check if result belongs to external feature
-    // in this case we should use as a result reference of external feature
-    FeaturePtr aResFeature = ModelAPI_Feature::feature(aRes);
-    std::shared_ptr<SketchPlugin_Feature> aSPFeature =
-                  std::dynamic_pointer_cast<SketchPlugin_Feature>(aResFeature);
-    if (aSPFeature.get() && aSPFeature->isExternal()) {
-      AttributeSelectionPtr aAttr = aResFeature->selection(
-                                    SketchPlugin_SketchEntity::EXTERNAL_ID());
-      if (aAttr) { /// check if the result is Axis
-        ResultPtr anExternalRes = std::dynamic_pointer_cast<ModelAPI_Result>(aAttr->context());
-        FeaturePtr aResFeature = ModelAPI_Feature::feature(anExternalRes);
-        isAxis = aResFeature->getKind() == "Axis"; //ConstructionPlugin_Axis::ID()
-      }
-    }
-  }
-  return isAxis;
-}
-
 bool PartSet_Tools::isContainPresentation(const QList<ModuleBase_ViewerPrsPtr>& theSelected,
                                           const ModuleBase_ViewerPrsPtr& thePrs)
 {
index 63812a712b7a2c7e5e7d4ddb0ef02a33b6cadd94..b4b26139c345fcc1fb82aba57441dbb2f8d65c68 100755 (executable)
@@ -180,13 +180,6 @@ public:
                                                CompositeFeaturePtr theSketch,
                                                const bool theTemporary = false);
 
-
-  /// Checks if the shape is Origin, the conditions are the shape is a vertex and
-  /// selected feature is an external feature created on Axis
-  /// \param theObject a selected object in the viewer
-  /// \return boolean value
-  static bool isAxisSelected(const ObjectPtr& theObject);
-
     /// Checks whether the list of selected presentations contains the given one
   /// \param theSelected a list of presentations
   /// \param thePrs a presentation to be found
index 8c7d1031b4d2a7c05410e47a27883d1bc65b8aaa..e6c1cf1d314f8b2a102283cf3464a7366319db7f 100644 (file)
@@ -457,60 +457,57 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo
     std::shared_ptr<SketchPlugin_Feature> aSPFeature;
     if (aSelectedFeature.get() != NULL)
       aSPFeature = std::dynamic_pointer_cast<SketchPlugin_Feature>(aSelectedFeature);
-      if ((!aSPFeature && !aShape.IsNull()) ||
-          (aSPFeature.get() && aSPFeature->isExternal())) {
-        ResultPtr aFixedObject;
+
+    ResultPtr aFixedObject;
+    bool aSketchExternalFeature = aSPFeature.get() && aSPFeature->isExternal();
+    if ((!aSPFeature && !aShape.IsNull()) || aSketchExternalFeature) {
+      aFixedObject = PartSet_Tools::findFixedObjectByExternal(aShape, aObject, mySketch);
+      if (aSketchExternalFeature && !aFixedObject.get()) {/// local selection on external feature
+        anExternal = false;
+      }
+      else {
         anExternal = true;
-        aFixedObject = PartSet_Tools::findFixedObjectByExternal(aShape, aObject, mySketch);
         if (!aFixedObject.get())
           aFixedObject = PartSet_Tools::createFixedObjectByExternal(aShape, aObject, mySketch);
-        double aX, aY;
-        if (getPoint2d(aView, aShape, aX, aY) && isFeatureContainsPoint(myFeature, aX, aY)) {
-          // do not create a constraint to the point, which already used by the feature
-          // if the feature contains the point, focus is not switched
+      }
+    }
+    if (anExternal) {
+      double aX, aY;
+      if (getPoint2d(aView, aShape, aX, aY) && isFeatureContainsPoint(myFeature, aX, aY)) {
+        // do not create a constraint to the point, which already used by the feature
+        // if the feature contains the point, focus is not switched
+        setPoint(aX, aY);
+      }
+      else {
+        if (getPoint2d(aView, aShape, aX, aY))
           setPoint(aX, aY);
-        }
-        else {
-          if (getPoint2d(aView, aShape, aX, aY))
-            setPoint(aX, aY);
-          else
-            setValueState(Stored); // in case of edge selection, Apply state should also be updated
-          bool anOrphanPoint = aShape.ShapeType() == TopAbs_VERTEX ||
-                               isOrphanPoint(aSelectedFeature, mySketch, aX, aY);
-          if (anExternal) {
-            // we should not stop reentrant operation on external objects because
-            anOrphanPoint = true;
-            // they are not participate in the contour creation excepting external vertices
-            if (aShape.ShapeType() == TopAbs_VERTEX) {
-              FeaturePtr aFixedFeature = ModelAPI_Feature::feature(aFixedObject);
-              if (aFixedFeature.get() && aFixedFeature->getKind() == SketchPlugin_Point::ID()) {
-                anOrphanPoint = isOrphanPoint(aFixedFeature, mySketch, aX, aY);
-              }
-            }
-            else {
-              // point is taken from mouse event and set in attribute.
-              // It should be done before setting
-              // coinident constraint to the external line. If a point is created, it should be
-              // in the mouse clicked point
-              gp_Pnt aPoint =
-                PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView());
-              double aX, anY;
-              PartSet_Tools::convertTo2D(aPoint, mySketch, aView, aX, anY);
-              setPoint(aX, anY);
+        else
+          setValueState(Stored); // in case of edge selection, Apply state should also be updated
+        bool anOrphanPoint = aShape.ShapeType() == TopAbs_VERTEX ||
+                              isOrphanPoint(aSelectedFeature, mySketch, aX, aY);
+        if (anExternal) {
+          // we should not stop reentrant operation on external objects because
+          anOrphanPoint = true;
+          // they are not participate in the contour creation excepting external vertices
+          if (aShape.ShapeType() == TopAbs_VERTEX) {
+            FeaturePtr aFixedFeature = ModelAPI_Feature::feature(aFixedObject);
+            if (aFixedFeature.get() && aFixedFeature->getKind() == SketchPlugin_Point::ID()) {
+              anOrphanPoint = isOrphanPoint(aFixedFeature, mySketch, aX, aY);
             }
           }
-          if (aFixedObject.get())
-            setConstraintWith(aFixedObject);
-          // fignal updated should be flushed in order to visualize possible created
-          // external objects e.g. selection of trihedron axis when input end arc point
-          updateObject(feature());
+        }
+        if (aFixedObject.get())
+          setConstraintWith(aFixedObject);
+        // fignal updated should be flushed in order to visualize possible created
+        // external objects e.g. selection of trihedron axis when input end arc point
+        updateObject(feature());
 
-          if (!anOrphanPoint)
-            emit vertexSelected(); // it stops the reentrant operation
+        if (!anOrphanPoint)
+          emit vertexSelected(); // it stops the reentrant operation
 
-          emit focusOutWidget(this);
-        }
+        emit focusOutWidget(this);
       }
+    }
     if (!anExternal) {
       double aX, aY;
       bool isProcessed = false;
index 1b837d2acc7e0ff6569f24c7cf5d0c8e80d597c8..f68c872585210383296496a7122f21bb1a9d8a86 100644 (file)
@@ -3,6 +3,7 @@
 INSTALL(DIRECTORY geom model examples DESTINATION ${SHAPER_INSTALL_PYTHON_API})
 INSTALL(FILES __init__.py DESTINATION ${SHAPER_INSTALL_PYTHON_API})
 INSTALL(FILES __init__.py DESTINATION ${_pydir}/salome)
+INSTALL(FILES initConfig.py DESTINATION ${SHAPER_INSTALL_PYTHON_API})
 
 # --------- Unit tests -----------
 INCLUDE(UnitTest)
index 11e74e46d8bcf60798472086b0576e484a6d7d12..ddd01d97368a9a042d2250bf779012ab1bb3782a 100644 (file)
@@ -7,7 +7,7 @@ from TestSketcher import SketcherTestCase
 
 class SketcherAddArc(SketcherTestCase):
     def test_arc_by_coords(self):
-        arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, 0)
+        arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, False)
         model.do()
         self.assertEqual(arc.startPoint().x(), 0)
         self.assertEqual(arc.startPoint().y(), 0)
@@ -16,15 +16,15 @@ class SketcherAddArc(SketcherTestCase):
         center = geom.Pnt2d(0, 1)
         start = geom.Pnt2d(0, 0)
         end = geom.Pnt2d(1, 1)
-        arc = self.sketch.addArc(center, start, end, 0)
+        arc = self.sketch.addArc(center, start, end, False)
         model.do()
         self.assertEqual(arc.startPoint().x(), 0)
         self.assertEqual(arc.startPoint().y(), 0)
 
     def test_modify_arc(self):
         # Note: arc will modify startPoint and endPoint to be in circle
-        arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, 0)
-        arc.setByCenterStartEnd(0, 0, 1, 1, -1, -1, 0)
+        arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, False)
+        arc.setByCenterStartEnd(0, 0, 1, 1, -1, -1, False)
         model.do()
         self.assertEqual(arc.center().x(), 0)
         self.assertEqual(arc.center().y(), 0)
index 4813fa70254646f5c56552869b6b100222f3d7a0..c2b01fa0c205e8b9f4f47cbf97154cb930db99eb 100644 (file)
@@ -58,7 +58,7 @@ def vertical_body():
 
 def bottom_body():
     # Create XOY sketch
-    sketch = model.addSketch(part, "Extrusion_1_1/Generated_Face_3")
+    sketch = model.addSketch(part, "Extrusion_1_1/Generated_Face_5")
 
     # Create base polygon
     points = [(0, 0), (0, L), (P, L), (P, 16 + 16), (P - 20, 16 + 16), (P - 20, 16), (P, 16), (P, 0)]
@@ -91,7 +91,7 @@ def bottom_body():
     sketch.setCoincident(arc.endPoint(), h1.startPoint())
 
     # Binding
-    left_e = sketch.addLine("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1_1")
+    left_e = sketch.addLine("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1_1")
     sketch.setCoincident(left_e.startPoint(), left.endPoint())
     sketch.setCoincident(left_e.endPoint(), left.startPoint())
 
@@ -112,7 +112,7 @@ def bottom_body():
 
 def body_3():
     # Create XOZ sketch
-    sketch = model.addSketch(part, "Boolean_1_1/Modified_4")
+    sketch = model.addSketch(part, "Boolean_1_1/Modified_2")
 
     # Create base polygon
     H, L, l, r = 28, 40, 8, 12
@@ -150,7 +150,7 @@ def body_3():
     sketch.setRadius(arc, r)
 
     # Binding
-    bottom_e = sketch.addLine("Boolean_1_1/Modified_5&Boolean_1_1/Modified_8")
+    bottom_e = sketch.addLine("Boolean_1_1/Modified_7&Boolean_1_1/Modified_5")
     sketch.setCoincident(bottom_e, bottom.startPoint())
     sketch.setCoincident(bottom_e.startPoint(), bottom.endPoint())
 
diff --git a/src/PythonAPI/initConfig.py b/src/PythonAPI/initConfig.py
new file mode 100644 (file)
index 0000000..6e130ee
--- /dev/null
@@ -0,0 +1,13 @@
+"""This script inspects existing modules in SALOME and registrs them in
+Module reader
+"""
+
+import salome
+import SALOME_ModuleCatalog
+import ConfigAPI
+
+obj = salome.naming_service.Resolve('Kernel/ModulCatalog')
+catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
+aCorbaModules = catalog.GetComponentList()
+for aName in aCorbaModules:
+  ConfigAPI.Config_ModuleReader.addDependencyModule(aName)
index 34d537d597987739fb1cd85f025ad8d437cdfbc3..29364c692b38edf4074740ddaec6a2129bd1ce8b 100644 (file)
@@ -24,3 +24,4 @@ from parameter import *
 from partset import *
 from primitives import *
 from gdml import *
+from tests import *
diff --git a/src/PythonAPI/model/tests/__init__.py b/src/PythonAPI/model/tests/__init__.py
new file mode 100644 (file)
index 0000000..f853b10
--- /dev/null
@@ -0,0 +1 @@
+from tests import *
\ No newline at end of file
diff --git a/src/PythonAPI/model/tests/tests.py b/src/PythonAPI/model/tests/tests.py
new file mode 100644 (file)
index 0000000..cb2ce66
--- /dev/null
@@ -0,0 +1,66 @@
+from GeomAlgoAPI import *
+import math
+
+
+def generateTests(theFeature, theFeatureName, theTestsList = []):
+  """ Generates tests for theFeature.
+  :param theFeature: feature to test. Should be ModelHighAPI_Interface.
+  :param theFeatureName: feature name to put in test commands.
+  :param theTestsList: list of test to be generated. If empty generates all tests.
+  """
+  if "testNbResults" in theTestsList or len(theTestsList) == 0:
+    aNbResults = len(theFeature.results())
+    print "model.testNbResults({}, {})".format(theFeatureName, aNbResults)
+
+  if "testNbSubResults" in theTestsList or len(theTestsList) == 0:
+    aNbResults = len(theFeature.results())
+    aNbSubResults = []
+    for anIndex in range(0, aNbResults):
+      aNbSubResults.append(theFeature.results()[anIndex].numberOfSubs())
+    print "model.testNbSubResults({}, {})".format(theFeatureName, aNbSubResults)
+
+  if "testResultsVolumes" in theTestsList or len(theTestsList) == 0:
+    aNbResults = len(theFeature.results())
+    aResultsVolumes = []
+    for anIndex in range(0, aNbResults):
+      aResultsVolumes.append(GeomAlgoAPI_ShapeTools_volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape()))
+    print "model.testResultsVolumes({}, [{}])".format(theFeatureName, ", ".join("{:0.27f}".format(i) for i in aResultsVolumes))
+
+
+def testNbResults(theFeature, theExpectedNbResults):
+  """ Tests number of feature results.
+  :param theFeature: feature to test.
+  :param theExpectedNbResults: expected number of results.
+  """
+  aNbResults = len(theFeature.results())
+  assert (aNbResults == theExpectedNbResults), "Number of results: {}. Expected: {}.".format(aNbResults, theExpectedNbResults)
+
+
+def testNbSubResults(theFeature, theExpectedNbSubResults):
+  """ Tests number of feature sub-results for each result.
+  :param theFeature: feature to test.
+  :param theExpectedNbSubResults: list of sub-results numbers. Size of list should be equal to len(theFeature.results()).
+  """
+  aNbResults = len(theFeature.results())
+  aListSize = len(theExpectedNbSubResults)
+  assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize)
+  for anIndex in range(0, aNbResults):
+    aNbSubResults = theFeature.results()[anIndex].numberOfSubs()
+    anExpectedNbSubResults = theExpectedNbSubResults[anIndex]
+    assert (aNbSubResults == anExpectedNbSubResults), "Number of sub-results for result[{}]: {}. Expected: {}.".format(anIndex, aNbSubResults, anExpectedNbSubResults)
+
+
+def testResultsVolumes(theFeature, theExpectedResultsVolumes, theNbSignificantDigits = 10):
+  """ Tests results volumes.
+  :param theFeature: feature to test.
+  :param theExpectedResultsVolumes: list of results volumes. Size of list should be equal to len(theFeature.results()).
+  """
+  aNbResults = len(theFeature.results())
+  aListSize = len(theExpectedResultsVolumes)
+  assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize)
+  for anIndex in range(0, aNbResults):
+    aResultVolume = GeomAlgoAPI_ShapeTools_volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape())
+    aResultVolumeStr = "{:0.27f}".format(aResultVolume).lstrip("0").lstrip(".").lstrip("0")
+    anExpectedResultVolume = theExpectedResultsVolumes[anIndex]
+    anExpectedResultVolumeStr = "{:0.27f}".format(anExpectedResultVolume).lstrip("0").lstrip(".").lstrip("0")
+    assert (aResultVolumeStr[:theNbSignificantDigits] == anExpectedResultVolumeStr[:theNbSignificantDigits]), "Volume of result[{}]: {:0.27f}. Expected: {:0.27f}. The first {} significant digits not equal.".format(anIndex, aResultVolume, anExpectedResultVolume, theNbSignificantDigits)
index afaaf6a2cdf612ab5e281d5b3b8665bb10fab27f..5c71120f681b20af62eda2345edf8dd764059c43 100644 (file)
@@ -121,7 +121,6 @@ SHAPERGUI::~SHAPERGUI()
 void SHAPERGUI::initialize(CAM_Application* theApp)
 {
   LightApp_Module::initialize(theApp);
-  inspectSalomeModules();
 
   myWorkshop->startApplication();
   LightApp_Application* anApp = dynamic_cast<LightApp_Application*>(theApp);
@@ -663,15 +662,6 @@ void SHAPERGUI::putInfo(const QString& theInfo, const int theMSecs)
   application()->putInfo(theInfo, theMSecs);
 }
 
-void SHAPERGUI::inspectSalomeModules()
-{
-  QStringList aModuleNames;
-  getApp()->modules(aModuleNames, false);
-  foreach(QString eachModule, aModuleNames) {
-    Config_ModuleReader::addDependencyModule(eachModule.toStdString());
-  }
-}
-
 bool SHAPERGUI::abortAllOperations()
 {
   return workshop()->operationMgr()->abortAllOperations();
index 9b9f28aab21563ce5396c31e64fa683094148665..5e1c23501fbdfe6a7f076c78c795f5d9acfc6557 100644 (file)
@@ -136,9 +136,6 @@ Q_OBJECT
   /// \brief Set flag about opened document state
   void setIsOpened(bool theOpened) { myIsOpened = theOpened; }
 
-  /// Register current modules of SALOME
-  void inspectSalomeModules();
-
  public slots:
   /// \brief The method is redefined to connect to the study viewer before the data
   /// model is filled by opened file. This file open will flush redisplay signals for,
index 1291a8099710b26801dada088347409c04281963..584fa67512dd132b4c7a0e174abe5b7c5a2bacbc 100644 (file)
@@ -7,7 +7,14 @@
 
 //--------------------------------------------------------------------------------------
 #include "SketchAPI_Projection.h"
-//--------------------------------------------------------------------------------------
+
+#include <SketchPlugin_Line.h>
+#include <SketchPlugin_Circle.h>
+
+#include <SketchAPI_Line.h>
+#include <SketchAPI_Circle.h>
+#include <SketchAPI_Arc.h>
+
 #include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Selection.h>
 #include <ModelHighAPI_Tools.h>
@@ -60,12 +67,23 @@ void SketchAPI_Projection::setByExternalName(const std::string& theExternalName)
 }
 
 //--------------------------------------------------------------------------------------
-std::shared_ptr<ModelHighAPI_Interface> SketchAPI_Projection::createdFeature() const
+std::shared_ptr<SketchAPI_SketchEntity> SketchAPI_Projection::createdFeature() const
 {
   AttributeRefAttrPtr aProjectedRefAttr = projectedFeature();
   FeaturePtr aProjectedFeature = ModelAPI_Feature::feature(aProjectedRefAttr->object());
+  std::shared_ptr<SketchAPI_SketchEntity> anEntity;
+
+  if(!aProjectedFeature.get()) {
+    return anEntity;
+  }
+
+  aProjectedFeature->getKind() == SketchPlugin_Line::ID() ?
+    anEntity.reset(new SketchAPI_Line(aProjectedFeature)) :
+    aProjectedFeature->getKind() == SketchPlugin_Circle::ID() ?
+      anEntity.reset(new SketchAPI_Circle(aProjectedFeature)) :
+      anEntity.reset(new SketchAPI_Arc(aProjectedFeature));
 
-  return std::shared_ptr<ModelHighAPI_Interface>(new ModelHighAPI_Interface(aProjectedFeature));
+  return anEntity;
 }
 
 //--------------------------------------------------------------------------------------
index b8c3ff3977ef1849134f4387bc76d3c8ee6898d1..e3870de4eb87a3a83d49a36b66a784438ab0f7e3 100644 (file)
@@ -58,7 +58,7 @@ public:
 
   /// Returns created feature
   SKETCHAPI_EXPORT
-  std::shared_ptr<ModelHighAPI_Interface> createdFeature() const;
+  std::shared_ptr<SketchAPI_SketchEntity> createdFeature() const;
 
   /// Dump wrapped feature
   SKETCHAPI_EXPORT
index fcde942541802098f25f7715223e2cb5d2babbd4..32199abce256870049b612d95c94b8459bef9566 100755 (executable)
@@ -16,6 +16,7 @@
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_Tools.h>
+#include <ModelAPI_AttributeBoolean.h>
 
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Session.h>
@@ -368,11 +369,27 @@ AISObjectPtr SketchPlugin_ConstraintSplit::getAISObject(AISObjectPtr thePrevious
       if (!anAIS)
         anAIS = AISObjectPtr(new GeomAPI_AISObject);
       anAIS->createShape(aShape);
-      anAIS->setWidth(5);
+      std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
+             aBaseFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID());
+
+      bool isConstruction = anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value();
+
       std::vector<int> aColor;
-      aColor = Config_PropManager::color("Visualization", "sketch_entity_color",
-                                          SKETCH_ENTITY_COLOR);
-     anAIS->setColor(aColor[0], aColor[1], aColor[2]);
+      double aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH();
+      int aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE();
+      if (isConstruction) {
+        aColor = Config_PropManager::color("Visualization", "sketch_auxiliary_color",
+                                           SKETCH_AUXILIARY_COLOR);
+        aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH_AUXILIARY();
+        aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY();
+      }
+      else {
+        aColor = Config_PropManager::color("Visualization", "sketch_entity_color",
+                                            SKETCH_ENTITY_COLOR);
+      }
+      anAIS->setColor(aColor[0], aColor[1], aColor[2]);
+      anAIS->setWidth(aWidth + 1);
+      anAIS->setLineStyle(aLineStyle);
     }
     return anAIS;
   }
@@ -1146,13 +1163,25 @@ void SketchPlugin_ConstraintSplit::arrangePointsOnArc(
 void SketchPlugin_ConstraintSplit::fillAttribute(const AttributePtr& theModifiedAttribute,
                                                  const AttributePtr& theSourceAttribute)
 {
-  AttributePoint2DPtr aModifiedAttribute = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-                                            theModifiedAttribute);
-  AttributePoint2DPtr aSourceAttribute = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-                                            theSourceAttribute);
-
-  if (aModifiedAttribute.get() && aSourceAttribute.get())
-    aModifiedAttribute->setValue(aSourceAttribute->pnt());
+  std::string anAttributeType = theModifiedAttribute->attributeType();
+  if (anAttributeType == GeomDataAPI_Point2D::typeId()) {
+    AttributePoint2DPtr aModifiedAttribute = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+                                              theModifiedAttribute);
+    AttributePoint2DPtr aSourceAttribute = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+                                              theSourceAttribute);
+
+    if (aModifiedAttribute.get() && aSourceAttribute.get())
+      aModifiedAttribute->setValue(aSourceAttribute->pnt());
+  }
+  else if (anAttributeType == ModelAPI_AttributeBoolean::typeId()) {
+    AttributeBooleanPtr aModifiedAttribute = std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
+                                              theModifiedAttribute);
+    AttributeBooleanPtr aSourceAttribute = std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
+                                              theSourceAttribute);
+
+    if (aModifiedAttribute.get() && aSourceAttribute.get())
+      aModifiedAttribute->setValue(aSourceAttribute->value());
+  }
 }
 
 FeaturePtr SketchPlugin_ConstraintSplit::createLineFeature(const FeaturePtr& theBaseFeature,
@@ -1168,6 +1197,10 @@ FeaturePtr SketchPlugin_ConstraintSplit::createLineFeature(const FeaturePtr& the
 
   fillAttribute(aFeature->attribute(SketchPlugin_Line::START_ID()), theFirstPointAttr);
   fillAttribute(aFeature->attribute(SketchPlugin_Line::END_ID()), theSecondPointAttr);
+
+  fillAttribute(aFeature->attribute(SketchPlugin_SketchEntity::AUXILIARY_ID()),
+                theBaseFeature->attribute(SketchPlugin_SketchEntity::AUXILIARY_ID()));
+
   aFeature->execute(); // to obtain result
 
   return aFeature;
@@ -1205,6 +1238,9 @@ FeaturePtr SketchPlugin_ConstraintSplit::createArcFeature(const FeaturePtr& theB
   fillAttribute(aFeature->attribute(SketchPlugin_Arc::START_ID()), theFirstPointAttr);
   fillAttribute(aFeature->attribute(SketchPlugin_Arc::END_ID()), theSecondPointAttr);
 
+  fillAttribute(aFeature->attribute(SketchPlugin_SketchEntity::AUXILIARY_ID()),
+                theBaseFeature->attribute(SketchPlugin_SketchEntity::AUXILIARY_ID()));
+
   /// fill referersed state of created arc as it is on the base arc
   if (theBaseFeature->getKind() == SketchPlugin_Arc::ID()) {
     bool aReversed = theBaseFeature->boolean(SketchPlugin_Arc::INVERSED_ID())->value();
index 2e9700e8412423ec100781c5ec4d2da1b41161f8..049f6758c4dfcb19b938a68c3d2049323eba89da 100644 (file)
@@ -86,6 +86,6 @@ SET(XAO_SOURCES
 
 # --- rules ---
 
-ADD_LIBRARY(XAO SHARED ${XAO_SOURCES} ${XAO_HEADERS})
-TARGET_LINK_LIBRARIES(XAO ${PROJECT_LIBRARIES})
-INSTALL(TARGETS XAO DESTINATION ${SHAPER_INSTALL_BIN})
+ADD_LIBRARY(XAOShaper SHARED ${XAO_SOURCES} ${XAO_HEADERS})
+TARGET_LINK_LIBRARIES(XAOShaper ${PROJECT_LIBRARIES})
+INSTALL(TARGETS XAOShaper DESTINATION ${SHAPER_INSTALL_BIN})
index 9a7226a799aa18b3e5a64e30cb6bcb5b0fdccfe7..0f2e73c12542ca42ae4c75498cc02608fc534c62 100644 (file)
@@ -35,7 +35,7 @@ ADD_DEFINITIONS(
 # libraries to link to
 SET(_link_LIBRARIES
   ${CPPUNIT_LIBRARIES}
-  XAO
+  XAOShaper
   )
 
 # --- sources ---
index b86390dda0be144e41f554fb743d31eb8d3a36ed..d9b264babd7bef0cbb61edd5c1c9ba816374bcd9 100644 (file)
@@ -101,8 +101,7 @@ void XGUI_ActionsMgr::updateCommandsStatus()
 {
   setAllEnabled();
   XGUI_Selection* aSelection = myWorkshop->selector()->selection();
-  //if (aSelection->getSelected(ModuleBase_ISelection::Viewer).size() > 0)
-  if (aSelection->getSelected().size() > 0)
+  if (aSelection->getSelected(ModuleBase_ISelection::AllControls).size() > 0)
     updateOnViewSelection();
 
   FeaturePtr anActiveFeature = FeaturePtr();
index 6bf061dcf0365e440e8d2818b97e7bcf345fbc82..2eef35a764ad3cc07869240ddb8a9d30aadfbfa4 100644 (file)
@@ -154,6 +154,9 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& theMess
                 }
               }
             }
+          } else {
+            rebuildDataTree();
+            break;
           }
         } else {
           rebuildDataTree();
index 36849ab9eb47bbb99184d0d0edfc513b1bf78fae..bccb7ddcf003b398acaac8434538aa8f171c4782 100644 (file)
@@ -233,13 +233,6 @@ QList<ModuleBase_ViewerPrsPtr> XGUI_Selection::getHighlighted() const
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
   for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) {
     Handle(SelectMgr_EntityOwner) anOwner = aContext->DetectedOwner();
-    try {
-      // It is checking of existence of presentation object
-      // BUG of OCCT
-      Handle(AIS_InteractiveObject) aTest = aContext->DetectedInteractive();
-    } catch (...) {
-      continue;
-    }
     if (!anOwner.IsNull()) {
       if (aSelectedIds.contains((long)anOwner.get()))
         continue;
index 8a13796870b6fd4c01a7930687d21ddf56ec1fba..03d602762a4a56d3e3e16431dbaa507ee12e5558 100755 (executable)
@@ -808,6 +808,7 @@ void XGUI_Workshop::openDirectory(const QString& theDirectory)
   }
 
   QApplication::setOverrideCursor(Qt::WaitCursor);
+  module()->closeDocument();
   SessionPtr aSession = ModelAPI_Session::get();
   aSession->closeAll();
   aSession->load(myCurrentDir.toLatin1().constData());
@@ -1331,12 +1332,16 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
   else if (theId == "SHOW_CMD") {
     showObjects(aObjects, true);
     mySelector->updateSelectionBy(ModuleBase_ISelection::Browser);
+    updateCommandStatus();
   }
-  else if (theId == "HIDE_CMD")
+  else if (theId == "HIDE_CMD") {
     showObjects(aObjects, false);
+    updateCommandStatus();
+  }
   else if (theId == "SHOW_ONLY_CMD") {
     showOnlyObjects(aObjects);
     mySelector->updateSelectionBy(ModuleBase_ISelection::Browser);
+    updateCommandStatus();
   }
   else if (theId == "SHADING_CMD")
     setDisplayMode(aObjects, XGUI_Displayer::Shading);
@@ -1349,6 +1354,7 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
         aObj->setDisplayed(false);
     }
     Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+    updateCommandStatus();
   } else if (theId == "SELECT_VERTEX_CMD") {
     setViewerSelectionMode(TopAbs_VERTEX);
   } else if (theId == "SELECT_EDGE_CMD") {
@@ -1375,8 +1381,13 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
     if (DFBrowser_FirstCall) {
       Handle(CDF_Application) anApplication = CDF_Session::CurrentSession()->CurrentApplication();
       DFBrowserAPI_Communicator* aCommunicator =
-                     DFBrowserAPI_Communicator::loadPluginLibrary("DFBrowser.dll");
-      aCommunicator->setApplication(anApplication);
+                     DFBrowserAPI_Communicator::loadPluginLibrary("TKDFBrowser.dll");
+      if (aCommunicator) {
+        aCommunicator->setApplication(anApplication);
+        Handle(AIS_InteractiveContext) aContext = viewer()->AISContext();
+        if (aContext)
+          aCommunicator->setContext(aContext);
+      }
       DFBrowser_FirstCall = false;
     }
   }
@@ -1982,17 +1993,7 @@ for (int i = 0; i < aDoc->size(aGroupName); i++) { \
 void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible)
 {
   foreach (ObjectPtr aObj, theList) {
-    /*
-    ResultPartPtr aPartRes = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
-    if (aPartRes) {
-      DocumentPtr aDoc = aPartRes->partDoc();
-      SET_DISPLAY_GROUP(ModelAPI_ResultBody::group(), isVisible)
-      SET_DISPLAY_GROUP(ModelAPI_ResultConstruction::group(), isVisible)
-      SET_DISPLAY_GROUP(ModelAPI_ResultGroup::group(), isVisible)
-    } else {
-    */
-      aObj->setDisplayed(isVisible);
-    //}
+    aObj->setDisplayed(isVisible);
   }
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
 }
@@ -2009,20 +2010,9 @@ void XGUI_Workshop::showOnlyObjects(const QObjectPtrList& theList)
 
   // Show only objects from the list
   foreach (ObjectPtr aObj, theList) {
-    /*
-    ResultPartPtr aPartRes = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
-    if (aPartRes) {
-      DocumentPtr aDoc = aPartRes->partDoc();
-      SET_DISPLAY_GROUP(ModelAPI_ResultBody::group(), true)
-      SET_DISPLAY_GROUP(ModelAPI_ResultConstruction::group(), true)
-      SET_DISPLAY_GROUP(ModelAPI_ResultGroup::group(), true)
-    } else {
-    */
-      aObj->setDisplayed(true);
-    //}
+    aObj->setDisplayed(true);
   }
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
-
 }
 
 
diff --git a/test.models/CMakeLists.txt b/test.models/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1297a8e
--- /dev/null
@@ -0,0 +1,52 @@
+# Copyright (C) 2007-2017  CEA/DEN, EDF R&D, OPEN CASCADE
+
+IF(ADD_MODELS_TESTS)
+  ENABLE_TESTING()
+
+  file(GLOB pyFiles
+      "*.py"
+  )
+
+  if (WIN32) # different separators and path to libraries variable name
+    SET(_JUSTPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${SUIT_LIB_DIR};$ENV{PATH}")
+    STRING(REPLACE "\\" "/" _JUSTPATH "${_JUSTPATH}")
+    STRING(REPLACE ";" "\\;" _JUSTPATH "${_JUSTPATH}")
+    SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS};$ENV{PYTHONPATH}")
+    STRING(REPLACE "\\" "/" _PYTHONPATH "${_PYTHONPATH}")
+    STRING(REPLACE ";" "\\;" _PYTHONPATH "${_PYTHONPATH}")
+  else()
+    SET(_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${SUIT_LIB_DIR}:$ENV{LD_LIBRARY_PATH}")
+    SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS}:$ENV{PYTHONPATH}")
+  endif()
+
+  foreach(eachFilePath ${pyFiles})
+    # Strip the ".py" suffix
+    GET_FILENAME_COMPONENT(aTestName ${eachFilePath} NAME_WE)
+
+    # Add "SubprojectName_" prefix
+    GET_FILENAME_COMPONENT(aSubprojectName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+    SET(aTestName "${aSubprojectName}_${aTestName}")
+
+    # Full path to the python test file beeing executed
+    SET(aTestFilePath "${eachFilePath}")
+    IF(EXISTS ${aTestFilePath})
+      ADD_TEST(NAME ${aTestName}
+               COMMAND ${PYTHON_EXECUTABLE} ${aTestFilePath})
+      if (WIN32) # different path to libraries variable name
+        SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
+               ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH}"
+               LABELS "models_tests")
+      else()
+        SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
+               ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH}"
+               LABELS "models_tests")
+      endif()
+      # Debug output...
+      # MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFilePath}")
+    ELSE(EXISTS ${aTestFilePath})
+      MESSAGE(WARNING "Can not find the test file: ${aTestFilePath}")
+    ENDIF(EXISTS ${aTestFilePath})
+  endforeach(eachFilePath ${ARGN})
+
+  ADD_CUSTOM_TARGET(run_models_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -L "models_tests")
+ENDIF(ADD_MODELS_TESTS)
\ No newline at end of file
diff --git a/test.models/bobine_film_reel.py b/test.models/bobine_film_reel.py
new file mode 100644 (file)
index 0000000..bbd0dde
--- /dev/null
@@ -0,0 +1,114 @@
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "R", "40")
+model.addParameter(Part_1_doc, "h", "3")
+model.addParameter(Part_1_doc, "R2", "33.5")
+model.addParameter(Part_1_doc, "h2", "4")
+model.addParameter(Part_1_doc, "R3", "25.9")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 40)
+SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin"))
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchPoint_1.result())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R")
+SketchLine_1 = Sketch_1.addLine(0, 0, -20.88093073029438, 34.1172497695333)
+SketchLine_1.setAuxiliary(True)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1])
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "h", 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchLine_2 = SketchProjection_1.createdFeature()
+SketchCircle_2 = Sketch_2.addCircle(0, 0, 33.5)
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], "R2")
+SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_2.center())
+SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_14")
+model.do()
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), "h2", 0)
+Extrusion_3 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2*3", 0)
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_1"))
+SketchCircle_3 = Sketch_3.addCircle(0, 0, 28.25)
+SketchConstraintRadius_3 = Sketch_3.setRadius(SketchCircle_3.results()[1], 28.25)
+SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchLine_3 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchCircle_3.center(), SketchAPI_Line(SketchLine_3).startPoint())
+Extrusion_3.setNestedSketch(Sketch_3)
+Extrusion_4 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2", 0)
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_3_1/To_Face_1"))
+SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchLine_4 = SketchProjection_3.createdFeature()
+SketchCircle_4 = Sketch_4.addCircle(0, 0, 25.9)
+SketchConstraintRadius_4 = Sketch_4.setRadius(SketchCircle_4.results()[1], "R3")
+SketchConstraintCoincidence_7 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_4).startPoint(), SketchCircle_4.center())
+SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_15")
+Extrusion_4.setNestedSketch(Sketch_4)
+Extrusion_5 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2", 0)
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_4_1/To_Face_1"))
+SketchProjection_4 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchLine_5 = SketchProjection_4.createdFeature()
+SketchCircle_5 = Sketch_5.addCircle(0, 0, 8)
+SketchConstraintRadius_5 = Sketch_5.setRadius(SketchCircle_5.results()[1], 8)
+SketchConstraintCoincidence_8 = Sketch_5.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchCircle_5.center())
+SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_16")
+Extrusion_5.setNestedSketch(Sketch_5)
+Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1"), model.selection("SOLID", "Extrusion_5_1"), model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_3_1")], [])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection("FACE", "Extrusion_5_1/To_Face_1"), 0, model.selection(), 0, [model.selection("SOLID", "Boolean_1_1")])
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"))
+SketchCircle_6 = Sketch_6.addCircle(0, 0, 4.2)
+SketchConstraintRadius_6 = Sketch_6.setRadius(SketchCircle_6.results()[1], 4.2)
+SketchPoint_2 = Sketch_6.addPoint(model.selection("VERTEX", "PartSet/Origin"))
+SketchConstraintCoincidence_9 = Sketch_6.setCoincident(SketchPoint_2.coordinates(), SketchCircle_6.center())
+SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_17")
+ExtrusionCut_1.setNestedSketch(Sketch_6)
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"))
+SketchCircle_7 = Sketch_7.addCircle(0, -85, 66)
+SketchLine_6 = Sketch_7.addLine(model.selection("EDGE", "PartSet/OY"))
+SketchConstraintCoincidence_10 = Sketch_7.setCoincident(SketchCircle_7.center(), SketchLine_6.result())
+SketchConstraintRadius_7 = Sketch_7.setRadius(SketchCircle_7.results()[1], 66)
+SketchConstraintDistance_1 = Sketch_7.setDistance(SketchCircle_7.center(), SketchLine_6.startPoint(), 85)
+SketchMultiRotation_1 = Sketch_7.addRotation([SketchCircle_7.results()[1]], SketchLine_6.startPoint(), 120, 3)
+[SketchCircle_8, SketchCircle_9] = SketchMultiRotation_1.rotated()
+model.do()
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_2"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modfied_22"))
+SketchLine_7 = Sketch_8.addLine(-2.320957096353877e-016, 11.00000001704673, -7, 11.00000001704673)
+SketchConstraintHorizontal_1 = Sketch_8.setHorizontal(SketchLine_7.result())
+SketchLine_8 = Sketch_8.addLine(-7, 11.00000001704673, -6.329882773485103e-016, 30.00000001704673)
+SketchConstraintCoincidence_11 = Sketch_8.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchLine_9 = Sketch_8.addLine(model.selection("EDGE", "PartSet/OY"))
+SketchConstraintCoincidence_12 = Sketch_8.setCoincident(SketchLine_7.startPoint(), SketchLine_9.result())
+SketchConstraintCoincidence_13 = Sketch_8.setCoincident(SketchLine_8.endPoint(), SketchLine_9.result())
+SketchConstraintMirror_1 = Sketch_8.addMirror(SketchLine_9.result(), [SketchLine_7.result(), SketchLine_8.result()])
+[SketchLine_10, SketchLine_11] = SketchConstraintMirror_1.mirrored()
+SketchConstraintLength_1 = Sketch_8.setLength(SketchLine_7.result(), 7)
+SketchConstraintDistance_2 = Sketch_8.setDistance(SketchLine_9.startPoint(), SketchLine_7.result(), 11)
+SketchConstraintDistance_3 = Sketch_8.setDistance(SketchLine_8.endPoint(), SketchLine_9.startPoint(), 30)
+SketchMultiRotation_2_objects = [SketchLine_11.result(), SketchLine_10.result(), SketchLine_8.result(), SketchLine_7.result()]
+SketchMultiRotation_2 = Sketch_8.addRotation(SketchMultiRotation_2_objects, SketchLine_9.startPoint(), 120, 3)
+[SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_10, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19] = SketchMultiRotation_2.rotated()
+SketchLine_18.setName("SketchLine_15")
+SketchLine_18.result().setName("SketchLine_15")
+SketchLine_17.setName("SketchLine_18")
+SketchLine_17.result().setName("SketchLine_18")
+SketchLine_16.setName("SketchLine_14")
+SketchLine_16.result().setName("SketchLine_14")
+SketchLine_15.setName("SketchLine_17")
+SketchLine_15.result().setName("SketchLine_17")
+SketchLine_14.setName("SketchLine_13")
+SketchLine_14.result().setName("SketchLine_13")
+SketchLine_13.setName("SketchLine_16")
+SketchLine_13.result().setName("SketchLine_16")
+model.do()
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_7r-SketchLine_8r-SketchLine_10f-SketchLine_11f"), model.selection("FACE", "Sketch_8/Face-SketchLine_16f-SketchLine_17f-SketchLine_18r-SketchLine_19r"), model.selection("FACE", "Sketch_8/Face-SketchLine_12f-SketchLine_13f-SketchLine_14r-SketchLine_15r")], model.selection(), model.selection("FACE", "ExtrusionCut_2_1/Modfied_23"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+model.end()
+
+model.testNbResults(ExtrusionCut_3, 1)
+model.testNbSubResults(ExtrusionCut_3, [0])
+model.testResultsVolumes(ExtrusionCut_3, [34439.077343526856566313654184341])