From 69d62787eb1d3a64d97236c80502a45697c54f4e Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Thu, 1 Nov 2018 16:10:29 +0100 Subject: [PATCH] Sketcher: Intercurve fillet Improvement and delete constraint on point fix ========================================================================== Intercurve fillet uses endpoint constraints for improved accuracy, but before this commit was only considering a coincident constraint. Now it also considers an endpoint tangency or perpendicular. delConstraintOnPoint with coincidentonly=false, was not checking endpoint perpendiculars and would therefore fail to delete them. https://forum.freecadweb.org/viewtopic.php?f=3&t=31594&start=30#p265731 --- src/Mod/Sketcher/App/SketchObject.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index e94e1d90cd..35d381d8ad 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -1153,7 +1153,7 @@ int SketchObject::delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoinc continue; // skip this constraint } } - else if ((*it)->Type == Sketcher::Tangent) { + else if ((*it)->Type == Sketcher::Tangent || (*it)->Type == Sketcher::Perpendicular) { if (((*it)->First == GeoId && (*it)->FirstPos == PosId) || ((*it)->Second == GeoId && (*it)->SecondPos == PosId)) { // we could keep the tangency constraint by converting it @@ -1450,8 +1450,9 @@ int SketchObject::fillet(int GeoId1, int GeoId2, const std::vector &constraints = this->Constraints.getValues(); for (std::vector::const_iterator it=constraints.begin(); it != constraints.end(); ++it) { - if ((*it)->Type == Sketcher::Coincident) { - if ((*it)->First == GeoId1 && (*it)->Second == GeoId2) { + if ((*it)->Type == Sketcher::Coincident || (*it)->Type == Sketcher::Perpendicular || (*it)->Type == Sketcher::Tangent) { + if ((*it)->First == GeoId1 && (*it)->Second == GeoId2 && + (*it)->FirstPos != Sketcher::none && (*it)->SecondPos != Sketcher::none ) { Base::Vector3d tmpp1 = getPoint((*it)->First,(*it)->FirstPos); Base::Vector3d tmpp2 = getPoint((*it)->Second,(*it)->SecondPos); double tmpdist = distancetorefpoints(tmpp1, @@ -1465,7 +1466,8 @@ int SketchObject::fillet(int GeoId1, int GeoId2, interpoints = std::make_pair(tmpp1,tmpp2); } } - else if ((*it)->First == GeoId2 && (*it)->Second == GeoId1) { + else if ((*it)->First == GeoId2 && (*it)->Second == GeoId1 && + (*it)->FirstPos != Sketcher::none && (*it)->SecondPos != Sketcher::none ) { Base::Vector3d tmpp2 = getPoint((*it)->First,(*it)->FirstPos); Base::Vector3d tmpp1 = getPoint((*it)->Second,(*it)->SecondPos); double tmpdist = distancetorefpoints(tmpp1,