]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Bug #1098: Create fillet problem
authordbv <dbv@opencascade.com>
Wed, 18 Nov 2015 14:22:46 +0000 (17:22 +0300)
committerdbv <dbv@opencascade.com>
Wed, 18 Nov 2015 14:23:04 +0000 (17:23 +0300)
src/SketchPlugin/SketchPlugin_ConstraintFillet.cpp
src/SketchPlugin/SketchPlugin_Validators.cpp
src/SketcherPrs/SketcherPrs_Tools.cpp

index bf47039b18183bb8768927d2328a0a7d6a9c98ad..c311ec712475eb96f82d3c591535c20108a447b5 100644 (file)
@@ -27,6 +27,7 @@
 #include <SketchPlugin_ConstraintCoincidence.h>
 #include <SketchPlugin_ConstraintTangent.h>
 #include <SketchPlugin_ConstraintRadius.h>
+#include <SketchPlugin_Point.h>
 #include <SketchPlugin_Tools.h>
 
 #include <SketcherPrs_Factory.h>
@@ -468,33 +469,42 @@ void SketchPlugin_ConstraintFillet::attributeChanged(const std::string& theID)
       return;
     }
 
-    std::set<FeaturePtr> aCoinsideLines;
+    std::set<FeaturePtr> aCoinsides;
     SketchPlugin_Tools::findCoincidences(aCoincident,
                                          SketchPlugin_ConstraintCoincidence::ENTITY_A(),
-                                         aCoinsideLines);
+                                         aCoinsides);
     SketchPlugin_Tools::findCoincidences(aCoincident,
                                          SketchPlugin_ConstraintCoincidence::ENTITY_B(),
-                                         aCoinsideLines);
+                                         aCoinsides);
+
+    // Remove points
+    std::set<FeaturePtr> aNewLines;
+    for(std::set<FeaturePtr>::iterator anIt = aCoinsides.begin(); anIt != aCoinsides.end(); ++anIt) {
+      if((*anIt)->getKind() != SketchPlugin_Point::ID()) {
+        aNewLines.insert(*anIt);
+      }
+    }
+    aCoinsides = aNewLines;
 
     // Remove auxilary lines
-    if(aCoinsideLines.size() > 2) {
-      std::set<FeaturePtr> aNewLines;
-      for(std::set<FeaturePtr>::iterator anIt = aCoinsideLines.begin(); anIt != aCoinsideLines.end(); ++anIt) {
+    if(aCoinsides.size() > 2) {
+      aNewLines.clear();
+      for(std::set<FeaturePtr>::iterator anIt = aCoinsides.begin(); anIt != aCoinsides.end(); ++anIt) {
         if(!(*anIt)->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) {
           aNewLines.insert(*anIt);
         }
       }
-      aCoinsideLines = aNewLines;
+      aCoinsides = aNewLines;
     }
 
-    if(aCoinsideLines.size() != 2) {
+    if(aCoinsides.size() != 2) {
       setError("At selected vertex should be two coincident lines");
       return;
     }
 
     // Store base lines
     FeaturePtr anOldFeatureA, anOldFeatureB;
-    std::set<FeaturePtr>::iterator aLinesIt = aCoinsideLines.begin();
+    std::set<FeaturePtr>::iterator aLinesIt = aCoinsides.begin();
     anOldFeatureA = *aLinesIt++;
     anOldFeatureB = *aLinesIt;
     aRefListOfBaseLines->append(anOldFeatureA);
index e88aa1db86c787525671ef334b6aeb66a21d179a..d774e390eff01044bc727d6e94eec256aa30c1dc 100755 (executable)
@@ -451,34 +451,39 @@ bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribut
     return false;
   }
 
-  std::set<FeaturePtr> aCoinsideLines;
+  std::set<FeaturePtr> aCoinsides;
   SketchPlugin_Tools::findCoincidences(aCoincident,
                                        SketchPlugin_ConstraintCoincidence::ENTITY_A(),
-                                       aCoinsideLines);
+                                       aCoinsides);
   SketchPlugin_Tools::findCoincidences(aCoincident,
                                        SketchPlugin_ConstraintCoincidence::ENTITY_B(),
-                                       aCoinsideLines);
-  if(aCoinsideLines.size() < 2) {
-    return false;
+                                       aCoinsides);
+  // Remove points
+  std::set<FeaturePtr> aNewLines;
+  for(std::set<FeaturePtr>::iterator anIt = aCoinsides.begin(); anIt != aCoinsides.end(); ++anIt) {
+    if((*anIt)->getKind() != SketchPlugin_Point::ID()) {
+      aNewLines.insert(*anIt);
+    }
   }
+  aCoinsides = aNewLines;
 
   // Remove auxilary lines
-  if(aCoinsideLines.size() > 2) {
-    std::set<FeaturePtr> aNewLines;
-    for(std::set<FeaturePtr>::iterator anIt = aCoinsideLines.begin(); anIt != aCoinsideLines.end(); ++anIt) {
+  if(aCoinsides.size() > 2) {
+    aNewLines.clear();
+    for(std::set<FeaturePtr>::iterator anIt = aCoinsides.begin(); anIt != aCoinsides.end(); ++anIt) {
       if(!(*anIt)->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) {
         aNewLines.insert(*anIt);
       }
     }
-    aCoinsideLines = aNewLines;
+    aCoinsides = aNewLines;
   }
 
-  if(aCoinsideLines.size() != 2) {
+  if(aCoinsides.size() != 2) {
     return false;
   }
 
   // Check that lines not collinear
-  std::set<FeaturePtr>::iterator anIt = aCoinsideLines.begin();
+  std::set<FeaturePtr>::iterator anIt = aCoinsides.begin();
   FeaturePtr aFirstFeature = *anIt++;
   FeaturePtr aSecondFeature = *anIt;
   if(aFirstFeature->getKind() == SketchPlugin_Line::ID() && aSecondFeature->getKind() == SketchPlugin_Line::ID()) {
index c2ccd87488ab57d5f11c986059ef128cd30b3b0c..847509a1b046b265feaa1c3607e671cc67d0b7dc 100644 (file)
@@ -57,8 +57,10 @@ std::shared_ptr<GeomAPI_Pnt2d> getPoint(ModelAPI_Feature* theFeature,
   FeaturePtr aFeature;
   std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
       ModelAPI_AttributeRefAttr>(theFeature->data()->attribute(theAttribute));
-  if (anAttr)
-    aFeature = ModelAPI_Feature::feature(anAttr->object());
+  if(!anAttr.get()) {
+    return std::shared_ptr<GeomAPI_Pnt2d>();
+  }
+  aFeature = ModelAPI_Feature::feature(anAttr->object());
 
   if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID())
     aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(