SpeckleRevit icon indicating copy to clipboard operation
SpeckleRevit copied to clipboard

Best practices for Revit Addin

Open fraguada opened this issue 6 years ago • 8 comments

Please advise on the proper way to set up a Revit Addin. For example:

  • [ ] How to best integrate into the Add-In Ribbon?
  • [ ] How to distribute the addin? Is there such as a thing as an addin installer, or do we have to make one? ...

fraguada avatar Mar 06 '18 21:03 fraguada

How to best integrate into the Add-In Ribbon?

  • create a new Speckle ribbon tab
  • in that tab, create relevant panels, such as Settings/Setup, Senders, Receivers, etc.
  • each action is an ExternalCommand and is represented in the ribbon with 1 button
  • add said buttons to respective panels

How to distribute the addin? Is there such as a thing as an addin installer, or do we have to make one?

There's 2 things required :

  • .addin manifest file, this describes what the addin does and points it to the entry DLL file, placed in C:\ProgramData\Autodesk\Revit\Addins\2018
  • .dll as the entry point assembly that gets loaded, typically in same folder as manifest but not a requirement to do so. Any other dlls/dependencies are in the same folder

Depending on permissions to copy data to that folder, an installer might be required.

radumg avatar Mar 06 '18 22:03 radumg

@fraguada , i can extract a pretty good/clear boilerplate & utils from our current Revit tools for the Ribbon creation and post-build steps so the addin is installed on build

radumg avatar Mar 06 '18 22:03 radumg

@fraguada I have a good Revit VS template setup for this that I can provide. The Ribbon/icons, etc are registered through the ExternalApplication when Revit starts up. ExternalCommands are fired through the ribbon buttons. It may be good to wireframe out the Speckle-Revit interaction a bit. I use Dockable windows for many of our apps which requires some special setup but I could see them being very useful for Speckle

archinate avatar Mar 06 '18 22:03 archinate

@radumg really helpful information! At the moment I have this under 'External Tools' in the Add-In ribbon. I didn't get so far as to googling how to make a button yet. Also good to know particularities related to addin distribution.

@archinate That would be very helpful. I just cobbled this together from a few sources on the web. Literally my first Revit addin.

It may be good to wireframe out the Speckle-Revit interaction a bit.

Agreed. You can see how this works in Rhino in the Interop.cs class and in the SpeckleRhinoReceiver.cs / SpeckleRhinoSender.cs. As well as the components in SpeckleView.

I use Dockable windows for many of our apps which requires some special setup but I could see them being very useful for Speckle

100% agree!

fraguada avatar Mar 06 '18 22:03 fraguada

At the moment I have this under 'External Tools' in the Add-In ribbon

If no ribbon/panel is specified, all ExternalCommands end up here, good start.

@archinate if you'd like to share the VS template, that would be a good starting point, happy to contribute to it with anything else i might have. I generally start from Jeremy's VS template before making project-specific ones.

@fraguada - could we get a slightly more digestible list of things that need to happen with the plugin, in chronological order ? I'm getting a bit lost in that Interop.cs.

radumg avatar Mar 06 '18 23:03 radumg

For anything to start working, SpeckleRevitConverter #4 has to be started. Interop deals with the communication between the UI and the plugin. I'll do my best to make this clearer in the coming days.

fraguada avatar Mar 06 '18 23:03 fraguada

@fraguada I migrated your stuff to a template Revit project. Nothing fancy. We can wireframe the project a bit. The PR is https://github.com/speckleworks/SpeckleRevit/pull/13

archinate avatar Mar 07 '18 01:03 archinate

@fraguada @archinate @radumg I would love to join in and help on this project, anyone got a slack channel we can hop in?

arif-hanif avatar Mar 07 '18 01:03 arif-hanif