.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CommandMethod Name shows beside all prompts

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
dennis
720 Views, 5 Replies

CommandMethod Name shows beside all prompts

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?

 

5 REPLIES 5
Message 2 of 6
deepak.a.s.nadig
in reply to: dennis

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());
    }
}

commandNamePromt.JPG

Message 3 of 6
dennis
in reply to: deepak.a.s.nadig

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.

Message 4 of 6
deepak.a.s.nadig
in reply to: dennis

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. 

Message 5 of 6
dennis
in reply to: deepak.a.s.nadig

Thanks for the help, saves me from chasing rabbits trying to come up with a way.

Message 6 of 6

edit : Link to be referred is below (wrongly updated link in the previous reply) 

https://adndevblog.typepad.com/autocad/2012/05/setting-the-command-flags-of-my-net-applications-comm...

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report