Rebar.SetPresentationMode(currentView, RebarPresentationMode.Select);
ID_REBAR_PRESENTATION_SELECT
Dialog_Rebar_EditRebarSelectionDialogBar:Control_Rebar_EditRebarSelectHideAll
but if I try to use them in my code
var cmdId = RevitCommandId.LookupCommandId(name);
uiapp.PostCommand(cmdId);
I get the exception
The commandId must be in Autodesk.Revit.UI.PostableCommand or an external command
Indeed, I can't find similar items in the PostableCommand enumeration.
Is there a way to get the correct command IDs for these buttons?
You may be able to achieve what you wish by using a combination of PostCommand the the native Windows API or the .NET UI Automation library to simulate some very well-defined and minimal user input, such as clicking a specific button or so. You can take a look at some examples of surprising things that people have achieved in the past in The Building Code Automation category:
https://thebuildingcoder.typepad.com/blog/automation
Hi @jeremy_tammik , thanks as always for your response!
I took a look at the articles of the link you posted, they have been somewhat useful, however:
I found this stackoverflow question with the same problem on a different togglebutton, but unfortunately nobody got an answer for it.
I tried to use Power Automate Desktop and record the clicks on the buttons;
It records the same IDs that I found, except it seems to cast the ToggleButton as a Button;
when I try to playback the flow however, nothing happens: it waits forever at the "Press button in window" step
I'm only left with the suspicion that there's some Revit UI sourcery involved here!
Well, if you want to go deeper still down the rabbit hole of Windows hacking, you may possibly be able to use the native Windows API to determine the native Windows button underlying all the .NET wrapper stuff and simulate a click on that. Have you looked at JtClicker yet? I am sure you can go deeper still...
Can't find what you're looking for? Ask the community or share your knowledge.