Adding iLogic Rule Using the API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've caught glimpses of how to do this (For instance, this plugin (Inventor LinkParameters) http://labs.autodesk.com/utilities/ADN_plugins/) , but honestly feel stumped when trying to actually find information on any documentation of how to get from point A to point B. I can't seem to find anything about ilogic automation / rule creation / ilogic in general, in the object browser at all.
I know code like this exists
Option Explicit
Sub RuniLogicRule()
Dim iLogicAuto As Object
Set iLogicAuto = GetiLogicAddin(ThisApplication)
If (iLogicAuto Is Nothing) Then Exit Sub
Dim doc As Document
Set doc = ThisApplication.ActiveDocument
Dim ruleName As String
ruleName = "Rule0"
Dim rule As Object
Set rule = iLogicAuto.GetRule(doc, "Rule0")
If (rule Is Nothing) Then
Call MsgBox("No rule named " & ruleName & " was found in the document.")
Exit Sub
End If
Dim i As Integer
i = iLogicAuto.RunRuleDirect(rule)
End Sub
Function GetiLogicAddin(oApplication As Inventor.Application) As Object
Dim addIns As ApplicationAddIns
Set addIns = oApplication.ApplicationAddIns
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
(and even fixed the error it gave me due to the original code leaving something out) , but have no idea where any info on the GetRule method is.
If anyone could help to point me in the correct direction for documentation or could provide an example even, I would be most grateful, as I certainly failing to see a major piece of the puzzle.
If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

