[CONNECT C++] DgnElementSetTool: Query Elements in Reference Attachments

My query tool inherits from DgnElementSetTool.  It works fine for elements in the active model, but what should I do to enable it to locate elements in a reference?

Currently the tool shows a pop-up Element in reference that is not currently active or Element is in a ReadOnly ref.  

Parents Reply Children
  • Just wanted to add a couple things that probably aren't obvious.

    DgnElementSetTool establishes the locate criteria in _SetLocateCriteria (which is called from _BeginPickElements for pick and _BuildAgenda for fences and selection sets). This is the place to add any tool specific locate criteria as opposed to _OnPostInstall.

    Returning false from _IsModifyOriginal allows locked/reference elements to be selected as it puts DgnElementSetTool into copy mode. For a query only tool this can have the undesirable side-effect of cloning styles, etc. from the source to the destination.

    To avoid this, a query tool should override _OnPreElementModify. If you return SUCCESS without calling super, _OnElementModify will still be called if that's were you want to have your logic to extract information from the selected elements.

    virtual StatusInt _OnElementModify (EditElementHandleR eeh) override {return ERROR;} // Query tool doesn't modify elements...
    virtual StatusInt _OnPreElementModify (EditElementHandleR eeh) override {return SUCCESS;} // Don't copy styles, etc. from reference to active...
    virtual bool _IsModifyOriginal () override {return false;} // Allow selection of locked/reference elements

    HTH

    -B