From e07d940f5b5274375b8f192cda81a979c152c04f Mon Sep 17 00:00:00 2001 From: bgbsww Date: Thu, 11 Jul 2024 15:41:36 -0400 Subject: [PATCH] Toponaming: Process mapped names during selection --- src/App/PropertyLinks.cpp | 1 - src/Gui/SoFCUnifiedSelection.cpp | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp index 5a354bfc23..589065e4a7 100644 --- a/src/App/PropertyLinks.cpp +++ b/src/App/PropertyLinks.cpp @@ -415,7 +415,6 @@ bool PropertyLinkBase::_updateElementReference(DocumentObject *feature, const char* oldElement = Data::findElementName(shadow.second.c_str()); if (!Data::hasMissingElement(oldElement)) { const auto& names = geo->searchElementCache(oldElement); -// std::vector names; // searchElementCache isn't implemented. if (names.size()) { missing = false; std::string newsub(subname, strlen(subname) - strlen(element)); diff --git a/src/Gui/SoFCUnifiedSelection.cpp b/src/Gui/SoFCUnifiedSelection.cpp index 62e2f5e15c..4c62bc7184 100644 --- a/src/Gui/SoFCUnifiedSelection.cpp +++ b/src/Gui/SoFCUnifiedSelection.cpp @@ -625,6 +625,17 @@ bool SoFCUnifiedSelection::setSelection(const std::vector &infos, bo std::string subName = info.element; std::string objectName = objname; +#ifdef FC_USE_TNP_FIX + // We need to convert the short name in the selection to a full element path to look it up + // Ex: Body.Pad.Face9 to Body.Pad.;g3;SKT;:H12dc,E;FAC;:H12dc:4,F;:G0;XTR;:H12dc:8,F.Face9 + std::pair elementName; + App::GeoFeature::resolveElement(vpd->getObject(), subName.c_str(), elementName); + if ( !elementName.first.empty()) { // If we have a mapped name use it + auto elementNameSuffix = Data::findElementName(subName.c_str()); // Only suffix + subName.erase(subName.find(elementNameSuffix)); // Everything except original suffix suffix + subName = subName.append(elementName.first); // Add the mapped name suffix, + } +#endif const char *subSelected = Gui::Selection().getSelectedElement( vpd->getObject(),subName.c_str());