]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'V9_9_BR'
authorvsr <vsr@opencascade.com>
Tue, 31 May 2022 08:20:08 +0000 (11:20 +0300)
committervsr <vsr@opencascade.com>
Tue, 31 May 2022 08:20:46 +0000 (11:20 +0300)
CMakeLists.txt
src/PythonAddons/macros/pipeNetwork/feature.py
src/SketchPlugin/SketchPlugin_Fillet.cpp
src/SketchPlugin/SketchPlugin_Validators.cpp
src/SketchPlugin/SketchPlugin_Validators.h

index 9cb4179ec950d11f5ed2377298f5964b34c76407..6154d45d9c92a43037ff4cb74f1848ddeebefcec 100644 (file)
@@ -50,7 +50,7 @@ ENDIF()
 
 # Versioning
 # ===========
-SALOME_SETUP_VERSION(9.9.0)
+SALOME_SETUP_VERSION(9.9.0 DEVELOPMENT)
 MESSAGE(STATUS "Building ${PROJECT_NAME} ${${PROJECT_NAME}_VERSION} from \"${${PROJECT_NAME}_GIT_SHA1}\"")
 SET(COMPONENT_NAME SHAPER)
 
index c53f5f602ea0a661046cb918a8258f1f54c9f1e8..86e9bcdc495a754148918819876592fbe78696fa 100755 (executable)
@@ -696,7 +696,7 @@ Il est nommé conformément au noeud d'application. Cela n'a qu'un intérêt gra
             while True:
 
                 # B.1. Lecture du fichier
-                with open(filepath) as afile:
+                with open(filepath, encoding='utf-8') as afile:
                     summary = 0
                     method = self.parligne
                     for line in afile:
index a5b2c718e3e82e9f4b3049990be3c606f2ceb199..ece5689f626b13ca6a84ee9107a01bcc6acc68a0 100644 (file)
@@ -31,6 +31,7 @@
 #include "SketchPlugin_ConstraintTangent.h"
 #include "SketchPlugin_ConstraintRadius.h"
 #include "SketchPlugin_Tools.h"
+#include "SketchPlugin_Validators.h"
 
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeInteger.h>
@@ -53,6 +54,7 @@
 #include <GeomDataAPI_Point2D.h>
 
 #include <Events_Loop.h>
+#include <Events_InfoMessage.h>
 
 #include <math.h>
 
@@ -212,37 +214,15 @@ bool SketchPlugin_Fillet::calculateFilletParameters()
   if (!aFilletPoint2D.get())
     return false;
 
-  std::set<AttributePoint2DPtr> aCoincidentPoints =
-      SketchPlugin_Tools::findPointsCoincidentToPoint(aFilletPoint2D);
-  std::set<FeaturePtr> aFilletFeatures;
-  for (std::set<AttributePoint2DPtr>::iterator aCPIt = aCoincidentPoints.begin();
-       aCPIt != aCoincidentPoints.end(); ++aCPIt) {
-    std::shared_ptr<SketchPlugin_Feature> anOwner =
-        std::dynamic_pointer_cast<SketchPlugin_Feature>(
-        ModelAPI_Feature::feature((*aCPIt)->owner()));
-    if (anOwner && !anOwner->isExternal())
-      aFilletFeatures.insert(anOwner);
-  }
-  // remove auxilary entities from set of coincident features
-  if (aFilletFeatures.size() > 2) {
-    std::set<FeaturePtr>::iterator anIt = aFilletFeatures.begin();
-    while (anIt != aFilletFeatures.end()) {
-      if ((*anIt)->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) {
-        std::set<FeaturePtr>::iterator aRemoveIt = anIt++;
-        aFilletFeatures.erase(aRemoveIt);
-      }
-      else
-        ++anIt;
-    }
-  }
-  if (aFilletFeatures.size() != 2) {
-    setError("Error: Selected point does not have two suitable edges for fillet.");
+  Events_InfoMessage anError;
+  FeaturePtr anEdge1, anEdge2;
+  if (!SketchPlugin_FilletVertexValidator::isValidVertex
+      (aPointRefAttr, anError, anEdge1, anEdge2)) {
+    setError(anError.messageString());
     return false;
   }
-
-  std::set<FeaturePtr>::iterator aFIt = aFilletFeatures.begin();
-  myBaseFeatures[0] = *aFIt;
-  myBaseFeatures[1] = *(++aFIt);
+  myBaseFeatures[0] = anEdge1;
+  myBaseFeatures[1] = anEdge2;
 
   std::shared_ptr<GeomAPI_Pnt2d> aFilletPnt2d = aFilletPoint2D->pnt();
   double aRadius = calculateFilletRadius(myBaseFeatures);
index d11d3d7cb4bd5eb423904bd1ed4d508c443204a2..df62cbbd7a3bd1ab983b7db994c69408e2057812 100644 (file)
@@ -669,6 +669,15 @@ static bool isPointPointCoincidence(const FeaturePtr& theCoincidence)
 bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribute,
                                                  const std::list<std::string>& theArguments,
                                                  Events_InfoMessage& theError) const
+{
+  FeaturePtr anEdge1, anEdge2;
+  return isValidVertex(theAttribute, theError, anEdge1, anEdge2);
+}
+
+bool SketchPlugin_FilletVertexValidator::isValidVertex(const AttributePtr& theAttribute,
+                                                       Events_InfoMessage& theError,
+                                                       FeaturePtr&         theEdge1,
+                                                       FeaturePtr&         theEdge2)
 {
   AttributeRefAttrPtr aPointRefAttr =
     std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
@@ -723,13 +732,13 @@ bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribut
   // Get coincides from constraint.
   std::set<FeaturePtr> aCoinsides;
   SketchPlugin_Tools::findCoincidences(aConstraintCoincidence,
-                                        SketchPlugin_ConstraintCoincidence::ENTITY_A(),
-                                        aCoinsides,
-                                        true);
+                                       SketchPlugin_ConstraintCoincidence::ENTITY_A(),
+                                       aCoinsides,
+                                       true);
   SketchPlugin_Tools::findCoincidences(aConstraintCoincidence,
-                                        SketchPlugin_ConstraintCoincidence::ENTITY_B(),
-                                        aCoinsides,
-                                        true);
+                                       SketchPlugin_ConstraintCoincidence::ENTITY_B(),
+                                       aCoinsides,
+                                       true);
 
   // Remove points and external lines from set of coincides.
   std::set<FeaturePtr> aNewSetOfCoincides;
@@ -774,6 +783,11 @@ bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribut
     return false;
   }
 
+  // output edges
+  std::set<FeaturePtr>::iterator aFIt = aCoinsides.begin();
+  theEdge1 = *aFIt;
+  theEdge2 = *(++aFIt);
+
   // Check that selected edges don't have tangent constraint.
   std::set<FeaturePtr>::iterator anIt = aCoinsides.begin();
   FeaturePtr aFirstFeature = *anIt++;
index 172ecd55450a19118dfb18c008f497866c17c374..6a278b1e2bcfb391b4c72a472fb80d7d47f0be81 100644 (file)
@@ -209,6 +209,16 @@ public:
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
                        Events_InfoMessage& theError) const;
+
+  //! returns true if attribute is a good point for fillet
+  //! \param theAttribute the checked point attribute
+  //! \param theError error message
+  //! \param theEdge1 adjacent edge feature
+  //! \param theEdge2 adjacent edge feature
+  static bool isValidVertex(const AttributePtr& theAttribute,
+                            Events_InfoMessage& theError,
+                            FeaturePtr&         theEdge1,
+                            FeaturePtr&         theEdge2);
 };