Search code examples
.netrevit-apirevit

How to include linked files in the postable command: tagallnottagged?


I would like to tag all objects not tagged, including all linked files. Within the Annotation section, this is fairly easy as you can 'Tag All' and select 'Include elements from linked files'.

enter image description here

However, I would like to create a macro which automates this process. You can call a postable command, but I'm struggling to find out out how to include the linked files in the script.

Suggestions?

public void PostableCommands()
    {
        RevitCommandId id_buit_in
            = RevitCommandId.LookupPostableCommandId(
                PostableCommand.TagAllNotTagged );
    }

Solution

  • Yes.

    As you have noticed, the Revit API PostCommand method just launches the standard built-in Revit manual end user interface command and does not enable you to set any options programmatically.

    However, you can use the Windows API to detect when the 'tag all not tagged' form is displayed and automatically check the required box before programmatically clicking OK.

    You can adapt my JtClicker utility described in The Building Coder article on dismissing a dialogue using Windows API to achieve what you need.