With all my CommandMethods, the Comamnd Name shows to the left of all my prompts. Can I get that to clear so the prompts are like standard AutoCAD prompts?
Solved! Go to Solution.
Solved by deepak.a.s.nadig. Go to Solution.
Can you please help me understand the standard autocad command behaviour you are referring with an example ?
For example,running the command (code below)"GetIntegerOrKeywordFromUser", command name is displayed with the command prompt (image). Are you referring to this ?
[CommandMethod("GetIntegerOrKeywordFromUser")] public static void GetIntegerOrKeywordFromUser() { Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; PromptIntegerOptions pIntOpts = new PromptIntegerOptions(""); pIntOpts.Message = "\nEnter the size or "; // Restrict input to positive and non-negative values pIntOpts.AllowZero = false; pIntOpts.AllowNegative = false; // Define the valid keywords and allow Enter pIntOpts.Keywords.Add("Big"); pIntOpts.Keywords.Add("Small"); pIntOpts.Keywords.Add("Regular"); pIntOpts.Keywords.Default = "Regular"; pIntOpts.AllowNone = true; // Get the value entered by the user PromptIntegerResult pIntRes = acDoc.Editor.GetInteger(pIntOpts); if (pIntRes.Status == PromptStatus.Keyword) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Entered keyword: " + pIntRes.StringResult); } else { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Entered value: " + pIntRes.Value.ToString()); } }
Yes Deepak, you have it. Sorry I didn't include a screen shot. I would like to NOT have the original command showing in the command line when I prompt the user.
The name displayed on the left of the prompt in command line is local name of the command stack AcEdCommandStack object.This name is also displayed in drop-down while trying to type and run the command.
Unfortunately,there is no API to hide this name in the command prompt.
Looks like there is no helpful workaround as well.
Please note ,we can borrow the idea from the below link to dynamically modify the local name of custom .NET command(without modifying the global name) as shown in code below :
https://forums.autodesk.com/t5/net/commandmethod-name-shows-beside-all-prompts/m-p/8556226
static void ArxDynamicCommandFlag_SetCommandFlags(void) { AcEdCommandStack* pCmdStack = AcEdCommandStack::cast(acrxSysRegistry()->at(ACRX_COMMAND_DOCK)); AcEdCommand *pCmd = pCmdStack->lookupGlobalCmd(L"TestCommand"); AcRxFunctionPtr pFunc = pCmd->functionAddr(); ACHAR localName[31], globalName[31], groupName[31] = L"TestGroup"; _tcscpy(localName, pCmd->localName()); _tcscpy(globalName, pCmd->globalName()); ACHAR newlocalName[31] = L" "; // used to replace the local command name Acad::ErrorStatus errCode; errCode = pCmdStack->removeCmd(groupName, globalName); errCode = pCmdStack->addCommand(groupName, globalName,newlocalName, ACRX_CMD_MODAL, pFunc); }
Side effect of replacing local command name with a single space character is that local name does not get listed in
the drop-down while trying to type the command. However, the command can still be run using the global name and local name is replaced by single space character in the command prompt.
Thanks for the help, saves me from chasing rabbits trying to come up with a way.
edit : Link to be referred is below (wrongly updated link in the previous reply)
Can't find what you're looking for? Ask the community or share your knowledge.