X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Fillet.cpp;h=3373df8c6df0504ea4a39d8531c6cb8e5c534a10;hb=15fc1914159f4671968f56eb32d878a022edcd8b;hp=544ea99d65dbc6655d71150f48401d8273012d09;hpb=4aaeabe5e7586b259482c47557497244aaa0c746;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Fillet.cpp b/src/SketchPlugin/SketchPlugin_Fillet.cpp index 544ea99d6..3373df8c6 100644 --- a/src/SketchPlugin/SketchPlugin_Fillet.cpp +++ b/src/SketchPlugin/SketchPlugin_Fillet.cpp @@ -133,12 +133,12 @@ void SketchPlugin_Fillet::execute() FeaturePtr aConstraint; // Create coincidence features. - aConstraint = SketchPlugin_Tools::createConstraint(sketch(), + aConstraint = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), SketchPlugin_ConstraintCoincidence::ID(), aFilletArc->attribute(SketchPlugin_Arc::START_ID()), myBaseFeatures[aFeatInd[0]]->attribute(myFeatAttributes[anAttrInd[0]])); ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent); - aConstraint = SketchPlugin_Tools::createConstraint(sketch(), + aConstraint = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), SketchPlugin_ConstraintCoincidence::ID(), aFilletArc->attribute(SketchPlugin_Arc::END_ID()), myBaseFeatures[aFeatInd[1]]->attribute(myFeatAttributes[anAttrInd[1]])); @@ -146,7 +146,7 @@ void SketchPlugin_Fillet::execute() // Create tangent features. for (int i = 0; i < 2; i++) { - aConstraint = SketchPlugin_Tools::createConstraint(sketch(), + aConstraint = SketchPlugin_Tools::createConstraintObjectObject(sketch(), SketchPlugin_ConstraintTangent::ID(), aFilletArc->lastResult(), myBaseFeatures[i]->lastResult()); @@ -203,8 +203,17 @@ bool SketchPlugin_Fillet::calculateFilletParameters() if (!aFilletPoint2D.get()) return false; - std::set aFilletFeatures = - SketchPlugin_Tools::findFeaturesCoincidentToPoint(aFilletPoint2D); + std::set aCoincidentPoints = + SketchPlugin_Tools::findPointsCoincidentToPoint(aFilletPoint2D); + std::set aFilletFeatures; + for (std::set::iterator aCPIt = aCoincidentPoints.begin(); + aCPIt != aCoincidentPoints.end(); ++aCPIt) { + std::shared_ptr anOwner = + std::dynamic_pointer_cast( + ModelAPI_Feature::feature((*aCPIt)->owner())); + if (anOwner && !anOwner->isExternal()) + aFilletFeatures.insert(anOwner); + } if (aFilletFeatures.size() != 2) { setError("Error: Selected point does not have two suitable edges for fillet."); return false; @@ -332,12 +341,13 @@ FeaturePtr SketchPlugin_Fillet::createFilletApex(const GeomPnt2dPtr& theCoordina AttributePoint2DPtr aCoord = std::dynamic_pointer_cast( anApex->attribute(SketchPlugin_Point::COORD_ID())); aCoord->setValue(theCoordinates); + anApex->boolean(SketchPlugin_Point::AUXILIARY_ID())->setValue(true); // additional coincidence constraints static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); FeaturePtr aConstraint; for (int i = 0; i < 2; i++) { - aConstraint = SketchPlugin_Tools::createConstraint(sketch(), + aConstraint = SketchPlugin_Tools::createConstraintAttrObject(sketch(), SketchPlugin_ConstraintCoincidence::ID(), aCoord, myBaseFeatures[i]->lastResult()); @@ -416,7 +426,7 @@ void SketchPlugin_Fillet::removeReferencesButKeepDistances( AttributePoint2DPtr aFlyoutAttr = std::dynamic_pointer_cast( aLength->attribute(SketchPlugin_ConstraintLength::FLYOUT_VALUE_PNT())); if (aFlyoutAttr && aFlyoutAttr->isInitialized()) - aNewLength.myFlyoutPoint = aFlyoutAttr->pnt(); + aNewLength.myFlyoutPoint = SketchPlugin_Tools::flyoutPointCoordinates(aLength); AttributeIntegerPtr aLocationAttr = aLength->integer(SketchPlugin_ConstraintLength::LOCATION_TYPE_ID()); if (aLocationAttr && aLocationAttr->isInitialized()) @@ -438,7 +448,7 @@ void SketchPlugin_Fillet::removeReferencesButKeepDistances( FeaturePtr aConstraint; std::list::iterator anIt = aLengthToDistance.begin(); for (; anIt != aLengthToDistance.end(); ++anIt) { - aConstraint = SketchPlugin_Tools::createConstraint(sketch(), + aConstraint = SketchPlugin_Tools::createConstraintAttrAttr(sketch(), SketchPlugin_ConstraintDistance::ID(), anIt->myPoints[0], anIt->myPoints[1]); // set value AttributeDoublePtr aValue = aConstraint->real(SketchPlugin_Constraint::VALUE()); @@ -555,7 +565,7 @@ double calculateFilletRadius(FeaturePtr theFilletFeatures[2]) if (anEdge) aLengths[i] = anEdge->length(); } - return std::min(aLengths[0], aLengths[1]) / 6.0; + return (aLengths[0] < aLengths[1] ? aLengths[0] : aLengths[1]) / 6.0; } std::set findFeaturesToRemove(const FeaturePtr theFeature,