Part Design: Add sketch sub element names for refs in revolutions (#26227)

* part design: partdesign: pd: fix regression issue #26223 add sketch sub element names for refs in revolutions

* refractor code to remove else blocks as every condition has a return statement, make lsp happy
This commit is contained in:
Chris
2025-12-22 07:56:53 -06:00
committed by GitHub
parent d9e0fd6251
commit 452f9b2087

View File

@@ -370,14 +370,20 @@ QString getRefStr(const App::DocumentObject* obj, const std::vector<std::string>
return {};
}
if (PartDesign::Feature::isDatum(obj) || obj->isDerivedFrom<Part::Part2DObject>()) {
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<Part::Part2DObject>()) {
// only return bare name for sketches when no subelement is specified
return QString::fromLatin1(obj->getNameInDocument());
}
return {};
}