Search code examples
autodesk-forgeautodesk-designautomation

How to define a Revit app bundle for Design Automation API that supports multiple Activities


I'd like to define a Revit app bundle whose DLL defines multiple IExternalDBApplication classes, each of which would correspond to its own Activity. This way, a work item for a given Activity would invoke the corresponding IExternalDBApplication, but all Activities would refer to the same app bundle.

I have done something similar using the AutoCAD engine -> I would define a method annotated with [CommandMethod("CUSTOM_COMMAND_NAME")], and then in the PackageContents.xml file, I could link the command to a class via the <Commands> tag, and finally in the Activity definition in Autodesk Forge, we could specify the settings.script field with a command that invokes that custom command.

I don't see a way to do this using the Revit engine, at least from reading the tutorial here: https://aps.autodesk.com/en/docs/design-automation/v3/tutorials/revit/.

Is there a way to do this? Or do I need to define a separate app bundle per IExternalDBApplication I'd like to create? Thanks!


Solution

  • As it stands today, Design Automation for Revit acknowledges / recognizes only one <FolderName>.bundle folder in the appbundle zip package. It in turn can only have one path to the <AddinName>.addin file relative to the folder containing the PackageContents.xml. The addin file in turn can only load one assembly and specify full class name of only one implementation of IExternalDBApplication.

    Given the above constraints, you will most likely not be able to create an app bundle that has 2 or more implementations of IExternalDBApplication and use a "switch" in different activity definitions.

    That said, you can still be able to "branch" in your single implementation of IExternalDBApplication + single activity, by passing a json argument in the workitem payload. I'd however do something like this only if the 2 different branches are mostly similar. If not, preference would be to have separate app bundles and separate activity definitions, with common code extracted into a common dll shared by both app bundles.