Hi Steve,
You can do something like this:
'Add the below code in your VBA editor
Public Sub MyruleName() '<--- This is what you would tie to a button in a toolbar. This is text on button
RuniLogic "MyruleName" 'This is external ilogic rule
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
'create a symbol for your new button
'sizes 32x32 and 16x16
' call them MyVBAModule.MyruleName.Large.bmp & MyVBAModule.MyruleName.Small.bmp
'create an external rule - MyruleName with this line
iLogicVb.RunRule("Form Controls")
'create a local rule in your template "Form Controls" with this line
oRed = iLogicForm.Show("MyFormName", FormMode.NonModal)