diff --git a/src/Mod/PartDesign/Gui/ReferenceSelection.cpp b/src/Mod/PartDesign/Gui/ReferenceSelection.cpp index ba2abaf0b7..5c86f5ec23 100644 --- a/src/Mod/PartDesign/Gui/ReferenceSelection.cpp +++ b/src/Mod/PartDesign/Gui/ReferenceSelection.cpp @@ -370,14 +370,20 @@ QString getRefStr(const App::DocumentObject* obj, const std::vector return {}; } - if (PartDesign::Feature::isDatum(obj) || obj->isDerivedFrom()) { + if (PartDesign::Feature::isDatum(obj)) { return QString::fromLatin1(obj->getNameInDocument()); } - else if (!sub.empty()) { + + if (!sub.empty() && !sub.front().empty()) { return QString::fromLatin1(obj->getNameInDocument()) + QStringLiteral(":") + QString::fromLatin1(sub.front().c_str()); } + if (obj->isDerivedFrom()) { + // only return bare name for sketches when no subelement is specified + return QString::fromLatin1(obj->getNameInDocument()); + } + return {}; }