Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to link ilogic to vba script?

1 REPLY 1
SOLVED
Reply
Message 1 of 2
BHARNRAJ
351 Views, 1 Reply

how to link ilogic to vba script?

Hi everyone, I have created some codes in my ilogic but idk how to  connect with the  vba script,

help me in this 

1 REPLY 1
Message 2 of 2
Sergio.D.Suárez
in reply to: BHARNRAJ

Hi, This is a code of how to trigger an external ilogic rule from vba.

 

 

Sub Run_iLogic()
Dim RuleName As String
RuleName = "00_New Nota_Gen_Sel"   ' Your ilogicName here

  Dim iLogicAuto As Object
  Dim oDoc As Document
  Set oDoc = ThisApplication.ActiveDocument
  If oDoc Is Nothing Then
    MsgBox "Abra un documento por favor"
    Exit Sub
  End If
  Set iLogicAuto = GetiLogicAddin(ThisApplication)
  If (iLogicAuto Is Nothing) Then Exit Sub
  iLogicAuto.RunExternalRule oDoc, RuleName
End Sub

Function GetiLogicAddin(oApplication As Inventor.Application) As Object
Set addIns = oApplication.ApplicationAddIns
'Find the add-in you are looking for
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

I hope this helps. regards

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report