Use VBA or iLogic to Activate Plugin

Use VBA or iLogic to Activate Plugin

el_jefe_de_steak
Collaborator Collaborator
1,711 Views
9 Replies
Message 1 of 10

Use VBA or iLogic to Activate Plugin

el_jefe_de_steak
Collaborator
Collaborator

Hi, I am wondering if there is a way to use VBA or iLogic to activate a function of a plugin we have purchased for Inventor. The plugin is designed to convert .ipt files into another format, and to use it you select parts and click a button that starts the conversion process based on the selection set.

 

I would like to use VBA to create the selection set and click the button...if that is possible.

 

In my mind, there should be a way to activate a publicly accessible function with VBA, but I have been wrong about these kinds of things before...

0 Likes
Accepted solutions (2)
1,712 Views
9 Replies
Replies (9)
Message 2 of 10

bradeneuropeArthur
Mentor
Mentor

Why can't you use the add-in selves?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 10

el_jefe_de_steak
Collaborator
Collaborator

@bradeneuropeArthur 

 

I'm not really sure what you mean by your response, 

 

But, basically, I am trying to automate the export process that this plugin will do for us. Since the plugin itself does not have an API, I would like to know if I can use Inventor's built-in API to automatically trigger a function of the plugin.

0 Likes
Message 4 of 10

bradeneuropeArthur
Mentor
Mentor

hi,

 

Depends on how it is programmed/coded.

 

Could you share the add-in, to test it.

 

Regards.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 10

el_jefe_de_steak
Collaborator
Collaborator

I'm sorry, but it's a subcription-based add-in, and the files are locked until activated. The activation price is $1,000...

 

How about we use another add-in as an example? Do you have the "revison cloud" add-in? This is available as a part of the Inventor package, but needs to be added manually. We could use that as an example. You would have to initialize the "revision cloud" button via VBA or iLogic.

0 Likes
Message 6 of 10

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Do you have an overview of commands you would like to use in this add in?

I mean Command-names

 

Regards,

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 10

bradeneuropeArthur
Mentor
Mentor
Accepted solution

you can use this Code to extract all available commands within inventor.

Be sure that the add in is activated.

 

Run this and send me the text-file please

 

Sub PrintCommandNames()
    Dim oControlDefs As ControlDefinitions
    Set oControlDefs = ThisApplication.CommandManager.ControlDefinitions

    Dim oControlDef As ControlDefinition
    
    Open "C:\temp\CommandNames.txt" For Output As #1

    Print #1, Tab(10); "Command Name"; Tab(75); "Description"; vbNewLine
    
    For Each oControlDef In oControlDefs

        Print #1, oControlDef.InternalName; Tab(55); oControlDef.DescriptionText
        
    Next
    Close #1
End Sub

For i logic

Sub main()
    Dim oControlDefs As ControlDefinitions
    oControlDefs = ThisApplication.CommandManager.ControlDefinitions

    Dim oControlDef As ControlDefinition
    
	'____Create and write to a text file_________________
oWrite = System.IO.File.CreateText( "C:\temp\CommandNames.txt")
'oWrite.WriteLine("text in first line")
'oWrite.WriteLine("next line")
'oWrite.WriteLine("next line")

'open the file
'ThisDoc.Launch(ThisDoc.PathAndFileName(False) & ".txt")

    'Open "C:\temp\CommandNames.txt" For Output As #1

    oWrite.WriteLine ("Command Name ;" & "" & "Description ;")
    
    For Each oControlDef In oControlDefs

        oWrite.WriteLine( oControlDef.InternalName & "" & oControlDef.DescriptionText)
        
    Next
    oWrite.Close()
End Sub

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 8 of 10

Frederick_Law
Mentor
Mentor

@el_jefe_de_steak wrote:

In my mind, there should be a way to activate a publicly accessible function with VBA, but I have been wrong about these kinds of things before...


Only if the addin expose a "publicly accessible function".

You need to ask the addin provider for API support and info.

You need to know which command to call and what parameters to pass.

0 Likes
Message 9 of 10

el_jefe_de_steak
Collaborator
Collaborator
Accepted solution

Thanks so much for the idea! I used a combination of your idea and an idea from @JelteDeJong from my cross-referenced post.

 

The code I used to find the command for the button was this code below. The plugin is called CMS, so I wanted to find all CMS-named control definitions.

For Each controlDefinition As ControlDefinition In ThisApplication.CommandManager.ControlDefinitions
    If (controlDefinition.DisplayName.Contains("CMS")) Then
        MsgBox(controlDefinition.InternalName)
    End If
Next    

 

The result was rather interesting, as the control definition for this command was not named in a way that made any sense, but I was able to activate the command by using this iLogic code:

'Create refrence to the document
Dim doc As AssemblyDocument = ThisDoc.Document

'code to create selection set will be entered here

'Create a refrense to the suppress ControlDefinition and execute it
Dim command As ControlDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("CMS:ShapeInfoAddin:PlateInfoBtn")
command.Execute()

 

Message 10 of 10

bradeneuropeArthur
Mentor
Mentor

That were my thoughts too.

 

Good to hear that it works.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes