App::Link : add getLinkGroup() to ElementLink
This commit is contained in:
committed by
Yorik van Havre
parent
1822312127
commit
5cb2fd5261
@@ -2309,6 +2309,24 @@ bool LinkElement::canDelete() const {
|
||||
return !owner || !owner->getDocument()->getObjectByID(_LinkOwner.getValue());
|
||||
}
|
||||
|
||||
App::Link* LinkElement::getLinkGroup() const
|
||||
{
|
||||
std::vector<App::DocumentObject*> inList = getInList();
|
||||
for (auto* obj : inList) {
|
||||
auto* link = dynamic_cast<App::Link*>(obj);
|
||||
if (!link) {
|
||||
continue;
|
||||
}
|
||||
std::vector<App::DocumentObject*> elts = link->ElementList.getValues();
|
||||
for (auto* elt : elts) {
|
||||
if (elt == this) {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace App {
|
||||
|
||||
@@ -599,6 +599,8 @@ public:
|
||||
{
|
||||
_handleChangedPropertyName(reader,TypeName,PropName);
|
||||
}
|
||||
|
||||
App::Link* getLinkGroup() const;
|
||||
};
|
||||
|
||||
using LinkElementPython = App::FeaturePythonT<LinkElement>;
|
||||
|
||||
Reference in New Issue
Block a user