Pick new Command

Pick new Command

tshunau
Contributor Contributor
414 Views
2 Replies
Message 1 of 3

Pick new Command

tshunau
Contributor
Contributor

I am trying to write an API that requires to trigger the pick new command. 

 

RevitCommandId RCID = RevitCommandId.LookupCommandId("Dialog_Family_FamInstGridDbar:Control_Family_PickHost");
uiapp.PostCommand(RCID);

 

However, when I try the code below. I get an error saying:

 

Revit encountered a Autodesk. Revit Exceptions.ArgumentException: The commandld must be in Autodesk.Revit.UI.PostabIeCommand or an external
command.Parameter name: commandld at Autodesk. Revit U U Application.PostCommand(RevitCommandId commandld)

 

Is there any reason why I can't do this?

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

devonpowell
Advocate
Advocate

It looks like the LookupCommandId wants the command GUID not the name. You can find the GUID in the add-in manifest, or the Revit journal. Read through this blog post for more info. 

Message 3 of 3

tshunau
Contributor
Contributor

It did display the ID when I use the lookup command.  So I don't believe that's the issue. 

 

Tak Au,

0 Likes