I have a push button in a Revit plug-in. When I click on it I would like to invoke two different commands (custom commands). Is that possible?
I use Revit 2012 Architecture API and my platform is C# .NET
I have a push button in a Revit plug-in. When I click on it I would like to invoke two different commands (custom commands). Is that possible?
I use Revit 2012 Architecture API and my platform is C# .NET
If your two commands are IExternalCommand implementations then certainly.
Create another IExternalCommand interface, and just have it call the entry points of the two commands you want (same as calling any other class method).
You may need to ensure that your transaction management is correct between the three commands.
Agreed. If you are wanting one single UI button to invoke (2) separate IExternalCommands, then you need to implement some sort of logic in a single IExternalCommand to read a state of some sort and then execute your desired Method based on the result of the state.
You might also want to initialize the state of your variable in your App.cs OnStartup() method to reset each time Revit is opened.
If you're using the Revit 2012 API calling the entry points of the required commands is the only way I see. You may consider upgrading to the Revit 2014 API or later though, as they have provided an approach to External Commands.