Skip to content

Beta Tools

Konrad K Sobon edited this page Aug 1, 2018 · 6 revisions

Beta Tools are tools that are supposed to be either in early testing phases, or existing tools with some proposed changes that need testing before they can be officially published. In order to quickly add Beta Tools to the HOK Beta tab on a Revit ribbon, there are a few utilities that were created, and a quite specific workflow.

Beta Tools Manager

This is a tool that presents a UI to the user, and allows them to pick which beta tools they want to install. The solution for this tool can be found here: Solution

Beta Tools Manager

  • The way that Beta Tools Manager aggregates plugins that will be available is via checking contents of the sysvol folder. \\group\sysvol\group.hok.com\HOK\Tools\Revit
  • Files are organized by Revit version first (2017, 2018 etc.), then inside of the Temp folder by their name.
  • Please create a new folder for each plugin, and place all dependencies in there.
  • Please also create (even if its not used) an Addin Manifest (*.addin). We need a manifest file, because the Beta Tools Manager scans the file path inside of the manifest that points it at the proper DLL to load into Revit. So basically a manifest file is a pointer at the DLL and where its located.
  • There is also a Temp.dll file located in that folder. Let's keep it there. Because Revit locks DLLs that are loaded into its context, what Beta Tools Manager does, is points or new beta tools to this temp dll when they are loaded into Revit. That allows the other (actual) dlls to remain unlocked, and if there is an update we can swap them out, and then re-point the buttons to proper dlls.
  • All plugins by default are on an Auto-Update routine, so all of this will happen automatically when user starts Revit.

Beta Tools Manager can be compiled for Release or for Debug. When its compiled for Release mode, it points at the sysvol path. If you need to debug/test locally some Revit plugins, just compile it for Debug (Configuration called 2019 instead of 2019_Release). That will point it at the location on your desktop: C:\Users\konrad.sobon\Desktop\BetaFiles Testing. Same rules apply as described above.

Button Creation

Beta Tools Manager when it executes, and as I have mentioned earlier, will extract DLL location from the *.addin file. Once it has the DLL, it will use its contents to generate the ribbon button and create all proper associations. Here's what's needed to make that possible.

  • Class Attributes. After you have created your app/command that inherits from IExternalApplication or IExternalCommand, just add a few Attributes to it to expose it to Beta Tools Manager:
    [Name(nameof(Properties.Resources.MoveBackup_Name), typeof(Properties.Resources))]
    [Description(nameof(Properties.Resources.MoveBackup_Description), typeof(Properties.Resources))]
    [Image(nameof(Properties.Resources.MoveBackup_ImageName), typeof(Properties.Resources))]
    [PanelName(nameof(Properties.Resources.MoveBackup_PanelName), typeof(Properties.Resources))]
    [Namespace(nameof(Properties.Resources.MoveBackup_Namespace), typeof(Properties.Resources))]
    [AdditionalButtonNames(nameof(Properties.Resources.MoveBackup_AdditionalButtonNames), typeof(Properties.Resources))]
  • Name is the name that will be displayed in the data grid to the user.
  • Description is the description that will be displayed in the data grid to the user. It will also be used for the tooltip on the button.
  • Image is simply a name of the image to be used for the button: moveBackups_32x32.png It has to include the extension. Image has to be part of the DLL and has its Build Action set to Embedded Resource.
  • PanelName is the name of the Panel within HOK Beta Tab that the new button will be placed in.
  • Namespace is the name of the main namespace. So this is used for reading the image from the assembly. Image will be in that namespace, inside of the resource file.
  • AdditionalButtonNames is optional. This is potentially needed in case where you have a beta application that inherits from IExternalApplication. That application can have multiple commands inside of it, and you want to create multiple buttons. You can just create all these buttons inside of the application, and then declare button names in AdditionalButtonNames so that Beta Tools Manager knows to load/unload them when the main application is loaded/unloaded.
Clone this wiki locally