From: azv Date: Wed, 12 Apr 2017 09:15:37 +0000 (+0300) Subject: Issue #2126: Fatal error when create fillet X-Git-Tag: V_2.7.0~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c553334b09c27567c9e159ffb052f6ef28fd273c;p=modules%2Fshaper.git Issue #2126: Fatal error when create fillet Avoid to select point-on-entity as a fillet vertex --- diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index 96b01f6d5..5246988b8 100755 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -487,6 +487,24 @@ static bool hasSameTangentFeature(const std::set& theRefsList, return false; } +static bool isPointPointCoincidence(const FeaturePtr& theCoincidence) +{ + AttributeRefAttrPtr aRefAttr[2] = { + theCoincidence->refattr(SketchPlugin_Constraint::ENTITY_A()), + theCoincidence->refattr(SketchPlugin_Constraint::ENTITY_B()) + }; + + bool arePoints = true; + for (int i = 0; i < 2 && arePoints; ++i) { + if (aRefAttr[i]->isObject()) { + FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr[i]->object()); + arePoints = aFeature.get() && aFeature->getKind() == SketchPlugin_Point::ID(); + } else + arePoints = aRefAttr[i]->attr().get(); + } + return arePoints; +} + bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribute, const std::list& theArguments, Events_InfoMessage& theError) const @@ -514,23 +532,24 @@ bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribut std::shared_ptr aAttr = (*anIt); FeaturePtr aConstrFeature = std::dynamic_pointer_cast(aAttr->owner()); if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { + if (!isPointPointCoincidence(aConstrFeature)) + continue; + AttributeRefAttrPtr anAttrRefA = std::dynamic_pointer_cast( aConstrFeature->attribute(SketchPlugin_ConstraintCoincidence::ENTITY_A())); AttributeRefAttrPtr anAttrRefB = std::dynamic_pointer_cast( aConstrFeature->attribute(SketchPlugin_ConstraintCoincidence::ENTITY_B())); - if(anAttrRefA.get() && !anAttrRefA->isObject()) { - AttributePtr anAttrA = anAttrRefA->attr(); - if(aPointAttribute == anAttrA) { - aConstraintCoincidence = aConstrFeature; - break; - } + + AttributePtr anAttrA = anAttrRefA->attr(); + if(aPointAttribute == anAttrA) { + aConstraintCoincidence = aConstrFeature; + break; } - if(anAttrRefB.get() && !anAttrRefB->isObject()) { - AttributePtr anAttrB = anAttrRefB->attr(); - if(aPointAttribute == anAttrB) { - aConstraintCoincidence = aConstrFeature; - break; - } + + AttributePtr anAttrB = anAttrRefB->attr(); + if(aPointAttribute == anAttrB) { + aConstraintCoincidence = aConstrFeature; + break; } } }