From 907ef395f4c57610c2e84e98c1bdb586c33f29dd Mon Sep 17 00:00:00 2001 From: Uwe Date: Wed, 9 Mar 2022 03:04:13 +0100 Subject: [PATCH] [Part] Section Cut: fix cut object naming issue --- src/Mod/Part/Gui/SectionCutting.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Mod/Part/Gui/SectionCutting.cpp b/src/Mod/Part/Gui/SectionCutting.cpp index 4801ad0285..fea27450ad 100644 --- a/src/Mod/Part/Gui/SectionCutting.cpp +++ b/src/Mod/Part/Gui/SectionCutting.cpp @@ -385,7 +385,7 @@ void SectionCut::startCutting(bool isInitial) || it->getObject()->getTypeId().isDerivedFrom(Base::Type::fromName("Part::FilletBase")) ) { // get possible links auto subObjectList = it->getObject()->getOutList(); - // if there links, delete them + // if there are links, delete them if (!subObjectList.empty()) { for (it2 = subObjectList.begin(); it2 != subObjectList.end(); ++it2) { for (it3 = ObjectsListCut.begin(); it3 != ObjectsListCut.end(); ++it3) { @@ -448,7 +448,12 @@ void SectionCut::startCutting(bool isInitial) int count = 0; for (auto itCuts = ObjectsListCut.begin(); itCuts != ObjectsListCut.end(); ++itCuts, count++) { // first create a link with a unique name - std::string newName = (*itCuts)->getNameInDocument(); + std::string newName; + // since links to normal Part objects all have the document name "Link", use their label text instead + if ((*itCuts)->getTypeId() == Base::Type::fromName("App::Link")) + newName = (*itCuts)->Label.getValue(); + else + newName = (*itCuts)->getNameInDocument(); newName = newName + "_CutLink"; auto newObject = doc->addObject("App::Link", newName.c_str());