From: dbv Date: Tue, 18 Jul 2017 09:04:38 +0000 (+0300) Subject: Issue #2157: Create fillet : special behavior with origin X-Git-Tag: V_2.7.2RC~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a338c34047a7a0d92e8640c82bccd2cc88c3871d;p=modules%2Fshaper.git Issue #2157: Create fillet : special behavior with origin Now fillet validator will ignore coincides with lines which are not on start/end point. --- diff --git a/src/SketchPlugin/SketchPlugin_Fillet.cpp b/src/SketchPlugin/SketchPlugin_Fillet.cpp index 10a6a781c..36e6714ab 100644 --- a/src/SketchPlugin/SketchPlugin_Fillet.cpp +++ b/src/SketchPlugin/SketchPlugin_Fillet.cpp @@ -474,17 +474,19 @@ std::set 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 aNewSetOfCoincides; for(std::set::iterator anIt = aCoincides.begin(); anIt != aCoincides.end(); ++anIt) { std::shared_ptr aSketchEntity = std::dynamic_pointer_cast(*anIt); - if(aSketchEntity.get() && aSketchEntity->isCopy()) { + if(aSketchEntity.get() && (aSketchEntity->isCopy() || aSketchEntity->isExternal())) { continue; } if((*anIt)->getKind() == SketchPlugin_Line::ID()) { diff --git a/src/SketchPlugin/SketchPlugin_Tools.cpp b/src/SketchPlugin/SketchPlugin_Tools.cpp index baa484563..56079f0da 100644 --- a/src/SketchPlugin/SketchPlugin_Tools.cpp +++ b/src/SketchPlugin/SketchPlugin_Tools.cpp @@ -104,7 +104,8 @@ std::set findCoincidentConstraints(const FeaturePtr& theFeature) void findCoincidences(const FeaturePtr theStartCoin, const std::string& theAttr, - std::set& theList) + std::set& 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 aCoincidences = findCoincidentConstraints(aObj); std::set::const_iterator aCIt = aCoincidences.begin(); for (; aCIt != aCoincidences.end(); ++aCIt) { FeaturePtr aConstrFeature = *aCIt; std::shared_ptr 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); } } } diff --git a/src/SketchPlugin/SketchPlugin_Tools.h b/src/SketchPlugin/SketchPlugin_Tools.h index e06cc1639..07ea391df 100644 --- a/src/SketchPlugin/SketchPlugin_Tools.h +++ b/src/SketchPlugin/SketchPlugin_Tools.h @@ -46,9 +46,11 @@ std::set 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& theList); + std::set& theList, + const bool theIsAttrOnly = false); /// Find all features the point is coincident to. std::set findFeaturesCoincidentToPoint(const AttributePoint2DPtr& thePoint); diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index d7aaa53e9..f922ce8ea 100755 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -577,18 +577,20 @@ bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribut std::set 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 aNewSetOfCoincides; for(std::set::iterator anIt = aCoinsides.begin(); anIt != aCoinsides.end(); ++anIt) { std::shared_ptr aSketchEntity = std::dynamic_pointer_cast(*anIt); - if(aSketchEntity.get() && aSketchEntity->isCopy()) { + if(aSketchEntity.get() && (aSketchEntity->isCopy() || aSketchEntity->isExternal())) { continue; } if((*anIt)->getKind() != SketchPlugin_Line::ID() &&