How to scope Tree Objects via ACT?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 452
100 Answers 250 Likes 100 Comments First Anniversary
✭✭✭✭
edited June 2023 in Structures

How to scope Tree Objects via ACT?

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 452
    100 Answers 250 Likes 100 Comments First Anniversary
    ✭✭✭✭
    Answer ✓

    I couldn't find a direct property control value to enforce this, but one can use a workaround by setting the property to read only and scope the selected objects using an callback. The custom should be clicked (from the toolbar ribbon) after selecting the tree objects.

    XML:

    <property name="Selection" caption="Selection" control="selection" readonly="true">
        <callbacks>
            <onadd>ScopeSelectedEntities</onadd>
        </callbacks>
    </property>
    

    Python:

    def ScopeSelectedEntities(load, property):
        global my_property
        my_property = property
        property.Value = ExtAPI.DataModel.Tree.ActiveObjects