From a199afad5f6e7d6a1a30f259af8411a778c5e640 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sun, 11 Dec 2022 04:52:49 +0100 Subject: [PATCH] Sketcher: Solver - add map for Internal Alignment geometry --- src/Mod/Sketcher/App/Sketch.cpp | 13 +++++++++++++ src/Mod/Sketcher/App/Sketch.h | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index 86a92c2d51..4da4af28bc 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -111,6 +111,8 @@ void Sketch::clear() pDependencyGroups.clear(); solverExtensions.clear(); + internalAlignmentGeometryMap.clear(); + // deleting the geometry copied into this sketch for (std::vector::iterator it = Geoms.begin(); it != Geoms.end(); ++it) if (it->geo) delete it->geo; @@ -230,6 +232,8 @@ int Sketch::setUpSketch(const std::vector &GeoList, Base::Console().Log("\n"); #endif //DEBUG_BLOCK_CONSTRAINT + buildInternalAlignmentGeometryMap(ConstraintList); + addGeometry(intGeoList,onlyBlockedGeometry); int extStart=Geoms.size(); addGeometry(extGeoList, true); @@ -314,6 +318,15 @@ int Sketch::setUpSketch(const std::vector &GeoList, return GCSsys.dofsNumber(); } +void Sketch::buildInternalAlignmentGeometryMap(const std::vector &constraintList) +{ + for(auto* c : constraintList) { + if(c->Type==InternalAlignment){ + internalAlignmentGeometryMap[c->First]=c->Second; + } + } +} + void Sketch::fixParametersAndDiagnose(std::vector ¶ms_to_block) { if(!params_to_block.empty()) { // only there are parameters to fix diff --git a/src/Mod/Sketcher/App/Sketch.h b/src/Mod/Sketcher/App/Sketch.h index 32b31c1f23..4a666994dd 100644 --- a/src/Mod/Sketcher/App/Sketch.h +++ b/src/Mod/Sketcher/App/Sketch.h @@ -455,6 +455,9 @@ protected: // map of geoIds to corresponding solverextensions. This is useful when solved geometry is NOT to be assigned to the SketchObject std::vector> solverExtensions; + // maps a geoid corresponding to an internalgeometry (focus,knot,pole) to the geometry it defines (ellipse, hyperbola, B-Spline) + std::map< int, int > internalAlignmentGeometryMap; + std::vector < std::set < std::pair< int, Sketcher::PointPos>>> pDependencyGroups; // this map is intended to convert a parameter (double *) into a GeoId/PointPos and parameter number @@ -520,6 +523,8 @@ private: void clearTemporaryConstraints(); + void buildInternalAlignmentGeometryMap(const std::vector &constraintList); + int internalSolve(std::string & solvername, int level = 0); /// checks if the index bounds and converts negative indices to positive