diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 38874cff5c..11be38ec7d 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -5568,6 +5568,61 @@ void SketchObject::appendRedundantMsg(const std::vector &redundant, std::st msg = ss.str(); } +void SketchObject::getGeometryWithDependentParameters(std::vector>& geometrymap) +{ + auto geos = getInternalGeometry(); + + GCS::QRAlgorithm curQRAlg = getSolvedSketch().getQRAlgorithm(); + + if(curQRAlg == GCS::EigenSparseQR) { + getSolvedSketch().setQRAlgorithm(GCS::EigenDenseQR); + solve(false); + } + + auto addelement = [this,&geometrymap](int geoId, PointPos pos = Sketcher::none){ + if(getSolvedSketch().hasDependentParameters(geoId, pos)) + geometrymap.emplace_back(geoId,pos); + }; + + + int geoid = 0; + + for(auto geo : geos) { + if(geo->getTypeId() == Part::GeomPoint::getClassTypeId()) { + addelement(geoid, Sketcher::start); + } + else if(geo->getTypeId() == Part::GeomLineSegment::getClassTypeId() || + geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) { + + addelement(geoid, Sketcher::start); + addelement(geoid, Sketcher::end); + addelement(geoid); + } + else if(geo->getTypeId() == Part::GeomCircle::getClassTypeId() || + geo->getTypeId() == Part::GeomEllipse::getClassTypeId() ) { + + addelement(geoid, Sketcher::mid); + addelement(geoid); + } + else if(geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId() || + geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() || + geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId() || + geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId() ) { + + addelement(geoid, Sketcher::start); + addelement(geoid, Sketcher::end); + addelement(geoid, Sketcher::mid); + addelement(geoid); + } + + geoid++; + } + + if(curQRAlg == GCS::EigenSparseQR) { + getSolvedSketch().setQRAlgorithm(GCS::EigenSparseQR); + } +} + bool SketchObject::evaluateConstraint(const Constraint *constraint) const { //if requireXXX, GeoUndef is treated as an error. If not requireXXX, diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index bfc648ddc3..2496c82f69 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -316,6 +316,10 @@ public: inline const std::vector &getLastRedundant(void) const { return lastRedundant; } /// gets the solved sketch as a reference inline Sketch &getSolvedSketch(void) {return solvedSketch;} + + /// returns the geometric elements/vertex which the solver detects as having dependent parameters. + /// these parameters relate to not fully constraint edges/vertices. + void getGeometryWithDependentParameters(std::vector>& geometrymap); /// Flag to allow external geometry from other bodies than the one this sketch belongs to bool isAllowedOtherBody() const {