How to get the parameter value of LookUpCommandId(string name)?

How to get the parameter value of LookUpCommandId(string name)?

Anonymous
Not applicable
2,281 Views
7 Replies
Message 1 of 8

How to get the parameter value of LookUpCommandId(string name)?

Anonymous
Not applicable

I try many times,but the LookUpCommandId(string name) just return null.

 

0 Likes
Accepted solutions (1)
2,282 Views
7 Replies
Replies (7)
Message 2 of 8

PhillipM
Advocate
Advocate

Try something like this

 

app.PostCommand(Autodesk.Revit.UI.RevitCommandId.LookupPostableCommandId(Autodesk.Revit.UI.PostableCommand.Whatever here.....))

 

Cheers

Phillip

0 Likes
Message 3 of 8

Joe.Ye
Alumni
Alumni
Hello, Which command do you want to get its command id?


Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 4 of 8

Anonymous
Not applicable

Thanks!

but I lookup the Command ,which added by Add-In method

0 Likes
Message 5 of 8

Anonymous
Not applicable
The Command added by Add-in method.
I want to get the current RibbonButton's name when clicked it!
0 Likes
Message 6 of 8

Anonymous
Not applicable
Accepted solution

Hi,

 

Did you try using the ClientId as name ? Something like this :

 

// External commands defined by add-ins are 
  // identified by the client id specified in 
  // the add-in manifest
 
  string name
    = "64b3d907-37cf-4cab-8bbc-3de9b66a3efa";
 
  RevitCommandId id_addin
    = RevitCommandId.LookupCommandId(
      name );

 

Please refer to this blog post of my colleague Jeremy :

 

http://thebuildingcoder.typepad.com/blog/2013/10/programmatic-custom-add-in-external-command-launch....

 

Hope this helps.

Thanks,

Partha

0 Likes
Message 7 of 8

Anonymous
Not applicable

Thanks very much!

!

0 Likes
Message 8 of 8

paolomod3nese
Enthusiast
Enthusiast

Just a heads up for anyone: if you're trying to get a command defined in a custom button, the answer also on the same post outlined by Partha (https://thebuildingcoder.typepad.com/blog/2013/10/programmatic-custom-add-in-external-command-launch...)

  // External tool commands defined by add-ins are
  // identified by the string listed in the 
  // journal file when the command is launched 
  // manually.
 
  string name_addin_button_cmd
    = "CustomCtrl_%CustomCtrl_%"
      + "Add-Ins%Post Add-in Command%Dummy2";
 
  RevitCommandId id_addin_button_cmd
    = RevitCommandId.LookupCommandId(
      name_addin_button_cmd );
 
  uiapp.PostCommand( id_addin_button_cmd );

 

0 Likes