Enable and Disable Inventor Add-In Programmatically?

Enable and Disable Inventor Add-In Programmatically?

jandrewsKUX78
Participant Participant
1,426 Views
4 Replies
Message 1 of 5

Enable and Disable Inventor Add-In Programmatically?

jandrewsKUX78
Participant
Participant

Is it possible to disable and enable Inventor (2022) add-ins via any API mechanism?

I want to do what is shown below programmatically because when a custom Vault add-in I developed runs, it launches Inventor via COM and if the Data Standard is enabled in Inventor, it pops a login dialog that the customer does not want to see:

jandrewsKUX78_0-1655232072295.png

0 Likes
Accepted solutions (2)
1,427 Views
4 Replies
Replies (4)
Message 2 of 5

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @jandrewsKUX78 

 

see this link

 

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/unload-add-in-using-vba/m-p/8078384#...

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 3 of 5

JelteDeJong
Mentor
Mentor
Accepted solution

there are 2 more options. if you know the guid of the addin then you can use this:

(The guid is always in the .addin file)

Dim addin As ApplicationAddIn = ThisApplication.ApplicationAddIns.ItemById("{34fa5034-811e-426f-8f01-42187b25e221}")
addin.Deactivate()

but you can also search for it by name without the loop:

Dim addin As ApplicationAddIn = ThisApplication.
	ApplicationAddIns.
	Cast(Of ApplicationAddIn).
	Where(Function(a) a.DisplayName.Equals("MyAddin", StringComparison.InvariantCultureIgnoreCase)).
	FirstOrDefault()
addin.Deactivate()

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 4 of 5

JMGunnar
Collaborator
Collaborator

 

Function too get add ins 

 

 

Sub Main()
	
		Dim _VaulAddin As Inventor.ApplicationAddIn
		
		Try
			_VaulAddin = GetAddinByByName("Inventor Vault")
			_VaulAddin.Deactivate
		Catch
		
		End Try
		
		
		'***************** here is the ordinary code  *******************
		Try
			_VaulAddin = GetAddinByByName("Inventor Vault")
			_VaulAddin.Activate
		Catch
		
		End Try
		
	
	End Sub
	
		'***************** the function *******************
	Function GetAddinByByName(displayName As String) As Inventor.ApplicationAddIn
        For Each i As Inventor.ApplicationAddIn In ThisServer.ApplicationAddIns
            If i.DisplayName = displayName Then
                Return i
            End If
        Next
        Return Nothing
    End Function

 

Message 5 of 5

jandrewsKUX78
Participant
Participant

Thank you all for your replies - Jelte's seems the most elegant, but they are all helpful and get the job done!