Run External Command in Revit | 加入Revit外部指令
After we’ve created a simple message command, we can now register the compiled dynamic-link library file (.dll) into Revit program.
For doing that, we have to create an add-in file.
Second, where the assembly(.dll file), which we have compiled, is, and to which this add-in is linked. For the convenience of debugging, I’d directly point this add-in file to the one .dll which is in the debug directory, re-built from Visual Studio program.
Two important features as the following code are the FullClassName and AddInId tags. The former can be found by hovering your mouse cursor over the line in Visual Studio where type/class is declared and it is usually formed as “namespace.classname”. As to the later one, “AddInId”, it can be online generated, and each add-in file pointing to your Revit program, the assembly, must have a unique id number.
And then, a few essential attribute tags describing the command and the .dll file to register. More information about the add-in tags can be found by following the registration link above.
Finally, the tail tags for closing up the xml file.
Now save this file to the add-in folder, which usually is located at:
C:\Users\UserName\AppData\Roaming\Autodesk\Revit\Addins\2017
After the file is copying into this folder, if your Revit is running, a dialog window will pop-up asking if the add-in is to load, if not, start Revit and the pop-up will show up. After loading the add-in you can find the command button located in external command panel within the Add-In tab.