Toponaming: Process mapped names during selection

This commit is contained in:
bgbsww
2024-07-11 15:41:36 -04:00
committed by Chris Hennes
parent d3fbb0e027
commit e07d940f5b
2 changed files with 11 additions and 1 deletions

View File

@@ -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<std::string> names; // searchElementCache isn't implemented.
if (names.size()) {
missing = false;
std::string newsub(subname, strlen(subname) - strlen(element));

View File

@@ -625,6 +625,17 @@ bool SoFCUnifiedSelection::setSelection(const std::vector<PickedInfo> &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<std::string, std::string> 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());