]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2157: Create fillet : special behavior with origin
authordbv <dbv@opencascade.com>
Tue, 18 Jul 2017 09:04:38 +0000 (12:04 +0300)
committerdbv <dbv@opencascade.com>
Tue, 18 Jul 2017 09:05:00 +0000 (12:05 +0300)
Now fillet validator will ignore coincides with lines which are not on start/end point.

src/SketchPlugin/SketchPlugin_Fillet.cpp
src/SketchPlugin/SketchPlugin_Tools.cpp
src/SketchPlugin/SketchPlugin_Tools.h
src/SketchPlugin/SketchPlugin_Validators.cpp

index 10a6a781c9cd7ee9b04168b45a5a1dd17afb5b66..36e6714ab563d594961690f23d02bb054de1eeac 100644 (file)
@@ -474,17 +474,19 @@ std::set<FeaturePtr> getCoincides(const FeaturePtr& theConstraintCoincidence)
 
   SketchPlugin_Tools::findCoincidences(theConstraintCoincidence,
                                        SketchPlugin_ConstraintCoincidence::ENTITY_A(),
-                                       aCoincides);
+                                       aCoincides,
+                                       true);
   SketchPlugin_Tools::findCoincidences(theConstraintCoincidence,
                                        SketchPlugin_ConstraintCoincidence::ENTITY_B(),
-                                       aCoincides);
+                                       aCoincides,
+                                       true);
 
   // Remove points from set of coincides.
   std::set<FeaturePtr> aNewSetOfCoincides;
   for(std::set<FeaturePtr>::iterator anIt = aCoincides.begin(); anIt != aCoincides.end(); ++anIt) {
     std::shared_ptr<SketchPlugin_SketchEntity> aSketchEntity =
       std::dynamic_pointer_cast<SketchPlugin_SketchEntity>(*anIt);
-    if(aSketchEntity.get() && aSketchEntity->isCopy()) {
+    if(aSketchEntity.get() && (aSketchEntity->isCopy() || aSketchEntity->isExternal())) {
       continue;
     }
     if((*anIt)->getKind() == SketchPlugin_Line::ID()) {
index baa48456394c92fa696e92e409f5a1ebd4655c3c..56079f0da16c64b25a1a2273e6b2a76ee005f623 100644 (file)
@@ -104,7 +104,8 @@ std::set<FeaturePtr> findCoincidentConstraints(const FeaturePtr& theFeature)
 
 void findCoincidences(const FeaturePtr theStartCoin,
                       const std::string& theAttr,
-                      std::set<FeaturePtr>& theList)
+                      std::set<FeaturePtr>& theList,
+                      const bool theIsAttrOnly)
 {
   AttributeRefAttrPtr aPnt = theStartCoin->refattr(theAttr);
   if(!aPnt) {
@@ -116,15 +117,17 @@ void findCoincidences(const FeaturePtr theStartCoin,
     if(aOrig.get() == NULL) {
       return;
     }
-    theList.insert(aObj);
+    if(!theIsAttrOnly || !aPnt->isObject()) {
+      theList.insert(aObj);
+    }
     std::set<FeaturePtr> aCoincidences = findCoincidentConstraints(aObj);
     std::set<FeaturePtr>::const_iterator aCIt = aCoincidences.begin();
     for (; aCIt != aCoincidences.end(); ++aCIt) {
       FeaturePtr aConstrFeature = *aCIt;
       std::shared_ptr<GeomAPI_Pnt2d> aPnt = getCoincidencePoint(aConstrFeature);
       if(aPnt.get() && aOrig->isEqual(aPnt)) {
-        findCoincidences(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_A(), theList);
-        findCoincidences(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_B(), theList);
+        findCoincidences(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_A(), theList, theIsAttrOnly);
+        findCoincidences(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_B(), theList, theIsAttrOnly);
       }
     }
   }
index e06cc163950cc207f402fc152176bd6c9b20a185..07ea391dfa86ffa0516efd302f4e57d8e9d46ec6 100644 (file)
@@ -46,9 +46,11 @@ std::set<FeaturePtr> findCoincidentConstraints(const FeaturePtr& theFeature);
 /// \param[in] theStartCoin coincidence feature
 /// \param[in] theAttr attribute name
 /// \param[out] theList list of lines
+/// \param[in] theIsAttrOnly if true includes only coincidences with attributes.
 void findCoincidences(const FeaturePtr theStartCoin,
                       const std::string& theAttr,
-                      std::set<FeaturePtr>& theList);
+                      std::set<FeaturePtr>& theList,
+                      const bool theIsAttrOnly = false);
 
 /// Find all features the point is coincident to.
 std::set<FeaturePtr> findFeaturesCoincidentToPoint(const AttributePoint2DPtr& thePoint);
index d7aaa53e99dcefc0dafd37e93d16fa837a174afe..f922ce8eac2b2b0e9be1c51a2e3f6284cfb0cd46 100755 (executable)
@@ -577,18 +577,20 @@ bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribut
   std::set<FeaturePtr> aCoinsides;
   SketchPlugin_Tools::findCoincidences(aConstraintCoincidence,
                                         SketchPlugin_ConstraintCoincidence::ENTITY_A(),
-                                        aCoinsides);
+                                        aCoinsides,
+                                        true);
   SketchPlugin_Tools::findCoincidences(aConstraintCoincidence,
                                         SketchPlugin_ConstraintCoincidence::ENTITY_B(),
-                                        aCoinsides);
+                                        aCoinsides,
+                                        true);
 
-  // Remove points from set of coincides.
+  // Remove points and external lines from set of coincides.
   std::set<FeaturePtr> aNewSetOfCoincides;
   for(std::set<FeaturePtr>::iterator anIt = aCoinsides.begin();
       anIt != aCoinsides.end(); ++anIt) {
     std::shared_ptr<SketchPlugin_SketchEntity> aSketchEntity =
       std::dynamic_pointer_cast<SketchPlugin_SketchEntity>(*anIt);
-    if(aSketchEntity.get() && aSketchEntity->isCopy()) {
+    if(aSketchEntity.get() && (aSketchEntity->isCopy() || aSketchEntity->isExternal())) {
       continue;
     }
     if((*anIt)->getKind() != SketchPlugin_Line::ID() &&