diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 7201e7bb11..4abae2d918 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -146,6 +146,7 @@ SketchObject::SketchObject() internaltransaction=false; managedoperation=false; + deletinginternalgeometry=false; } SketchObject::~SketchObject() @@ -955,6 +956,11 @@ int SketchObject::delGeometry(int GeoId, bool deleteinternalgeo) geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId())) { this->deleteUnusedInternalGeometry(GeoId, true); + + Geometry.touch(); + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); return 0; } } @@ -997,10 +1003,12 @@ int SketchObject::delGeometry(int GeoId, bool deleteinternalgeo) this->Constraints.setValues(std::move(newConstraints)); } // Update geometry indices and rebuild vertexindex now via onChanged, so that ViewProvider::UpdateData is triggered. - Geometry.touch(); + if(!deletinginternalgeometry) { + Geometry.touch(); - if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver - solve(); + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); + } return 0; } @@ -4971,6 +4979,8 @@ int SketchObject::exposeInternalGeometry(int GeoId) int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid) { + Base::StateLocker lock(deletinginternalgeometry, true); + if (GeoId < 0 || GeoId > getHighestCurveIndex()) return -1; @@ -5225,10 +5235,8 @@ int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid) } } - // ignore weight constraints - else if (((*itc)->Type!=Sketcher::Weight) && ( (*itc)->Second == (*it) || (*itc)->First == (*it) || (*itc)->Third == (*it)) ) { - (*ita)++; - } + // We do not ignore weight constraints as we did with radius constraints, because the radius magnitude no longer makes sense + // without the B-Spline. } if ( (*ita) < 2 ) { // IA diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index 9d0611839e..6fd1577012 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -511,6 +511,8 @@ private: bool internaltransaction; bool managedoperation; // indicates whether changes to properties are the deed of SketchObject or not (for input validation) + + bool deletinginternalgeometry; // sets a lock to deletinginternalgeometryoperation so that no individual triggers are perform on each element. }; typedef App::FeaturePythonT SketchObjectPython;