
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am creating a custom Addin for Inventor 2019 coding in Visual Basic 2017, and I am trying to create a button that runs an external iLogic rule. I have looked through previous forum posts and gotten code that should work from there, but the line "iLogicAuto.RunExternalRule(oDoc, RuleName)" (highlighted in red below) does not work as it is supposed to. I have verified that the GetiLogicAddin function is correctly getting the iLogic Addin.
Similar versions of this question have been posted several times on the forum, but the verified answers are not working for me. Some of the forum posts I have looked into are here:
Here is my code:
Private Sub m_balloonUpdateButton_OnExecute(Context As NameValueMap) Handles m_balloonUpdateButton.OnExecute
RuniLogic("BalloonUpdateStyles")
End Sub
Public Sub RuniLogic(ByVal RuleName As String)
Dim iLogicAuto As Object
Dim oDoc As Document
oDoc = g_inventorApplication.ActiveDocument
If oDoc Is Nothing Then
MsgBox("Missing Inventor Document")
Exit Sub
End If
iLogicAuto = GetiLogicAddin(g_inventorApplication)
If iLogicAuto Is Nothing Then Exit Sub
iLogicAuto.RunExternalRule(oDoc, RuleName)
End Sub
Function GetiLogicAddin(oApplication As Inventor.Application) As Object
Dim addIns As ApplicationAddIns
addIns = oApplication.ApplicationAddIns
Dim addIn As ApplicationAddIn
On Error GoTo - 1
addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")
If (addIn Is Nothing) Then Exit Function
addIn.Activate()
GetiLogicAddin = addIn.Automation
Exit Function
End Function
Solved! Go to Solution.