API usage restrictions
In general, using the Revit API has the following limitations:
- To run the Revit API application, you need to log in as a system administrator.
- All new commands, menus, etc. must be set before Revit is started. Revit does not support dynamic addition and deletion of commands during operation.
- External commands can only be started when no other commands or edit mode is active and the current document is not a family file.
- The external command object is created when execution starts and is destroyed when execution is completed. Therefore, if you want the data generated when the external command is executed to still be available after the command ends, you need to use the Revit shared parameter mechanism or some other method.
Reasons of restriction
Regarding the first limitation, the main reason is that in order to keep the registry as clean as possible, Revit will clear the content registered at startup when exiting. Therefore, if you do not have administrator rights, the application is likely to fail or run abnormally. The advantage of this is that different versions of Revit can be run on the same computer. The disadvantage of course is that it increases restrictions.
How to use API applications in normal user mode
If the user can only run the application with non-administrator privileges, he or she can first perform the following steps as a system administrator:
- Install Revit.
- Set all files in the Revit installation directory and its subdirectories to be fully controllable by all users.
- Edit the Revit.ini file in the Program subdirectory of the Revit installation directory (hereinafter referred to as the Revit Program directory) and add the following text:
- Install third-party Revit API-based applications.
- Run Revit and execute external commands to ensure it runs correctly.
The administrator can then log out and other users can successfully use external commands.