From aa1122c774aa5143d8a2697ce27bf59f9353e828 Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Sun, 5 Jan 2025 11:42:37 +0530 Subject: [PATCH] [Sketcher] Fix "used" B-spline poles being deleted --- src/Mod/Sketcher/App/SketchObject.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index bb67d49fd3..6bc5e6f24f 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -6728,6 +6728,7 @@ int SketchObject::deleteUnusedInternalGeometryWhenBSpline(int GeoId, bool delgeo std::vector delgeometries; + // TODO: This can become significantly costly if there are lots of constraints and poles for (auto& [cpGeoId, numConstr] : poleGeoIdsAndConstraints) { if (cpGeoId == GeoEnum::GeoUndef) { continue; @@ -6735,7 +6736,13 @@ int SketchObject::deleteUnusedInternalGeometryWhenBSpline(int GeoId, bool delgeo // look for a circle at geoid index for (auto const& constr : vals) { + if (constr->Type == Sketcher::InternalAlignment + || constr->Type == Sketcher::Weight + || !constr->involvesGeoId(cpGeoId)) { + continue; + } if (constr->Type != Sketcher::Equal) { + ++numConstr; continue; } bool firstIsInCPGeoIds = std::any_of(poleGeoIdsAndConstraints.begin(), @@ -6756,7 +6763,7 @@ int SketchObject::deleteUnusedInternalGeometryWhenBSpline(int GeoId, bool delgeo // because the radius magnitude no longer makes sense without the B-Spline. } - if (numConstr < 2) { // IA + if (numConstr < 1) { // IA delgeometries.push_back(cpGeoId); } }