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

How to assign multiple command from commandMethod

2 REPLIES 2
Reply
Message 1 of 3
kite15
544 Views, 2 Replies

How to assign multiple command from commandMethod

Hi, Can any one help me how to assign multiple command from commandMethod...

 

******************************************************************************

[CommandMethod("CA", "CT", "CD", "CB", CommandFlags.Modal)]

static public void CommonCommandOfC()

{

  xxxxxx

}

**********************************************************

 

Thanks in advance

2 REPLIES 2
Message 2 of 3
Keith.Brown
in reply to: kite15

 

 

@kite15 wrote:

Hi, Can any one help me how to assign multiple command from commandMethod...

 

******************************************************************************

[CommandMethod("CA", "CT", "CD", "CB", CommandFlags.Modal)]

static public void CommonCommandOfC()

{

  xxxxxx

}

**********************************************************

 

Thanks in advance


You cannot do that in the manner that you are showing.

 

If you need to define multiple commands to do something in code then you need to define each command individually and then have the code call a single method which performs the logic of the command.



[CommandMethod("CA", CommandFlags.Modal)]
static public void CommandCa()
{
     CommandCommon()
}

[CommandMethod("CT", CommandFlags.Modal)]
static public void CommandCT()
{
     CommandCommon()
}

[CommandMethod("CD", CommandFlags.Modal)]
static public void CommandCD()
{
     CommandCommon()
}

[CommandMethod("CB", CommandFlags.Modal)]
static public void CommandCB()
{
     CommandCommon()
}

static private void CommandCommon()
{
     //  Place command logic here.
}

A more Autocad way of doing it would to be to create a single command and then define command aliases to call the command in a different manner without any coding at all.

 

You can read about command aliases here.

Message 3 of 3
kite15
in reply to: Keith.Brown

ThankYou...Will follow this

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost