Possible to do an external command (non Pyrevit ) through pyrevit?

Possible to do an external command (non-Pyrevit) through pyrevit? for example, run an ideate addin after executing the pyrevit code.

  1. Launch the command in the Revit UI
  2. Look at the end of the journal file
  3. you will find something like Execute external command and what is following between the two : can be taken to replace the string in the last line of the following sample
# encoding: utf-8

from pyrevit import HOST_APP, UI

uiapp = HOST_APP.uiapp

uiapp.PostCommand(UI.RevitCommandId.LookupCommandId("CustomCtrl_%CustomCtrl_%CustomCtrl_%Add-Ins%Revit Lookup%Options%RevitLookup.Commands.SnoopActiveViewCommand"))

for Reference, read the following https://jeremytammik.github.io/tbc/a/1040_postcommand.htm
and see code samples in C# here
GitHub - jeremytammik/PostAddinCommand: Test programmatic posting of an external command defined by a custom Revit add-in.


@Jean-Marc - does this not work for addins loaded outside of the “Addins” tab? - having issues with any other kind of addins

in my tests yes, it did work

mind sharing one of the tests you did that isn’t pointed to the addins?
i believe it would be a formatting error for me


# encoding: utf-8

from pyrevit import HOST_APP, UI

uiapp = HOST_APP.uiapp

uiapp.PostCommand(UI.RevitCommandId.LookupCommandId("CustomCtrl_%CustomCtrl_%DiRootsOne%Data IO%SheetLink"))

Is this the same thing to launch Revit command ? Like in the following journal for example ?

 'E 08-Mar-2023 13:24:20.300;   0:< 
  Jrn.Command "Ribbon"  , "Gère les positions du projet , ID_GEO_MANAGE_LOCATIONS" 
  ' 0:< Unnecessary nesting;ArrowUI_4;-1;ID_GEO_MANAGE_LOCATIONS ;N++EB(NB); 
  ' 0:< ::523:: Delta VM: Avail -3 -> 134125114 MB, Used +22 -> 3106 MB; RAM: Avail +5 -> 16906 MB, Used +22 -> 1851 MB 
  ' 0:< GUI Resource Usage GDI: Avail 9027, Used 973, User: Used 656 
  'H 08-Mar-2023 13:24:21.562;   0:< 

No, a Revit builtin command is a PostableCommand

and doc ApiDocs.co

there is the PostableCommand enumeration
try the <> at the top right of the page for samples

When running a command like this from my computer it works perfectly. I am trying to automate and schedule the process using a remote computer and a software called Clarity which opens the revit model and runs the Pyrevit script however, when the remote computer runs the script it returns this error in the log form. Below is the code followed by the error.

from pyrevit import HOST_APP, UI
from Autodesk.Revit.UI import UIApplication, RevitCommandId, PostableCommand

uiapp = HOST_APP.uiapp

Script Execution Did Not Succeed: Failed Message: IronPython Traceback:
Traceback (most recent call last):
  File "\\MURPHYCAD3\CAD_Support-r14\Revit\Imaginit Clarity\GTPSilentPublish\script.py", line 45, in 
Exception: Value cannot be null.
Parameter name: commandId

The GUID you are feeding corresponds to what command? @Icomerford