diff --git a/src/App/Link.cpp b/src/App/Link.cpp index 174548f676..12fb793b9f 100644 --- a/src/App/Link.cpp +++ b/src/App/Link.cpp @@ -2309,6 +2309,24 @@ bool LinkElement::canDelete() const { return !owner || !owner->getDocument()->getObjectByID(_LinkOwner.getValue()); } +App::Link* LinkElement::getLinkGroup() const +{ + std::vector inList = getInList(); + for (auto* obj : inList) { + auto* link = dynamic_cast(obj); + if (!link) { + continue; + } + std::vector elts = link->ElementList.getValues(); + for (auto* elt : elts) { + if (elt == this) { + return link; + } + } + } + return nullptr; +} + ////////////////////////////////////////////////////////////////////////////////////////// namespace App { diff --git a/src/App/Link.h b/src/App/Link.h index 606fc3f3e4..4dcb433ee6 100644 --- a/src/App/Link.h +++ b/src/App/Link.h @@ -599,6 +599,8 @@ public: { _handleChangedPropertyName(reader,TypeName,PropName); } + + App::Link* getLinkGroup() const; }; using LinkElementPython = App::FeaturePythonT;