Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Access iLogicAddin Object Browser

MechMachineMan
Advisor

Access iLogicAddin Object Browser

MechMachineMan
Advisor
Advisor

I'm trying to access the object browser for the iLogic addin through the vba editor, but it is not seeming to work.

 

Below is the code I have, and in the Sub iLogicCheck() i'm just trying to type in "iLogicAuto." so that it gives me the accessible ojects/properties under that, but it is not working.

 

Can someone help me?

 

Thanks!

 

AddReference "Autodesk.iLogic.Interfaces.dll"

Sub iLogicCheck()

MsgBox ("Hey!")

  Set iLogicAuto = GetiLogicAddin(ThisApplication)
  If (iLogicAuto Is Nothing) Then Exit Sub

End Sub

Function GetiLogicAddin(oApplication As Inventor.Application) As Object
  Dim addIns As ApplicationAddIns
  Set addIns = oApplication.ApplicationAddIns

  Dim addIn As ApplicationAddIn
  Dim customAddIn As ApplicationAddIn
  For Each addIn In addIns
    If (addIn.ClassIdString = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}") Then
      Set customAddIn = addIn
    Exit For
    End If
  Next
  Set GetiLogicAddin() = customAddIn
End Function

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Reply
Accepted solutions (1)
1,191 Views
8 Replies
Replies (8)

Owner2229
Advisor
Advisor

Something like this? It's the basic snipset to run external rule, you can remove the lines you don't need.

 

Public Sub RunRule()
    RuniLogic ("C:\Path\MyRule.iLogicVb")
End Sub

Public Sub RuniLogic(ByVal RuleName As String)
    Dim iLogicAuto As Object
    Dim oDoc As Document
    Set oDoc = ThisApplication.ActiveDocument
    If oDoc Is Nothing Then
        MsgBox "Missing Inventor Document"
        Exit Sub
    End If
    Set iLogicAuto = GetiLogicAddin(ThisApplication)
    If (iLogicAuto Is Nothing) Then Exit Sub
    iLogicAuto.RunExternalRule oDoc, RuleName
End Sub
 
Public Function GetiLogicAddin(oApplication As Inventor.Application) As Object
    Dim addIn As ApplicationAddIn
    On Error GoTo NotFound
    Set addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")
    If (addIn Is Nothing) Then Exit Function
    addIn.Activate
    Set GetiLogicAddin = addIn.Automation
    Exit Function
NotFound:
End Function

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes

MechMachineMan
Advisor
Advisor
Is there any references we need to add to access the addin object browser?

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes

MechMachineMan
Advisor
Advisor

I think I answered my own question after reading through this:

 

http://adndevblog.typepad.com/files/cp2544_ilogic_inventor_api.pdf


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes

Owner2229
Advisor
Advisor

There's no need to add any reference for this in VBA.

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes

MechMachineMan
Advisor
Advisor

Here is what I made for code that runs:

(added References to C:\Program Files\Autodesk\Inventor 2016\Bin\Automation.Ilogic.Interfaces.dll

as well as Autodesk Inventor Object Library)

 

Imports System
Imports System.Type
Imports System.Activator
Imports Inventor
Imports System.Runtime.InteropServices

Public Class Class1

    Public Sub Main()
        Dim oInv_App As New CL_InventorApp

        Dim iLogicAuto As Object
        iLogicAuto = GetiLogicAddin(oInv_App)

        MsgBox("Working!")
    End Sub

    Public Function GetiLogicAddin(oApplication As Inventor.Application) As Object
        Dim addIn As ApplicationAddIn
        addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79​-2179-4b11-8a5a-257b1c0263ac}")

        If (addIn Is Nothing) Then
            Exit Function
        End If

        addIn.Activate()
        Return addIn.Automation
    End Function
End Class

Public Class CL_InventorApp
    Public InventorInstance As Inventor.Application
    Dim _started As Boolean
    Public Sub New()
        Try
            InventorInstance = Marshal.GetActiveObject("Inventor.Application")
        Catch ex As Exception
            Try
                Dim invAppType As Type = GetTypeFromProgID("Inventor.Application")
                InventorInstance = CreateInstance(invAppType)
                InventorInstance.Visible = True
                _started = True
            Catch ex2 As Exception
                MsgBox(ex2.ToString())
                MsgBox("Unable to get or start Inventor")
                Exit Sub
            End Try
        End Try
    End Sub

End Class

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes

Owner2229
Advisor
Advisor

Umm, didn't you say you want it for VBA? This is VB.Net... You're confusing me now Smiley Happy

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes

MechMachineMan
Advisor
Advisor
Accepted solution
That, or I got ahead of myself. Looks like all I need to do was open visual studio, get into Object Browser, Add custom Component set, Add the Autodesk.iLogic.Interfaces.dll and then it all popped up from there.

Thanks for the help Mike!

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes

Owner2229
Advisor
Advisor

You're welcomed Smiley Happy

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes