]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge remote-tracking branch 'remotes/origin/2018_Lot1_Tasks'
authordbv <dbv@opencascade.com>
Mon, 18 Jun 2018 06:22:32 +0000 (09:22 +0300)
committerdbv <dbv@opencascade.com>
Mon, 18 Jun 2018 06:22:32 +0000 (09:22 +0300)
26 files changed:
CMakeCommon/FindPython.cmake
src/BuildPlugin/BuildPlugin_Filling.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp
src/Model/Model_Data.cpp
src/Model/Model_Document.cpp
src/ModelAPI/CMakeLists.txt
src/ModelAPI/ModelAPI_Tools.cpp
src/ModelAPI/ModelAPI_Tools.h
src/ModelAPI/Test/Test2496.py [new file with mode: 0644]
src/ModelAPI/Test/Test2510.py [new file with mode: 0644]
src/ModelHighAPI/CMakeLists.txt
src/ModelHighAPI/ModelHighAPI_Dumper.cpp
src/ModelHighAPI/ModelHighAPI_Dumper.h
src/ModelHighAPI/Test/Test2488.py [new file with mode: 0644]
src/ModuleBase/ModuleBase_ListView.cpp
src/ModuleBase/ModuleBase_ListView.h
src/ModuleBase/ModuleBase_Preferences.cpp
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/ParametersPlugin/ParametersPlugin_EvalListener.cpp
src/ParametersPlugin/ParametersPlugin_Parameter.cpp
src/PartSet/PartSet_ExternalPointsMgr.cpp
src/PartSet/PartSet_Module.cpp
src/SketcherPrs/SketcherPrs_PositionMgr.cpp
src/SketcherPrs/SketcherPrs_PositionMgr.h
src/XGUI/XGUI_DataModel.cpp
src/XGUI/XGUI_FacesPanel.cpp

index d48364e6797550c9b3aa2e5c7f2ebb3d2fbf4376..e48b6c206a10b729b18c512bde81b071b6368f0a 100644 (file)
@@ -13,15 +13,19 @@ ElSE()
     SET(PYTHON_LIBRARY_FILE "libpython2.7.so")
 ENDIF()
 
-IF(WIN32)
-  FILE(TO_CMAKE_PATH "$ENV{PYTHONHOME}/libs/${PYTHON_LIBRARY_FILE}" PATH_PYTHON_LIBRARY)
-ElSE()
-  FILE(TO_CMAKE_PATH "$ENV{PYTHONHOME}/lib/${PYTHON_LIBRARY_FILE}" PATH_PYTHON_LIBRARY)
+IF($ENV{PYTHONHOME})
+  IF(WIN32)
+    FILE(TO_CMAKE_PATH "$ENV{PYTHONHOME}/libs/${PYTHON_LIBRARY_FILE}" PATH_PYTHON_LIBRARY)
+  ElSE()
+    FILE(TO_CMAKE_PATH "$ENV{PYTHONHOME}/lib/${PYTHON_LIBRARY_FILE}" PATH_PYTHON_LIBRARY)
+  ENDIF()
+  SET(PYTHON_LIBRARY ${PATH_PYTHON_LIBRARY} CACHE FILEPATH "path to the python library" FORCE)
 ENDIF()
-FILE(TO_CMAKE_PATH $ENV{PYTHON_INCLUDE} PATH_PYTHON_INCLUDE_DIR)
 
-SET(PYTHON_INCLUDE_DIR ${PATH_PYTHON_INCLUDE_DIR} CACHE PATH "path to where Python.h is found" FORCE)
-SET(PYTHON_LIBRARY ${PATH_PYTHON_LIBRARY} CACHE FILEPATH "path to the python library" FORCE)
+IF($ENV{PYTHON_INCLUDE})
+  FILE(TO_CMAKE_PATH $ENV{PYTHON_INCLUDE} PATH_PYTHON_INCLUDE_DIR)
+  SET(PYTHON_INCLUDE_DIR ${PATH_PYTHON_INCLUDE_DIR} CACHE PATH "path to where Python.h is found" FORCE)
+ENDIF()
 
 FIND_PACKAGE(PythonLibs REQUIRED)
 FIND_PACKAGE(PythonInterp REQUIRED)
index 7e2c884ced1522ec4055a6248901b5cd83984dc0..4aff9c942bdca78ac2c1f54fc59be893f3fc0845 100644 (file)
@@ -137,7 +137,12 @@ bool BuildPlugin_Filling::isAlgorithmFailed(
 {
   if (!theAlgorithm->isDone()) {
     static const std::string aFeatureError = "Error: filling algorithm failed.";
-    setError(aFeatureError);
+    std::string anAlgoError = theAlgorithm->getError();
+    if (anAlgoError.empty())
+      anAlgoError = aFeatureError;
+    else
+      anAlgoError = aFeatureError + " " + anAlgoError;
+    setError(anAlgoError);
     return true;
   }
   if (theAlgorithm->shape()->isNull()) {
index 0dc3861f5af0ea5185352ed099e0bfb53d9a87a8..f08f44a4f7b8dcfb877394bd6510ef3e03ae8aff 100644 (file)
@@ -101,14 +101,18 @@ void GeomAlgoAPI_Filling::buildByEdges()
   Handle(GeomFill_Line) aLine = new GeomFill_Line(aNbCurves);
 
   // check myMaxDegree >= aCurves.size() - 1 to be able to interpolate a surface
-  if (myMaxDegree + 1 < aNbCurves)
+  if (myMaxDegree + 1 < aNbCurves) {
+    myError = "Unable to interpolate surface, Max deg + 1 should be greater or equal than number of sections.";
     return;
+  }
 
   // perform filling by sections
   GeomFill_AppSurf anAppSurf(myMinDegree, myMaxDegree, myTol3D, myTol2D, myNbIter);
   anAppSurf.Perform(aLine, aSection);
-  if (!anAppSurf.IsDone())
+  if (!anAppSurf.IsDone()) {
+    myError = "Approximation algorithm failed.";
     return;
+  }
 
   // build calculated surface
   Standard_Integer UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots;
index a3f193f56ed7bf050ec962e58eefa69091bab685..a863d55dd6a961c44a7277cd50ca3923c512b15f 100644 (file)
@@ -133,8 +133,19 @@ void Model_Data::setName(const std::string& theName)
     isModified = !aName->Get().IsEqual(theName.c_str());
     if (isModified) {
       aName->Set(theName.c_str());
-      // name is changed, thus special attribute is set
-      TDataStd_UAttribute::Set(myLab, kUSER_DEFINED_NAME);
+
+      // check the name of result is defined by user
+      // (name of result does not composed of the name of feature and the result index)
+      bool isUserDefined = true;
+      ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
+      if (aResult) {
+        std::string aDefaultName = ModelAPI_Tools::getDefaultName(aResult);
+        isUserDefined = aDefaultName != theName;
+      }
+      if (isUserDefined) {
+        // name is user-defined, thus special attribute is set
+        TDataStd_UAttribute::Set(myLab, kUSER_DEFINED_NAME);
+      }
     }
   }
   if (mySendAttributeUpdated && isModified)
index cd276ffff11b663155369c994233ef047441f50c..ae27c2af263a9105cc5e04dfca96e5f0b7994a5c 100755 (executable)
@@ -1412,35 +1412,40 @@ TDF_Label Model_Document::findNamingName(std::string theName, ResultPtr theConte
           if (theContext != myObjs->object(aLabIter->Father()))
             continue;
         }
+        // copy aSubName to avoid incorrect further processing after its suffix cutting
+        TCollection_ExtendedString aSubNameCopy(aSubName);
         // searching sub-labels with this name
         TDF_ChildIDIterator aNamesIter(*aLabIter, TDataStd_Name::GetID(), Standard_True);
         for(; aNamesIter.More(); aNamesIter.Next()) {
           Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(aNamesIter.Value());
-          if (aName->Get() == aSubName)
+          if (aName->Get() == aSubNameCopy)
             return aName->Label();
         }
         // If not found child label with the exact sub-name, then try to find compound with
         // such sub-name without suffix.
-        Standard_Integer aSuffixPos = aSubName.SearchFromEnd('_');
-        if (aSuffixPos != -1 && aSuffixPos != aSubName.Length()) {
-          TCollection_ExtendedString anIndexStr = aSubName.Split(aSuffixPos);
-          aSubName.Remove(aSuffixPos);
+        Standard_Integer aSuffixPos = aSubNameCopy.SearchFromEnd('_');
+        if (aSuffixPos != -1 && aSuffixPos != aSubNameCopy.Length()) {
+          TCollection_ExtendedString anIndexStr = aSubNameCopy.Split(aSuffixPos);
+          aSubNameCopy.Remove(aSuffixPos);
           aNamesIter.Initialize(*aLabIter, TDataStd_Name::GetID(), Standard_True);
           for(; aNamesIter.More(); aNamesIter.Next()) {
             Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(aNamesIter.Value());
-            if (aName->Get() == aSubName) {
+            if (aName->Get() == aSubNameCopy) {
               return aName->Label();
             }
           }
           // check also "this" label
           Handle(TDataStd_Name) aName;
           if (aLabIter->FindAttribute(TDataStd_Name::GetID(), aName)) {
-            if (aName->Get() == aSubName) {
+            if (aName->Get() == aSubNameCopy) {
               return aName->Label();
             }
           }
         }
       }
+      // verify context's name is same as sub-component's and use context's label
+      if (aSubName.IsEqual(anObjName.c_str()))
+        return *(aFind->second.rbegin());
     }
   }
   return TDF_Label(); // not found
index d1633aa42bcd5dd87d642cd3c2d184f3f1de1b58..fbcb4a777d82158507d8a7c255f368f86522c4ae 100644 (file)
@@ -201,4 +201,6 @@ ADD_UNIT_TESTS(TestConstants.py
                Test2396.py
                Test2401.py
                Test2413.py
+               Test2496.py
+               Test2510.py
 )
index 94699455931d940d5a77df7ee257cc12f4187b3f..e62b6aefcb24119670232560ee1a86eab6d073f6 100755 (executable)
@@ -733,4 +733,43 @@ std::pair<std::string, bool> getDefaultName(
   return std::pair<std::string, bool>(aDefaultName.str(), false);
 }
 
+std::string getDefaultName(const ResultPtr& theResult)
+{
+  FeaturePtr anOwner = ModelAPI_Feature::feature(theResult->data()->owner());
+
+  // names of sub-solids in CompSolid should be default (for example,
+  // result of boolean operation 'Boolean_1_1' is a CompSolid which is renamed to 'MyBOOL',
+  // however, sub-elements of 'MyBOOL' should be named 'Boolean_1_1_1', 'Boolean_1_1_2' etc.)
+  std::ostringstream aDefaultName;
+  aDefaultName << anOwner->name();
+
+  ResultPtr aResToSearch = theResult;
+  ResultCompSolidPtr aCompSolidRes = compSolidOwner(theResult);
+  if (aCompSolidRes)
+    aResToSearch = aCompSolidRes;
+
+  // obtain index of result
+  int aResIndex = 1;
+  const std::list<ResultPtr>& aResults = anOwner->results();
+  for (std::list<ResultPtr>::const_iterator anIt = aResults.begin();
+       anIt != aResults.end(); ++anIt, ++aResIndex)
+    if (aResToSearch == *anIt)
+      break;
+
+  // compute default name of CompSolid (name of feature + index of CompSolid's result)
+  aDefaultName << "_" << aResIndex;
+
+  if (aCompSolidRes) {
+    // obtain index of result in compsolid and compose a default name
+    int aNbSubs = aCompSolidRes->numberOfSubs();
+    for (int anIndex = 0; anIndex < aNbSubs; ++anIndex)
+      if (aCompSolidRes->subResult(anIndex) == theResult) {
+        aDefaultName << "_" << (anIndex + 1);
+        break;
+      }
+  }
+
+  return aDefaultName.str();
+}
+
 } // namespace ModelAPI_Tools
index e7c297b30840755b4e7fb3692acb853ec69c70f5..907cc7b974a9df0f996c51c699a4024566878418 100755 (executable)
@@ -187,13 +187,17 @@ MODELAPI_EXPORT void findRefsToFeatures(
 MODELAPI_EXPORT void getConcealedResults(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                    std::list<std::shared_ptr<ModelAPI_Result> >& theResults);
 
-/*! Return the default name of the result according the the features it depends.
+/*! Return the default name of the result according the features it depends.
  *  Return also whether the name is get from the concealing result of parent object
  *  (means that concealing result has user-defined name).
  */
 MODELAPI_EXPORT std::pair<std::string, bool> getDefaultName(
     const std::shared_ptr<ModelAPI_Result>& theResult,
     const int theResultIndex);
+
+/*! Return the default name of the result according to name of the feature.
+ */
+MODELAPI_EXPORT std::string getDefaultName(const std::shared_ptr<ModelAPI_Result>& theResult);
 }
 
 #endif
diff --git a/src/ModelAPI/Test/Test2496.py b/src/ModelAPI/Test/Test2496.py
new file mode 100644 (file)
index 0000000..9fefd08
--- /dev/null
@@ -0,0 +1,54 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+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(85, -50, -60, -50)
+SketchLine_2 = Sketch_1.addLine(-60, -50, -60, 45)
+SketchLine_3 = Sketch_1.addLine(-60, 45, 85, 45)
+SketchLine_4 = Sketch_1.addLine(85, 45, 85, -50)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"))
+SketchCircle_1 = Sketch_2.addCircle(0, -10, 25)
+model.do()
+Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")])
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Face_2_1/Face_2_1"), model.selection("FACE", "Partition_1_1_1")])
+model.do()
+
+assert(Group_1.feature().error() == "")
+
+model.end()
+
+assert(model.checkPythonDump())
diff --git a/src/ModelAPI/Test/Test2510.py b/src/ModelAPI/Test/Test2510.py
new file mode 100644 (file)
index 0000000..d1b5bc3
--- /dev/null
@@ -0,0 +1,341 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from SketchAPI import *
+
+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("XOZ"))
+SketchLine_1 = Sketch_1.addLine(1.31, 2.37, 1.31, 0)
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result())
+SketchLine_2 = Sketch_1.addLine(1.29, 2.37, 1.29, 0)
+SketchLine_3 = Sketch_1.addLine(1.29, 2.37, 1.31, 2.37)
+SketchLine_3.setAuxiliary(True)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchArc_1 = Sketch_1.addArc(2.429999974807509, 2.369762445228637, 1.32, 2.475237825900849, 2.499428733897898, 3.48259875277915, True)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 1.115)
+SketchLine_4 = Sketch_1.addLine(1.31, 2.37, 1.32, 2.475237825900849)
+SketchLine_4.setName("SketchLine_5")
+SketchLine_4.result().setName("SketchLine_5")
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.endPoint())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_2.result())
+SketchPoint_1 = Sketch_1.addPoint(1.29, 0)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_2.result())
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_5 = SketchProjection_1.createdFeature()
+SketchLine_5.setName("SketchLine_6")
+SketchLine_5.result().setName("SketchLine_6")
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_5.result())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_6 = SketchProjection_2.createdFeature()
+SketchLine_6.setName("SketchLine_7")
+SketchLine_6.result().setName("SketchLine_7")
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_6.result(), 1.29, True)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 0.02)
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_1.startPoint(), SketchLine_4.endPoint(), 0.01)
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_4.result())
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchArc_1.center(), 1.12, True)
+SketchLine_7 = Sketch_1.addLine(2.499428733897898, 3.48259875277915, 2.429999974807509, 2.369762445228637)
+SketchLine_7.setName("SketchLine_8")
+SketchLine_7.result().setName("SketchLine_8")
+SketchLine_7.setAuxiliary(True)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_7.endPoint())
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_7.result(), SketchLine_3.result(), 93.56999999999999)
+SketchArc_2 = Sketch_1.addArc(2.349985665002739, 1.087256027998574, 2.499428733897898, 3.48259875277915, 3.77688682869805, 3.017010693505298, True)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint())
+SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1])
+SketchArc_3 = Sketch_1.addArc(1.546759218272587, 0.0009649642070809712, 3.77688682869805, 3.017010693505298, 4.166514953924199, 2.685528408329715, True)
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint())
+SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1])
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_3.results()[1], 3.751)
+SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_2.results()[1], 2.4)
+SketchLine_8 = Sketch_1.addLine(2.349985665002739, 1.087256027998574, 3.77688682869805, 3.017010693505298)
+SketchLine_8.setName("SketchLine_9")
+SketchLine_8.result().setName("SketchLine_9")
+SketchLine_8.setAuxiliary(True)
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_8.endPoint())
+SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_8.result(), SketchLine_7.result(), 32.91)
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchArc_2.center())
+SketchLine_9 = Sketch_1.addLine(1.546759218272496, 0.000964964207000808, 4.166514953924199, 2.685528408329715)
+SketchLine_9.setName("SketchLine_10")
+SketchLine_9.result().setName("SketchLine_10")
+SketchLine_9.setAuxiliary(True)
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_9.endPoint())
+SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_8.result(), 7.82)
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchArc_3.center())
+SketchLine_10 = Sketch_1.addLine(4.166514953924199, 2.685528408329715, 4.411514953924289, 2.446442922550623)
+SketchLine_10.setName("SketchLine_11")
+SketchLine_10.result().setName("SketchLine_11")
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_10.startPoint())
+SketchArc_4 = Sketch_1.addArc(3.489606777155361, 1.501728514028915, 4.411514953924289, 2.446442922550623, 4.534275383417573, 2.308616054576027, True)
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_4.startPoint())
+SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_10.result(), SketchArc_4.results()[1])
+SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchArc_3.endPoint(), SketchArc_4.startPoint(), 0.245)
+SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_10.result())
+SketchLine_11 = Sketch_1.addLine(3.489606777155361, 1.501728514028915, 4.411514953924289, 2.446442922550623)
+SketchLine_11.setName("SketchLine_12")
+SketchLine_11.result().setName("SketchLine_12")
+SketchLine_11.setAuxiliary(True)
+SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.endPoint())
+SketchLine_12 = Sketch_1.addLine(3.489606777155361, 1.501728514028915, 4.534275383417573, 2.308616054576027)
+SketchLine_12.setName("SketchLine_13")
+SketchLine_12.result().setName("SketchLine_13")
+SketchLine_12.setAuxiliary(True)
+SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_12.endPoint())
+SketchConstraintAngle_4 = Sketch_1.setAngleBackward(SketchLine_11.result(), SketchLine_12.result(), 8.018000000000001)
+SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_4.results()[1], 1.32)
+SketchArc_5 = Sketch_1.addArc(1.545335047953034, 0, 4.534275383417573, 2.308616054576027, 3.791202568545627, -3.03637143583555, True)
+SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_5.startPoint())
+SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_5.results()[1])
+SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_5.center(), SketchLine_5.result())
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.result(), "4.74/2", True)
+SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.result())
+SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.result())
+SketchArc_6 = Sketch_1.addArc(2.43, 2.369999999999995, 1.29, 2.37, 2.429999974807022, 3.510000000000007, True)
+SketchArc_6.setName("SketchArc_11")
+SketchArc_6.result().setName("SketchArc_11")
+SketchArc_6.results()[1].setName("SketchArc_11_2")
+SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_6.startPoint())
+SketchConstraintTangent_7 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_6.results()[1])
+SketchArc_7 = Sketch_1.addArc(2.430000026076943, 1.189999999999999, 2.429999974807022, 3.510000000000007, 3.806722385037566, 3.05736058283826, True)
+SketchArc_7.setName("SketchArc_12")
+SketchArc_7.result().setName("SketchArc_12")
+SketchArc_7.results()[1].setName("SketchArc_12_2")
+SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchArc_7.startPoint())
+SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_6.results()[1], SketchArc_7.results()[1])
+SketchConstraintRadius_5 = Sketch_1.setRadius(SketchArc_6.results()[1], 1.14)
+SketchLine_13 = Sketch_1.addLine(2.429999974807509, 2.369762445228637, 2.429999974807022, 3.510000000000007)
+SketchLine_13.setName("SketchLine_17")
+SketchLine_13.result().setName("SketchLine_17")
+SketchLine_13.setAuxiliary(True)
+SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_13.endPoint())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_13.result())
+SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_7.results()[1], 2.32)
+SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchLine_8.result())
+SketchArc_8 = Sketch_1.addArc(1.552665663222913, 0, 3.806722385037566, 3.05736058283826, 5.35111606287941, 0, True)
+SketchArc_8.setName("SketchArc_13")
+SketchArc_8.result().setName("SketchArc_13")
+SketchArc_8.results()[1].setName("SketchArc_13_2")
+SketchConstraintMirror_1_objects = [SketchLine_2.result(), SketchLine_1.result(), SketchLine_4.result(), SketchArc_6.results()[1], SketchArc_7.results()[1], SketchArc_8.results()[1], SketchLine_13.result(), SketchLine_8.result()]
+SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_5.result(), SketchConstraintMirror_1_objects)
+[SketchLine_14, SketchLine_15, SketchLine_16, SketchArc_9, SketchArc_10, SketchArc_11, SketchLine_17, SketchLine_18] = SketchConstraintMirror_1.mirrored()
+SketchLine_18.setName("SketchLine_19")
+SketchLine_18.result().setName("SketchLine_19")
+SketchLine_17.setName("SketchLine_18")
+SketchLine_17.result().setName("SketchLine_18")
+SketchArc_11.setName("SketchArc_14")
+SketchArc_11.result().setName("SketchArc_14")
+SketchArc_11.results()[1].setName("SketchArc_14_2")
+SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchArc_8.startPoint())
+SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_7.results()[1], SketchArc_8.results()[1])
+SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_5.result(), SketchArc_8.endPoint())
+SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_8.center(), SketchLine_5.result())
+SketchArc_12 = Sketch_1.addArc(2.429999974807509, -2.369762445228637, 1.32, -2.475237825900849, 2.429999974807509, -3.484762445228914, False)
+SketchArc_12.setName("SketchArc_15")
+SketchArc_12.result().setName("SketchArc_15")
+SketchArc_12.results()[1].setName("SketchArc_15_2")
+SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_12.center())
+SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_16).endPoint(), SketchArc_12.startPoint())
+SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_17.result(), SketchArc_12.endPoint())
+SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_18.result())
+SketchArc_13 = Sketch_1.addArc(2.430961195591607, -1.197350205596287, 3.791202568545627, -3.03637143583555, 2.429999974807033, -3.484762445228914, True)
+SketchArc_13.setName("SketchArc_16")
+SketchArc_13.result().setName("SketchArc_16")
+SketchArc_13.results()[1].setName("SketchArc_16_2")
+SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchArc_13.startPoint())
+SketchConstraintTangent_10 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchArc_13.results()[1])
+SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_13.endPoint(), SketchArc_12.endPoint())
+SketchLine_19 = Sketch_1.addLine(1.125, 0, 1.125, 2.370000000000003)
+SketchLine_19.setName("SketchLine_20")
+SketchLine_19.result().setName("SketchLine_20")
+SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_19.startPoint(), SketchLine_5.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_19.result())
+SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_3.result())
+SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_19.endPoint(), SketchLine_2.result(), 0.165, True)
+SketchArc_14 = Sketch_1.addArc(2.43, 2.369999999999994, 1.125, 2.370000000000003, 2.429999974807022, 3.674999999999994, True)
+SketchArc_14.setName("SketchArc_17")
+SketchArc_14.result().setName("SketchArc_17")
+SketchArc_14.results()[1].setName("SketchArc_17_2")
+SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchArc_14.startPoint())
+SketchConstraintTangent_11 = Sketch_1.setTangent(SketchLine_19.result(), SketchArc_14.results()[1])
+SketchArc_15 = Sketch_1.addArc(2.43000002278185, 1.189896770657599, 2.429999974807022, 3.674999999999994, 3.904833906055851, 3.190047534283911, True)
+SketchArc_15.setName("SketchArc_18")
+SketchArc_15.result().setName("SketchArc_18")
+SketchArc_15.results()[1].setName("SketchArc_18_2")
+SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchArc_15.startPoint())
+SketchConstraintTangent_12 = Sketch_1.setTangent(SketchArc_14.results()[1], SketchArc_15.results()[1])
+SketchArc_16 = Sketch_1.addArc(1.552616124088898, 0, 3.904833906055851, 3.190047534283911, 5.51611606287941, 0, True)
+SketchArc_16.setName("SketchArc_19")
+SketchArc_16.result().setName("SketchArc_19")
+SketchArc_16.results()[1].setName("SketchArc_19_2")
+SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchArc_16.startPoint())
+SketchConstraintTangent_13 = Sketch_1.setTangent(SketchArc_15.results()[1], SketchArc_16.results()[1])
+SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_5.result(), SketchArc_16.endPoint())
+SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_13.result())
+SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchArc_14.center(), SketchArc_6.center())
+SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchArc_16.center(), SketchLine_5.result())
+SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchArc_16.startPoint(), SketchLine_8.result())
+SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Arc(SketchArc_11).endPoint(), SketchArc_16.endPoint(), 0.165, True)
+SketchLine_20 = Sketch_1.addLine(1.05, 0, 1.05, 2.199861545438666)
+SketchLine_20.setName("SketchLine_22")
+SketchLine_20.result().setName("SketchLine_22")
+SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_20.startPoint(), SketchLine_5.result())
+SketchLine_21 = Sketch_1.addLine(1.05, 2.199861545438666, 1.08, 2.370000000000011)
+SketchLine_21.setName("SketchLine_23")
+SketchLine_21.result().setName("SketchLine_23")
+SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
+SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_3.result())
+SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_20.result())
+SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_21.endPoint(), SketchLine_20.result(), 0.03, True)
+SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_20.result(), SketchLine_21.result(), 170)
+SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_21.endPoint(), SketchLine_19.result(), 0.045, True)
+SketchArc_17 = Sketch_1.addArc(2.429999974807022, 2.369762445224826, 1.08, 2.370000000000011, 2.429999974807022, 3.719762440932702, True)
+SketchArc_17.setName("SketchArc_23")
+SketchArc_17.result().setName("SketchArc_23")
+SketchArc_17.results()[1].setName("SketchArc_23_2")
+SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchArc_17.startPoint())
+SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchArc_17.center(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_54 = Sketch_1.setCoincident(SketchArc_17.endPoint(), SketchLine_13.result())
+SketchArc_18 = Sketch_1.addArc(2.43000002278185, 1.189896770657599, 2.429999974807022, 3.719762440932702, 3.93144708721947, 3.226039452870244, True)
+SketchArc_18.setName("SketchArc_24")
+SketchArc_18.result().setName("SketchArc_24")
+SketchArc_18.results()[1].setName("SketchArc_24_2")
+SketchConstraintCoincidence_55 = Sketch_1.setCoincident(SketchArc_15.center(), SketchArc_18.center())
+SketchConstraintCoincidence_56 = Sketch_1.setCoincident(SketchArc_17.endPoint(), SketchArc_18.startPoint())
+SketchConstraintCoincidence_57 = Sketch_1.setCoincident(SketchArc_18.endPoint(), SketchLine_8.result())
+SketchArc_19 = Sketch_1.addArc(1.552616124088887, 0, 3.93144708721947, 3.226039452870244, 5.560878503552593, 0, True)
+SketchArc_19.setName("SketchArc_25")
+SketchArc_19.result().setName("SketchArc_25")
+SketchArc_19.results()[1].setName("SketchArc_25_2")
+SketchConstraintMirror_2_objects = [SketchLine_19.result(), SketchArc_14.results()[1], SketchArc_15.results()[1], SketchArc_16.results()[1], SketchLine_20.result(), SketchArc_19.results()[1], SketchArc_17.results()[1], SketchLine_21.result(), SketchArc_18.results()[1]]
+SketchConstraintMirror_2 = Sketch_1.addMirror(SketchLine_5.result(), SketchConstraintMirror_2_objects)
+[SketchLine_22, SketchArc_20, SketchArc_21, SketchArc_22, SketchLine_23, SketchArc_23, SketchArc_24, SketchLine_24, SketchArc_25] = SketchConstraintMirror_2.mirrored()
+SketchArc_25.setName("SketchArc_28")
+SketchArc_25.result().setName("SketchArc_28")
+SketchArc_25.results()[1].setName("SketchArc_28_2")
+SketchLine_24.setName("SketchLine_25")
+SketchLine_24.result().setName("SketchLine_25")
+SketchArc_24.setName("SketchArc_27")
+SketchArc_24.result().setName("SketchArc_27")
+SketchArc_24.results()[1].setName("SketchArc_27_2")
+SketchArc_23.setName("SketchArc_26")
+SketchArc_23.result().setName("SketchArc_26")
+SketchArc_23.results()[1].setName("SketchArc_26_2")
+SketchLine_23.setName("SketchLine_24")
+SketchLine_23.result().setName("SketchLine_24")
+SketchLine_22.setName("SketchLine_21")
+SketchLine_22.result().setName("SketchLine_21")
+SketchConstraintCoincidence_58 = Sketch_1.setCoincident(SketchArc_18.endPoint(), SketchArc_19.startPoint())
+SketchConstraintCoincidence_59 = Sketch_1.setCoincident(SketchArc_19.endPoint(), SketchLine_5.result())
+SketchConstraintCoincidence_60 = Sketch_1.setCoincident(SketchArc_19.center(), SketchLine_5.result())
+SketchConstraintCoincidence_61 = Sketch_1.setCoincident(SketchArc_19.center(), SketchArc_16.center())
+SketchLine_25 = Sketch_1.addLine(2.429999974807022, -3.509999999999994, 2.429999974807022, -3.674999999999994)
+SketchLine_25.setName("SketchLine_26")
+SketchLine_25.result().setName("SketchLine_26")
+SketchConstraintCoincidence_62 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_9).endPoint(), SketchLine_25.startPoint())
+SketchConstraintCoincidence_63 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_20).endPoint(), SketchLine_25.endPoint())
+SketchLine_26 = Sketch_1.addLine(2.429999974807022, 3.510000000000007, 2.429999974807022, 3.674999999999994)
+SketchLine_26.setName("SketchLine_27")
+SketchLine_26.result().setName("SketchLine_27")
+SketchConstraintCoincidence_64 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_26.startPoint())
+SketchConstraintCoincidence_65 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_26.endPoint())
+SketchLine_27 = Sketch_1.addLine(2.429999974807022, 3.719762440932702, 2.429999974807022, 3.674999999999994)
+SketchLine_27.setName("SketchLine_28")
+SketchLine_27.result().setName("SketchLine_28")
+SketchConstraintCoincidence_66 = Sketch_1.setCoincident(SketchArc_17.endPoint(), SketchLine_27.startPoint())
+SketchConstraintCoincidence_67 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_27.endPoint())
+SketchLine_28 = Sketch_1.addLine(2.429999974807022, 3.510000000000032, 2.429999974807022, 3.484762445224835)
+SketchLine_28.setName("SketchLine_29")
+SketchLine_28.result().setName("SketchLine_29")
+SketchConstraintCoincidence_68 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_28.startPoint())
+SketchConstraintCoincidence_69 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchArc_1.results()[1])
+SketchConstraintCoincidence_70 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_13.result())
+SketchLine_29 = Sketch_1.addLine(2.429999974807022, -3.509999999999994, 2.429999974807033, -3.484762445228914)
+SketchLine_29.setName("SketchLine_30")
+SketchLine_29.result().setName("SketchLine_30")
+SketchConstraintCoincidence_71 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_9).endPoint(), SketchLine_29.startPoint())
+SketchConstraintCoincidence_72 = Sketch_1.setCoincident(SketchArc_12.endPoint(), SketchLine_29.endPoint())
+SketchLine_30 = Sketch_1.addLine(2.429999974807022, -3.674999999999994, 2.429999974807022, -3.71976244093269)
+SketchLine_30.setName("SketchLine_31")
+SketchLine_30.result().setName("SketchLine_31")
+SketchConstraintCoincidence_73 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_20).endPoint(), SketchLine_30.startPoint())
+SketchConstraintCoincidence_74 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_24).endPoint(), SketchLine_30.endPoint())
+SketchLine_31 = Sketch_1.addLine(2.429999974807509, 2.369762445228637, 1.871489087529827, 3.334796428456965)
+SketchLine_31.setName("SketchLine_32")
+SketchLine_31.result().setName("SketchLine_32")
+SketchLine_31.setAuxiliary(True)
+SketchConstraintCoincidence_75 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_31.startPoint())
+SketchConstraintCoincidence_76 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchArc_1.results()[1])
+SketchConstraintAngle_6 = Sketch_1.setAngle(SketchLine_31.result(), SketchLine_3.result(), 59.94)
+SketchLine_32 = Sketch_1.addLine(1.871489087529827, 3.334796428456965, 1.871489087529827, 3.598813126524882)
+SketchLine_32.setName("SketchLine_33")
+SketchLine_32.result().setName("SketchLine_33")
+SketchConstraintCoincidence_77 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint())
+SketchConstraintCoincidence_78 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchArc_17.results()[1])
+SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_32.result())
+SketchLine_33 = Sketch_1.addLine(1.871489087529829, -3.334796428460793, 1.871489087529829, -3.598813126524861)
+SketchLine_33.setName("SketchLine_34")
+SketchLine_33.result().setName("SketchLine_34")
+SketchConstraintCoincidence_79 = Sketch_1.setCoincident(SketchLine_33.startPoint(), SketchArc_12.results()[1])
+SketchConstraintCoincidence_80 = Sketch_1.setCoincident(SketchLine_33.endPoint(), SketchArc_24.results()[1])
+SketchConstraintCoincidence_81 = Sketch_1.setCoincident(SketchLine_33.startPoint(), SketchLine_32.result())
+SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_33.result())
+model.do()
+Extrusion_1_objects = [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2f-SketchArc_1_2r-SketchLine_5f-SketchArc_11_2f-SketchLine_14r-SketchLine_15f-SketchLine_16r-SketchArc_9_2f-SketchArc_15_2r-SketchLine_33f-SketchLine_34r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_12_2f-SketchArc_13_2f-SketchArc_10_2f-SketchArc_14_2f-SketchArc_16_2r-SketchLine_29f-SketchLine_30r"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_20f-SketchArc_17_2r-SketchLine_21r-SketchArc_20_2r-SketchLine_22r-SketchLine_23r-SketchArc_23_2f-SketchLine_24f-SketchArc_27_2f-SketchLine_25f-SketchLine_33f-SketchLine_34r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_18_2r-SketchArc_19_2r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_24_2f-SketchArc_25_2f-SketchArc_26_2f-SketchArc_28_2f-SketchLine_28f-SketchLine_31f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_17_2r-SketchArc_23_2f-SketchLine_28r-SketchLine_33r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_11_2f-SketchLine_29r-SketchLine_33r"), model.selection("FACE", "Sketch_1/Face-SketchArc_9_2f-SketchArc_15_2r-SketchLine_30f-SketchLine_34f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_20_2r-SketchArc_27_2f-SketchLine_31r-SketchLine_34f")]
+Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 0.1785, 0.1785)
+Extrusion_2_objects = [model.selection("WIRE", "Sketch_1/Wire-SketchArc_12_2r-SketchArc_13_2r-SketchArc_10_2r-SketchArc_14_2r-SketchArc_18_2f-SketchArc_19_2f-SketchArc_21_2f-SketchArc_22_2f-SketchLine_26f-SketchLine_27r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_12_2f-SketchArc_13_2f-SketchArc_10_2f-SketchArc_14_2f-SketchArc_16_2r-SketchLine_29f-SketchLine_30r"), model.selection("FACE", "Sketch_1/Face-SketchArc_18_2r-SketchArc_19_2r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_24_2f-SketchArc_25_2f-SketchArc_26_2f-SketchArc_28_2f-SketchLine_28f-SketchLine_31f")]
+Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), model.selection("FACE", "Extrusion_1_2/From_Face_2"), -0.05, model.selection("FACE", "Extrusion_1_2/From_Face_2"), 0)
+Extrusion_3_objects = [model.selection("FACE", "Sketch_1/Face-SketchArc_12_2r-SketchArc_13_2r-SketchArc_10_2r-SketchArc_14_2r-SketchArc_18_2f-SketchArc_19_2f-SketchArc_21_2f-SketchArc_22_2f-SketchLine_26f-SketchLine_27r"), model.selection("FACE", "Sketch_1/Face-SketchArc_18_2r-SketchArc_19_2r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_24_2f-SketchArc_25_2f-SketchArc_26_2f-SketchArc_28_2f-SketchLine_28f-SketchLine_31f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_12_2f-SketchArc_13_2f-SketchArc_10_2f-SketchArc_14_2f-SketchArc_16_2r-SketchLine_29f-SketchLine_30r")]
+Extrusion_3 = model.addExtrusion(Part_1_doc, Extrusion_3_objects, model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_1"), 0.05, model.selection("FACE", "Extrusion_1_2/To_Face_1"), 0)
+Extrusion_4_objects = [model.selection("FACE", "Sketch_1/Face-SketchArc_17_2r-SketchArc_23_2f-SketchLine_28r-SketchLine_33r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_11_2f-SketchLine_29r-SketchLine_33r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_11_2r-SketchArc_17_2f-SketchLine_27f-SketchLine_33r"), model.selection("FACE", "Sketch_1/Face-SketchArc_20_2r-SketchArc_27_2f-SketchLine_31r-SketchLine_34f"), model.selection("FACE", "Sketch_1/Face-SketchArc_9_2r-SketchArc_20_2f-SketchLine_26r-SketchLine_34f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_9_2f-SketchArc_15_2r-SketchLine_30f-SketchLine_34f")]
+Extrusion_4 = model.addExtrusion(Part_1_doc, Extrusion_4_objects, model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_2"), 0.15, model.selection("FACE", "Extrusion_1_1/To_Face_2"), 0)
+Extrusion_4.setName("Extrusion_6")
+Extrusion_4.result().setName("Extrusion_6_1")
+Extrusion_4.result().subResult(0).setName("Extrusion_6_1_1")
+Extrusion_4.result().subResult(1).setName("Extrusion_6_1_2")
+Extrusion_4.result().subResult(2).setName("Extrusion_6_1_3")
+Extrusion_4.results()[1].setName("Extrusion_6_2")
+Extrusion_4.results()[1].subResult(0).setName("Extrusion_6_2_1")
+Extrusion_4.results()[1].subResult(1).setName("Extrusion_6_2_2")
+Extrusion_4.results()[1].subResult(2).setName("Extrusion_6_2_3")
+Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Extrusion_3_1/To_Face_3&Extrusion_3_1/Generated_Face_10&Extrusion_3_1/Generated_Face_11"), model.selection("VERTEX", "Extrusion_6_1/To_Face_1&Extrusion_6_1/Generated_Face_9&Extrusion_6_1/Generated_Face_8"))
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Extrusion_6_1/Generated_Face_3&Extrusion_6_1/To_Face_3&Extrusion_6_1/Generated_Face_4"), False)
+Partition_1_objects = [model.selection("COMPSOLID", "Extrusion_6_1"), model.selection("FACE", "Plane_1"), model.selection("COMPSOLID", "Extrusion_6_2")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+model.do()
+
+# check names of partition results
+assert(Partition_1.name() + "_1" == Partition_1.result().name())
+assert(Partition_1.name() + "_2" == Partition_1.results()[1].name())
+
+model.end()
+
+assert(model.checkPythonDump())
index 9c0cfb10c7dabc5f3fe155efa7986b9f92d606f8..9c0ce38a1b51096d12a57f5a43e7d56bc48da4a6 100644 (file)
@@ -114,4 +114,5 @@ ADD_UNIT_TESTS(
   TestRefAttr.py
   TestReference.py
   TestDeflectionDump.py
+  Test2488.py
 )
index bc1a851bf4ee914be9e1e6cfaacb82320a5c37a5..6e6a7090b206c795e906eeb3f33d67e66edcd532 100644 (file)
@@ -148,8 +148,8 @@ const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity,
   ObjectPtr anObject = std::dynamic_pointer_cast<ModelAPI_Object>(theEntity);
   if (anObject) {
     DocumentPtr aDoc = anObject->document();
-    int& aNbFeatures = myFeatureCount[aDoc][aKind];
-    aNbFeatures += 1;
+    std::pair<int, int>& aNbFeatures = myFeatureCount[aDoc][aKind];
+    aNbFeatures.first += 1;
 
     size_t anIndex = aName.find(aKind);
     if (anIndex == 0 && aName[aKind.length()] == '_') { // name starts with "FeatureKind_"
@@ -158,10 +158,13 @@ const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity,
 
       // Check number of already registered objects of such kind. Index of current object
       // should be the same to identify feature's name as automatically generated.
-      if (aNbFeatures == anId) {
+      if (aNbFeatures.first == anId && aNbFeatures.second < anId) {
         // name is not user-defined
         isDefaultName = true;
       }
+
+      if (anId > aNbFeatures.second)
+        aNbFeatures.second = anId;
     }
 
     // obtain default name for the feature
@@ -171,9 +174,9 @@ const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity,
       int aFullIndex = 0;
       NbFeaturesMap::const_iterator aFIt = myFeatureCount.begin();
       for (; aFIt != myFeatureCount.end(); ++aFIt) {
-        std::map<std::string, int>::const_iterator aFound = aFIt->second.find(aKind);
+        std::map<std::string, std::pair<int, int> >::const_iterator aFound = aFIt->second.find(aKind);
         if (aFound != aFIt->second.end())
-          aFullIndex += aFound->second;
+          aFullIndex += aFound->second.first;
       }
       aDefaultName << aKind << "_" << aFullIndex;
     }
index 2b29d81c85e7a457ca943253c25bda49a46c7337..c1539528664403583f12984fc77eaf7a71a22be6 100644 (file)
@@ -321,9 +321,9 @@ private:
     {}
   };
 
-  typedef std::map<EntityPtr, EntityName>                     EntityNameMap;
-  typedef std::map<std::string, std::set<std::string> >       ModulesMap;
-  typedef std::map<DocumentPtr, std::map<std::string, int> >  NbFeaturesMap;
+  typedef std::map<EntityPtr, EntityName>                                      EntityNameMap;
+  typedef std::map<std::string, std::set<std::string> >                        ModulesMap;
+  typedef std::map<DocumentPtr, std::map<std::string, std::pair<int, int> > >  NbFeaturesMap;
 
   struct LastDumpedEntity {
     EntityPtr            myEntity;   ///< last dumped entity
diff --git a/src/ModelHighAPI/Test/Test2488.py b/src/ModelHighAPI/Test/Test2488.py
new file mode 100644 (file)
index 0000000..d89e4c7
--- /dev/null
@@ -0,0 +1,183 @@
+## Copyright (C) 2017-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+from SketchAPI import *
+
+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("XOZ"))
+SketchLine_1 = Sketch_1.addLine(0, 4, 6.2, 4)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_2 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
+SketchLine_3 = Sketch_1.addLine(6.2, 4, 6.2, 2.5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(6.2, 2.5, 3.5, 2)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchLine_5 = Sketch_1.addLine(3.5, 2, 3.5, 0)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_6 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
+SketchLine_7 = Sketch_1.addLine(3.5, 0, 0, 0)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_7.endPoint())
+SketchLine_8 = Sketch_1.addLine(0, 4, 0, 0)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_8.endPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), 3.5)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 1.5)
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_1.result(), 6.2)
+SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 4)
+SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_5.result(), 2)
+model.do()
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_7r-SketchLine_8f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1"))
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1__cc"), False)
+SketchPoint_1 = SketchProjection_3.createdFeature()
+SketchCircle_1 = Sketch_2.addCircle(0, 0, 4.75)
+SketchCircle_1.setAuxiliary(True)
+SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
+SketchCircle_2 = Sketch_2.addCircle(4.113620667973598, 2.375000000005359, 1.1)
+SketchCircle_2.setName("SketchCircle_3")
+SketchCircle_2.result().setName("SketchCircle_3")
+SketchCircle_2.results()[1].setName("SketchCircle_3_2")
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center())
+SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_1.results()[1], 4.75)
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 1.1)
+SketchLine_9 = Sketch_2.addLine(0, 0, 4.113620667973598, 2.375000000005359)
+SketchLine_9.setAuxiliary(True)
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_9.endPoint())
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchLine_10 = SketchProjection_4.createdFeature()
+SketchConstraintAngle_1 = Sketch_2.setAngleBackward(SketchLine_9.result(), SketchLine_10.result(), 30)
+SketchMultiRotation_1 = Sketch_2.addRotation([SketchCircle_2.results()[1]], SketchCircle_1.center(), 120, 3)
+[SketchCircle_3, SketchCircle_4] = SketchMultiRotation_1.rotated()
+SketchCircle_4.setName("SketchCircle_5")
+SketchCircle_4.result().setName("SketchCircle_5")
+SketchCircle_4.results()[1].setName("SketchCircle_5_2")
+SketchCircle_3.setName("SketchCircle_4")
+SketchCircle_3.result().setName("SketchCircle_4")
+SketchCircle_3.results()[1].setName("SketchCircle_4_2")
+SketchCircle_5 = Sketch_2.addCircle(4.745479052513824, 0.2071920899853478, 0.65)
+SketchCircle_5.setName("SketchCircle_6")
+SketchCircle_5.result().setName("SketchCircle_6")
+SketchCircle_5.results()[1].setName("SketchCircle_6_2")
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_5.center())
+SketchCircle_6 = Sketch_2.addCircle(4.745479052513824, 0.2071920899853478, 0.8)
+SketchCircle_6.setName("SketchCircle_7")
+SketchCircle_6.result().setName("SketchCircle_7")
+SketchCircle_6.results()[1].setName("SketchCircle_7_2")
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchCircle_6.center())
+SketchCircle_7 = Sketch_2.addCircle(2.5521731400059, 4.006109367385169, 0.8)
+SketchCircle_7.setName("SketchCircle_8")
+SketchCircle_7.result().setName("SketchCircle_8")
+SketchCircle_7.results()[1].setName("SketchCircle_8_2")
+SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_7.center())
+SketchCircle_8 = Sketch_2.addCircle(2.5521731400059, 4.006109367385169, 0.65)
+SketchCircle_8.setName("SketchCircle_9")
+SketchCircle_8.result().setName("SketchCircle_9")
+SketchCircle_8.results()[1].setName("SketchCircle_9_2")
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_8.center())
+SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchCircle_8.center())
+SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_6.results()[1], 0.8)
+SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_5.results()[1], 0.65)
+SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_5.results()[1], SketchCircle_8.results()[1])
+SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_7.results()[1], SketchCircle_6.results()[1])
+SketchLine_11 = Sketch_2.addLine(0, 0, 4.745479052513824, 0.2071920899853478)
+SketchLine_11.setAuxiliary(True)
+SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchLine_11.endPoint())
+SketchLine_12 = Sketch_2.addLine(2.5521731400059, 4.006109367385169, 0, 0)
+SketchLine_12.setAuxiliary(True)
+SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_12.endPoint())
+SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_11.result(), SketchLine_9.result(), 27.5)
+SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_9.result(), SketchLine_12.result(), 27.5)
+SketchMultiRotation_2 = Sketch_2.addRotation([SketchCircle_7.results()[1], SketchCircle_6.results()[1]], SketchCircle_1.center(), 120, 3)
+[SketchCircle_9, SketchCircle_10, SketchCircle_11, SketchCircle_12] = SketchMultiRotation_2.rotated()
+SketchCircle_12.setName("SketchCircle_13")
+SketchCircle_12.result().setName("SketchCircle_13")
+SketchCircle_12.results()[1].setName("SketchCircle_13_2")
+SketchCircle_11.setName("SketchCircle_11")
+SketchCircle_11.result().setName("SketchCircle_11")
+SketchCircle_11.results()[1].setName("SketchCircle_11_2")
+SketchCircle_10.setName("SketchCircle_12")
+SketchCircle_10.result().setName("SketchCircle_12")
+SketchCircle_10.results()[1].setName("SketchCircle_12_2")
+SketchCircle_9.setName("SketchCircle_10")
+SketchCircle_9.result().setName("SketchCircle_10")
+SketchCircle_9.results()[1].setName("SketchCircle_10_2")
+SketchMultiRotation_3 = Sketch_2.addRotation([SketchCircle_8.results()[1], SketchCircle_5.results()[1]], SketchAPI_Line(SketchLine_10).startPoint(), 120, 2)
+[SketchCircle_13, SketchCircle_14] = SketchMultiRotation_3.rotated()
+SketchCircle_14.setName("SketchCircle_15")
+SketchCircle_14.result().setName("SketchCircle_15")
+SketchCircle_14.results()[1].setName("SketchCircle_15_2")
+SketchCircle_13.setName("SketchCircle_14")
+SketchCircle_13.result().setName("SketchCircle_14")
+SketchCircle_13.results()[1].setName("SketchCircle_14_2")
+SketchCircle_15 = Sketch_2.addCircle(0, 5, 0.45)
+SketchCircle_15.setName("SketchCircle_16")
+SketchCircle_15.result().setName("SketchCircle_16")
+SketchCircle_15.results()[1].setName("SketchCircle_16_2")
+SketchCircle_16 = Sketch_2.addCircle(3.276608177155967, -2.294305745404186, 0.3)
+SketchCircle_16.setName("SketchCircle_17")
+SketchCircle_16.result().setName("SketchCircle_17")
+SketchCircle_16.results()[1].setName("SketchCircle_17_2")
+SketchCircle_17 = Sketch_2.addCircle(4.259590630302757, -2.982597469025442, 0.5)
+SketchCircle_17.setName("SketchCircle_18")
+SketchCircle_17.result().setName("SketchCircle_18")
+SketchCircle_17.results()[1].setName("SketchCircle_18_2")
+SketchLine_13 = Sketch_2.addLine(0, 0, 0, 5)
+SketchLine_13.setAuxiliary(True)
+SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_15.center(), SketchLine_13.endPoint())
+SketchLine_14 = Sketch_2.addLine(0, 0, 4.259590630302757, -2.982597469025442)
+SketchLine_14.setAuxiliary(True)
+SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_14.startPoint())
+SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchCircle_17.center(), SketchLine_14.endPoint())
+SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchCircle_16.center(), SketchLine_14.result())
+SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_16.results()[1], 0.3)
+SketchConstraintRadius_6 = Sketch_2.setRadius(SketchCircle_17.results()[1], 0.5)
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_10).startPoint(), SketchCircle_16.center(), 4, True)
+SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchCircle_17.center(), 5.2, True)
+SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_13.result(), 5)
+SketchConstraintRadius_7 = Sketch_2.setRadius(SketchCircle_15.results()[1], 0.45)
+SketchConstraintAngle_4 = Sketch_2.setAngleBackward(SketchLine_10.result(), SketchLine_14.result(), 35)
+SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_15 = SketchProjection_5.createdFeature()
+SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_15.result())
+model.do()
+ExtrusionCut_1_objects_1 = [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_3_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_9_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_6_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_18_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_17_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_14_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
+ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_10_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_8_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_7_2f")]
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_1_1")])
+model.do()
+model.end()
+
+assert(model.checkPythonDump())
index 03a884d3a35448c2727b7e1329ba21908eb84224..d1dc0158ab1b8a47c0ffb3d98790bbdefda7cc82 100644 (file)
@@ -179,4 +179,10 @@ void ModuleBase_ListView::onListSelection()
   QList<QListWidgetItem*> aItems = myListControl->selectedItems();
   myCopyAction->setEnabled(!aItems.isEmpty());
   myDeleteAction->setEnabled(!aItems.isEmpty());
-}
\ No newline at end of file
+}
+
+//********************************************************************
+bool ModuleBase_ListView::hasItem(const QString& theTextValue) const
+{
+  return myListControl->findItems(theTextValue, Qt::MatchExactly).length() > 0;
+}
index 27c22622d3bd159efdbffcbc60f0cdd5669c1755..9fd0f578a7d09013169b0a2c8bf426dc7f473a6b 100644 (file)
@@ -56,6 +56,10 @@ public:
   /// \param theIndex an item internal index
   void addItem(const QString& theTextValue, const int theIndex);
 
+  /// Returns True if the control already contains an item with the given text
+  /// \param theTextValue tex of item to find
+  bool hasItem(const QString& theTextValue) const;
+
   /// Returns list of internal list view item indices
   /// \param theIndices an output container for indices
   void getSelectedIndices(std::set<int>& theIndices);
index c14fd6dd9e72557202372d764b764189d117d3bc..c7da97099b5d9b6e44d98242c6f7396bdb69fba0 100644 (file)
@@ -320,9 +320,9 @@ void ModuleBase_PreferencesDlg::createViewerPage(int thePageId)
 
   int sensitivityGroup = myPreferences->addItem(tr("Selection sensitivity"), viewTab);
   myPreferences->setItemProperty("columns", 2, sensitivityGroup);
-  myPreferences->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::Double,
+  myPreferences->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
                          ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity");
-  myPreferences->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::Double,
+  myPreferences->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
                          ModuleBase_Preferences::VIEWER_SECTION, "edge-selection-sensitivity");
 }
 
index 7c855b33b35913179e21035668499fe11acc5834..cb422bf9a684ddafbe5dcdf03dcc8c557d4d5d52 100755 (executable)
@@ -233,6 +233,7 @@ void ModuleBase_ResultPrs::collectSubShapes(BRep_Builder& theBuilder,
   const NCollection_List<TopoDS_Shape>& theHiddenSubShapes)
 {
   switch (theShape.ShapeType()) {
+    case TopAbs_COMPSOLID:
     case TopAbs_COMPOUND: {
       for (TopoDS_Iterator aChildIter (theShape); aChildIter.More(); aChildIter.Next())
         collectSubShapes(theBuilder, theCompound, aChildIter.Value(), theHiddenSubShapes);
index d2481ebddbe041f3890e8275fba60522a876ecd9..cc299083317be073bda56b3ab5da4bda2d24feca 100644 (file)
@@ -255,32 +255,6 @@ void setParameterName(ResultParameterPtr theResultParameter, const std::string&
   aParameter->data()->setName(theName);
   aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID())->setValue(theName);
   aParameter->data()->blockSendAttributeUpdated(aWasBlocked);
-
-  // #2474 : if parameter name now hides/shows the higher level parameter name,
-  // update the depended expressions
-  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-  if (theResultParameter->document() != aRootDoc) {
-    std::list<std::string> aNames; // collect names in the root document that must be checked
-    aNames.push_back(theName);
-    if (anOldName != theName) {
-      aNames.push_back(anOldName);
-    }
-    std::list<std::string>::iterator aNIter = aNames.begin();
-    for (; aNIter != aNames.end(); aNIter++) {
-      double aValue;
-      ResultParameterPtr aRootParam;
-      if (ModelAPI_Tools::findVariable(aParameter, *aNIter, aValue, aRootParam, aRootDoc)) {
-        std::set<std::shared_ptr<ModelAPI_Attribute> > anAttributes =
-          aRootParam->data()->refsToMe();
-        std::set<std::shared_ptr<ModelAPI_Attribute> >::const_iterator anAttributeIt =
-          anAttributes.cbegin();
-        for (; anAttributeIt != anAttributes.cend(); ++anAttributeIt) {
-          const AttributePtr& anAttribute = *anAttributeIt;
-          ModelAPI_AttributeEvalMessage::send(anAttribute, NULL);
-        }
-      }
-    }
-  }
 }
 
 void ParametersPlugin_EvalListener::processObjectRenamedEvent(
index ab6cf97e59765fb60cdea2d92e3216fdc7ef43eb..ab128d10b10b83c16f0809eda0fb81206001f9c2 100644 (file)
@@ -78,8 +78,38 @@ void ParametersPlugin_Parameter::updateName()
   data()->setName(aName);
 
   ResultParameterPtr aParam = document()->createParameter(data());
+  std::string anOldName = aParam->data()->name();
   aParam->data()->setName(aName);
   setResult(aParam);
+
+
+  // #2474 : if parameter name now hides/shows the higher level parameter name,
+  // update the depended expressions
+  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+  if (aParam->document() != aRootDoc) {
+    std::list<std::string> aNames; // collect names in the root document that must be checked
+    aNames.push_back(aName);
+    if (anOldName != aName) {
+      aNames.push_back(anOldName);
+    }
+    std::list<std::string>::iterator aNIter = aNames.begin();
+    for (; aNIter != aNames.end(); aNIter++) {
+      double aValue;
+      ResultParameterPtr aRootParam;
+      FeaturePtr aThis =
+        std::dynamic_pointer_cast<ModelAPI_Feature>(string(VARIABLE_ID())->owner());
+      if (ModelAPI_Tools::findVariable(aThis, *aNIter, aValue, aRootParam, aRootDoc)) {
+        std::set<std::shared_ptr<ModelAPI_Attribute> > anAttributes =
+          aRootParam->data()->refsToMe();
+        std::set<std::shared_ptr<ModelAPI_Attribute> >::const_iterator anAttributeIt =
+          anAttributes.cbegin();
+        for (; anAttributeIt != anAttributes.cend(); ++anAttributeIt) {
+          const AttributePtr& anAttribute = *anAttributeIt;
+          ModelAPI_AttributeEvalMessage::send(anAttribute, NULL);
+        }
+      }
+    }
+  }
 }
 
 bool ParametersPlugin_Parameter::updateExpression()
@@ -97,6 +127,7 @@ bool ParametersPlugin_Parameter::updateExpression()
   AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE());
   aValueAttribute->setValue(aValue);
   setResult(aParam);
+
   return true;
 }
 
index e6969c8090f22da7333de96f5207e298ad9bc09d..52e0a9d3fdc56065a30c7e4f14a57c3e3476f191 100644 (file)
@@ -101,7 +101,8 @@ QList<std::shared_ptr<ModuleBase_ViewerPrs>> PartSet_ExternalPointsMgr::findCirc
     ResultPtr aResObj = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
 
     // Do not use Fields and groups in selection in sketcher
-    if ((aResObj->groupName() == ModelAPI_ResultField::group()) ||
+    if (!aResObj.get() ||
+      (aResObj->groupName() == ModelAPI_ResultField::group()) ||
       (aResObj->groupName() == ModelAPI_ResultGroup::group()))
       continue;
 
index a28587f5b278b1b7e8cae90d93f553bfabd0d7fe..329eb0bf50e2618f9793996332d2e63a457e2281 100755 (executable)
 #include <SketchPlugin_Sketch.h>
 
 #include <SketcherPrs_SymbolPrs.h>
+#include <SketcherPrs_PositionMgr.h>
 #include <SketcherPrs_Coincident.h>
 #include <SketcherPrs_Tools.h>
 
@@ -722,6 +723,7 @@ bool PartSet_Module::isSketchNeutralPointActivated() const
 void PartSet_Module::closeDocument()
 {
   myActivePartIndex = QModelIndex();
+  SketcherPrs_PositionMgr::get()->clearAll();
 }
 
 //******************************************************
index 49892641961967dae0d903f327d14dd20e6d9e15..dfa3103dd11863a972e5c6ce5dd98a3ec110debe 100644 (file)
@@ -61,7 +61,6 @@ SketcherPrs_PositionMgr::SketcherPrs_PositionMgr()
 {
 }
 
-
 int SketcherPrs_PositionMgr::getPositionIndex(ObjectPtr theLine,
                                               const SketcherPrs_SymbolPrs* thePrs)
 {
index 8695126b2ae06aa83d010caa8f4834614464504c..7acc36e1150d9c56bc2031fc26df6711499f5190 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef SketcherPrs_PositionMgr_H
 #define SketcherPrs_PositionMgr_H
 
+#include "SketcherPrs.h"
 #include "SketcherPrs_SymbolPrs.h"
 
 #include <GeomAPI_Shape.h>
@@ -36,7 +37,7 @@
 * A class Position Manager which manages position of constraints symbols along a source object line.
 * it expects that symbol icons have size 16x16 px
 */
-class SketcherPrs_PositionMgr
+class SKETCHERPRS_EXPORT SketcherPrs_PositionMgr
 {
 public:
   /// Returns current instance of position manager
@@ -53,6 +54,9 @@ public:
   /// \param thePrs a constraint presentation
   void deleteConstraint(const SketcherPrs_SymbolPrs* thePrs);
 
+  /// Cleares all stored positions for all constraints
+  void clearAll()  { myShapes.clear(); myPntShapes.clear(); }
+
 private:
   /// Constructor
   SketcherPrs_PositionMgr();
@@ -82,9 +86,6 @@ private:
   typedef std::map<const SketcherPrs_SymbolPrs*, int> PositionsMap;
   typedef std::map<const ModelAPI_Feature*, std::array<int, 2>> FeaturesMap;
 
-  /// The map which contains position of presentation
-  PositionsMap myIndexes;
-
   /// The map contains position index
   std::map<ObjectPtr, PositionsMap> myShapes;
 
index 64088473747c5ebac9787fc798f75ffb0e4c0a2b..051402c908ebb3bff6077ce63741c944129af17c 100644 (file)
@@ -223,8 +223,10 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& theMess
         int aRow = aRootDoc->size(aGroup, true);
         if (aGroup == aRootType) {
           // Process root folder
-          removeRow(aRow + aNbFolders);
-          rebuildBranch(aNbFolders, aRow);
+          // remove optimization due to the issue #2456
+          //removeRow(aRow + aNbFolders);
+          //rebuildBranch(aNbFolders, aRow);
+          rebuildDataTree();
         } else if (aGroup == ModelAPI_Folder::group()) {
           rebuildDataTree();
         } else {
index 01211ae75611a35ec61984507a104cf0dcddc314..729c967616e2513632f1ce408f9f5635e1ecb097 100644 (file)
@@ -232,9 +232,12 @@ void XGUI_FacesPanel::processSelection()
       aPrs->interactive());
     if (aResultPrs.IsNull())
       continue;
+    QString aItemName = generateName(aPrs);
+    if (myListView->hasItem(aItemName))
+      return;
 
     myItems.insert(myLastItemIndex, aPrs);
-    myListView->addItem(generateName(aPrs), myLastItemIndex);
+    myListView->addItem(aItemName, myLastItemIndex);
     myLastItemIndex++;
     isModified = true;