Hi @Brett.G,
Simply put, yes.
If you want to have a shared library of wrappers such as methods for working with iProperties/Parameters, you could quickly end up with a bunch of duplicate library files as Visual Studio would (by default) create copies of these libraries local to each compiled "function" dll and its accompanying .addin file.
This is my main reason for using MEF (which is properly explained here with an example, downloadable solution in case you missed the earlier link):
https://docs.microsoft.com/en-us/dotnet/framework/mef/
Since it allows me to have one central project with the following file(s):
- A single .addin file
- A single extension server .dll file
- A single "Contracts" .dll file (more on this in a bit)
- A single Don't Repeat Yourself (DRY) Helpers .dll file (takes care of Parameter/iProperty-specific wrappers)
- An append-able settings methodology (allows for user-controllable renaming of key properties)
As part of the single extension server file it affords the ability to add any of the following:
- a Ribbon button (or collection thereof)
- a context-menu button (right-click)
- a dockable window
- a graphics UI-specific "function"
The requirements for the items above are governed by the use of the "Contracts" .dll file mentioned earlier. Wherein the contract for each defines exactly what the Inventor Function extension should contain in order to load correctly.
I'm currently working out the technical details in a new github-hosted extension to show how all this works.
FWIW here's the basic "contract" Interface I'm using:
Interface IVPlugin
Private Property LogFileHelper As GraitecLog4NetFileHelper
Private ReadOnly Property CommandName As String
Private ReadOnly Property Description As String
Private ReadOnly Property DefaultResourceName As String
Private ReadOnly Property EnvironmentRibbonName As EnvironmentRibbonName
Private Property InventorApp As Application
Sub Execute()
Private ReadOnly Property InsertBeforeTarget As Boolean
Private ReadOnly Property Path As String
Private ReadOnly Property TargetControlName As String
Private ReadOnly Property ToolTip As String
Private ReadOnly Property PluginSettingsPrefix As String
Private Property PluginSettingsPrefixVar As String
Private Property ParentSettingsFilePath As String
End Interface
And here's the basic IVButtonPlugin interface that builds on the requirements of the above:
Interface IVButtonPlugin
Inherits IVPlugin
Private ReadOnly Property DisplayBigIcon As Boolean
Private ReadOnly Property DisplayText As Boolean
Private ReadOnly Property ButtonInternalName As String
Private ReadOnly Property ButtonDisplayName As String
Private ReadOnly Property RibbonPanelName As String
Private ReadOnly Property CanHaveProgressiveToolTip As Boolean?
Private ReadOnly Property IncludesProgressiveToolTipHelp As Boolean
Private Property ProgressiveToolTipDescription As String
Private Property ProgressiveToolTipExpandedDescription As String
Private Property ProgressiveToolTipTitle As String
Private Property ProgressiveToolTipImagePath As String
Private Property ThisButtonDefinition As ButtonDefinition
Sub ButtonDefinition_OnHelp(ByVal Context As NameValueMap, <Out> ByRef HandlingCode As HandlingCodeEnum)
End Interface
When I have something that is more than just words I'll share the link here.