12-20-2018
12:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
12-20-2018
12:31 AM
Hi.
If the iLogic rules are placed in the documents, use this VBA code.
Add it to a Module in the VBA editor.
Public Sub LaunchMyRule1 '<--- This is what you would tie to a button in a toolbar.
RuniLogic "MyRule1" '<--- Name of your iLogic rule
End sub
Public Sub LaunchMyRule2 '<--- This is what you would tie to a button in a toolbar.
RuniLogic "MyRule2" '<--- Name of your 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.RunRule oDoc, RuleName
End Sub
Public 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
Then just add it to your ribbon.
//Jesper
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.