Execute CUI Ribbon Button Without Displaying Command Name in Command Prompt

Execute CUI Ribbon Button Without Displaying Command Name in Command Prompt

santhoshr151194
Contributor Contributor
256 Views
2 Replies
Message 1 of 3

Execute CUI Ribbon Button Without Displaying Command Name in Command Prompt

santhoshr151194
Contributor
Contributor

I have written custom commands using C# and added them as buttons in the CUI Ribbon. Is there an way execute command without displaying its command name in the command prompt.

0 Likes
257 Views
2 Replies
Replies (2)
Message 2 of 3

_gile
Consultant
Consultant

Hi,

If you call this command using Editor.Command, you can temporary set the CMDECHO system variable to 0.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 3

ActivistInvestor
Mentor
Mentor

@santhoshr151194 wrote:

I have written custom commands using C# and added them as buttons in the CUI Ribbon. Is there an way execute command without displaying its command name in the command prompt.


Since your button click handlers run code in the application context, where the Editor's Command() method cannot be called directly without using ExecuteInCommandContextAsync() (which I don't recommend if it is only for the purpose of starting a command, without supplying parameters or additional input), you can just use the Document's SendStringToExecute() method to start your command, which has an argument indicating if the input should be echoed to the command line.

 

Another way to do this is to derive your buttons from Autodesk.AutoCAD.Ribbon.RibbonCommandButton, which has a Macro property that you can assign to the name of your command. 

0 Likes