Post command doesn't execute command after panel was hidden

Post command doesn't execute command after panel was hidden

Anonymous
Not applicable
2,795 Views
22 Replies
Message 1 of 23

Post command doesn't execute command after panel was hidden

Anonymous
Not applicable

Hi,

 

I'm having trouble with getting a command to execute using an external event. I'll explain.

 

I have an app that creates a ribbon tab, a panel and a button which executes a command. Now I also have a button that I add to an existing tab. That button should execute the same command as the button in my own panel, so I use UIApplication.PostCommand.

 

This seems to work well, except when my own ribbon panel was hidden. I want to hide that panel when there is no active project, and show it when there is. For some reason, the command just doesn't get executed in this case. When I lookup the command using RevitCommandId.LookupCommandId, I do get a valid RevitCommandId.

 

I've attached a sample (VS2015) project demonstrating the issue. If you run it, everything works. If you uncomment line 32 in TestCommandRibbon.cs, the command won't get executed anymore.

 

Can someone explain me what's going on, and possible help me with a solution? Thanks in advance.

0 Likes
2,796 Views
22 Replies
Replies (22)
Message 21 of 23

jeremy_tammik
Alumni
Alumni

Do you have a corresponding issue ticket number for me? If not, the development team may not be aware of any problem at all. If no number is known, you might want to create and share a complete minimal reproducible case for them to analyse to determine whether they see a problem at all, and explore how it might be fixed:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 22 of 23

ModPlus
Enthusiast
Enthusiast

I made a test project (Revit 2024). It adds a tab and two panels - with demo command and with test commands. I was about to demonstrate the problem, but I ran into another problem - even if the button is visible on the ribbon, the command still doesn't run.

This is giving me a headache...

0 Likes
Message 23 of 23

ModPlus
Enthusiast
Enthusiast

@jeremy_tammik any ideas?

0 Likes