For doing that, we have to create an add-in file.
An add-in file is a .xml file telling Revit where to load the external command or external application. In our case, a simple message, it’s an external command. First of all, a declaration of the add-in file in xml format for “RevitAddIns” tag:
<?xml version="1.0" encoding="utf-8"?> <RevitAddIns> <AddIn Type="Command">
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.
<Text>Level01: Revit Returns A Simple Message</Text> <VendorId>TYB</VendorId> <VendorDescription>tailoryourbim.com</VendorDescription> <VisibilityMode>AlwaysVisible</VisibilityMode> <Discipline>Any</Discipline>
Finally, the tail tags for closing up the xml file.
Now save this file to the add-in folder, which usually is located at:
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.