Part: added floating point fallback in PropertyLinks::_updateElementReference

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
This commit is contained in:
Yash Suthar
2025-12-17 21:54:35 +05:30
committed by Kacper Donat
parent d48073fbbf
commit dbd2bade1e
2 changed files with 8 additions and 2 deletions

View File

@@ -472,7 +472,11 @@ bool PropertyLinkBase::_updateElementReference(DocumentObject* feature,
// to version change, i.e. 'reverse', try search by geometry first
const char* oldElement = Data::findElementName(shadow.oldName.c_str());
if (!Data::hasMissingElement(oldElement)) {
const auto& names = geo->searchElementCache(oldElement);
auto names = geo->searchElementCache(oldElement);
if (names.empty()) {
// try floating point tolerance
names = geo->searchElementCache(oldElement, Data::SearchOptions());
}
if (names.size()) {
missing = false;
std::string newsub(subname, strlen(subname) - strlen(element));

View File

@@ -1578,9 +1578,11 @@ const std::vector<std::string>& Feature::searchElementCache(
break;
}
}
it->second.searched = true;
propShape->getShape()
.findSubShapesWithSharedVertex(it->second.shape, &it->second.names, options, tol, atol);
if (!it->second.names.empty()) {
it->second.searched = true;
}
if (prefix) {
for (auto& name : it->second.names) {
if (auto dot = strrchr(name.c_str(), '.')) {