diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp index 49ce006d39..9b3a0d4122 100644 --- a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp @@ -212,6 +212,8 @@ bool TaskLoftParameters::referenceSelected(const Gui::SelectionChanges& msg) con } else if (selectionMode == refRemove) { if (f != refs.end()) + // Removing just the object this way instead of `refs.erase` and + // `setValues(ref)` cleanly ensures subnames are preserved. loft->Sections.removeValue(obj); else return false; @@ -250,8 +252,9 @@ void TaskLoftParameters::onDeleteSection() App::DocumentObject* obj = loft->getDocument()->getObject(data.constData()); std::vector::iterator f = std::find(refs.begin(), refs.end(), obj); if (f != refs.end()) { - refs.erase(f); - loft->Sections.setValues(refs); + // Removing just the object this way instead of `refs.erase` and + // `setValues(ref)` cleanly ensures subnames are preserved. + loft->Sections.removeValue(obj); //static_cast(vp)->highlightReferences(false, true); recomputeFeature(); diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp index f8ba9836d3..9c3ca6ff1d 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp @@ -1042,6 +1042,8 @@ bool TaskPipeScaling::referenceSelected(const SelectionChanges& msg) const { } else { if (f != refs.end()) + // Removing just the object this way instead of `refs.erase` and + // `setValues(ref)` cleanly ensures subnames are preserved. pipe->Sections.removeValue(obj); else return false; @@ -1082,8 +1084,9 @@ void TaskPipeScaling::onDeleteSection() // if something was found, delete it and update the section list if (f != refs.end()) { - refs.erase(f); - pipe->Sections.setValues(refs); + // Removing just the object this way instead of `refs.erase` and + // `setValues(ref)` cleanly ensures subnames are preserved. + pipe->Sections.removeValue(obj); clearButtons(); recomputeFeature(); }