Utilizing Native Revit Commands - Navigating Revit Dialogs with the API

Utilizing Native Revit Commands - Navigating Revit Dialogs with the API

rhanzlick
Advocate Advocate
754 Views
5 Replies
Message 1 of 6

Utilizing Native Revit Commands - Navigating Revit Dialogs with the API

rhanzlick
Advocate
Advocate

I am trying to create an External command that will launch the "Visibility/Graphic Overrides for ()" dialog for a view template.

With quite a lot of effort, research, and skimming JournalFiles, I have managed to figure out how to launch the native "Visibility/Graphic Overrides for (ActiveView)" dialog.

 

I would like to launch the "Visibility/Graphic Overrides for (ViewTemplate)" dialog with the API. Is there a way to do this? See below for a C# example method:

 

private void LaunchVG_VTDialog(UIApplication uiApp)

{

    //commandId for Visibility/GraphicsOverride dialog

    string commandId1 = "ID_VIEW_CATEGORY_VISIBILITY";

    

    uiapp.PostCommand(RevitCommandId.LookupCommandId(commandId1));

}

0 Likes
755 Views
5 Replies
Replies (5)
Message 2 of 6

franciscopossetto
Advocate
Advocate

Hey,

 

Here are listed all the commands you can execute:

https://www.revitapidocs.com/2020/f6ccdc1b-6ac3-9c49-d0bb-8a7d1877eab0.htm

 

I think this one is the closest to what you need:

uiApp.PostCommand(RevitCommandId.LookupPostableCommandId(PostableCommand.ManageViewTemplates));

 

But you have to select the template and the V/G option, what is basically the same to select it manually from the UI.

I am not aware if exist another way to do it. 

Github:
https://github.com/franpossetto
0 Likes
Message 3 of 6

rhanzlick
Advocate
Advocate
Thanks for your response Francis. I was aware of this command, and was
hoping there was a way to skip this (intermediate) step. (ie some way of
modifying these postable commands with some type of options or additional
settings).
Message 4 of 6

Moustafa_K
Collaborator
Collaborator

Does assigning and triggering keyboard shortcuts would help in this case ?

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes
Message 5 of 6

rhanzlick
Advocate
Advocate

I am open to keyboard shortcuts, just not aware of how one would assign them to this particular window.

0 Likes
Message 6 of 6

Sean_Page
Collaborator
Collaborator

I think this is what you are looking for.

 

uiapp.PostCommand(RevitCommandId.LookupPostableCommandId(PostableCommand.ApplyTemplatePropertiesToCurrentView));
Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes