Adding iLogic Rule to Marking Menu

Adding iLogic Rule to Marking Menu

Anonymous
Not applicable
1,095 Views
3 Replies
Message 1 of 4

Adding iLogic Rule to Marking Menu

Anonymous
Not applicable

Is it possible to add an ilogic Rule to the Marking Menu (Marking Menu shown below)?

MarkingMenu.png

0 Likes
Accepted solutions (1)
1,096 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Good question.  There doesn't appear to be a simple option available for that directly.  But, as a quickie work around, you could always create a very simple Macro that just runs your rule, then place that macro into that marking menu.

Perhaps you could suggest that idea in the Idea Station, if it isn't already there.  If there is already an idea like, you could up-vote it.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 4

Anonymous
Not applicable

The macro/vba/ilogic is becoming a thing for me for sure! 
how would i call an ilogic rule from a macro?

0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor

I'm sure there are numerous sources for similar code here on the forum, but here is a fairly simple one I was using for a while.  I had an external iLogic rule that would export an IDW (drawing document) to a PDF.  Then I used this VBA macro to run that rule, so that I could place the button for that macro onto my ribbon, for a 1-click run solution.

Here's the code:

First thing it does is get Inventor's iLogic Addin.  There is a more direct way to do this with fewer lines, by specifying it by its ID string, but I usually preffered to avoid doing it that way, because it uses a long, unreadable string of nonsense, versus just searching for it by its name.

It then defines the name of the external rule file.  Then identifies the document you want that external iLogic rule to affect (work on).  Then uses the iLogic Addin to run the rule.

Public Sub Export_IDW_to_PDF()
    Dim oAddIns As ApplicationAddIns
    Dim oAddIn As ApplicationAddIn
    Set oAddIns = ThisApplication.ApplicationAddIns
    For Each oAddIn In oAddIns
        If InStr(oAddIn.DisplayName, "iLogic") > 0 Then
            oAddIn.Activate
            Dim iLogicAuto As Object
            Set iLogicAuto = oAddIn.Automation
            Exit For
        End If
    Next
    'Debug.Print oAddIn.DisplayName
    Dim oXRuleName As String
    oXRuleName = "Export IDW to PDF"
    Dim oDoc As Document
    Set oDoc = ThisApplication.ActiveDocument
    If oDoc Is Nothing Then
        MsgBox "Missing Inventor Document"
    Exit Sub
    End If
    iLogicAuto.RunExternalRule oDoc, oXRuleName
End Sub

 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes