From: dbv Date: Wed, 18 Nov 2015 14:22:46 +0000 (+0300) Subject: Bug #1098: Create fillet problem X-Git-Tag: V_2.0.0~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ada5c6185cba8cc4352f0207f7540f12e6fda91f;p=modules%2Fshaper.git Bug #1098: Create fillet problem --- diff --git a/src/SketchPlugin/SketchPlugin_ConstraintFillet.cpp b/src/SketchPlugin/SketchPlugin_ConstraintFillet.cpp index bf47039b1..c311ec712 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintFillet.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintFillet.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -468,33 +469,42 @@ void SketchPlugin_ConstraintFillet::attributeChanged(const std::string& theID) return; } - std::set aCoinsideLines; + std::set 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 aNewLines; + for(std::set::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 aNewLines; - for(std::set::iterator anIt = aCoinsideLines.begin(); anIt != aCoinsideLines.end(); ++anIt) { + if(aCoinsides.size() > 2) { + aNewLines.clear(); + for(std::set::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::iterator aLinesIt = aCoinsideLines.begin(); + std::set::iterator aLinesIt = aCoinsides.begin(); anOldFeatureA = *aLinesIt++; anOldFeatureB = *aLinesIt; aRefListOfBaseLines->append(anOldFeatureA); diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index e88aa1db8..d774e390e 100755 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -451,34 +451,39 @@ bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribut return false; } - std::set aCoinsideLines; + std::set 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 aNewLines; + for(std::set::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 aNewLines; - for(std::set::iterator anIt = aCoinsideLines.begin(); anIt != aCoinsideLines.end(); ++anIt) { + if(aCoinsides.size() > 2) { + aNewLines.clear(); + for(std::set::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::iterator anIt = aCoinsideLines.begin(); + std::set::iterator anIt = aCoinsides.begin(); FeaturePtr aFirstFeature = *anIt++; FeaturePtr aSecondFeature = *anIt; if(aFirstFeature->getKind() == SketchPlugin_Line::ID() && aSecondFeature->getKind() == SketchPlugin_Line::ID()) { diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index c2ccd8748..847509a1b 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -57,8 +57,10 @@ std::shared_ptr getPoint(ModelAPI_Feature* theFeature, FeaturePtr aFeature; std::shared_ptr 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(); + } + aFeature = ModelAPI_Feature::feature(anAttr->object()); if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID()) aPointAttr = std::dynamic_pointer_cast(