Launch iLogic rule from .net -> changing name

Launch iLogic rule from .net -> changing name

cadmageren
Enthusiast Enthusiast
545 Views
1 Reply
Message 1 of 2

Launch iLogic rule from .net -> changing name

cadmageren
Enthusiast
Enthusiast

Hi. I have mad a vb.net routine, to automatically launch a specific rule.

 

The launch works, however after each time I run the program, a _1 is added to the

Rulename: 

Update Filestructure_1_1_1_1_1_1_1_1 

 

 

Any other suggestion on how to run a rule, or can someone tell me why this is happening?

 

/Michael Christoffersen

 

 

    Sub LaunchRule(ByVal sRuleName As String)
        Try
            For Each oAddIn As ApplicationAddIn In mInvApp.ApplicationAddIns
                If oAddIn.DisplayName.Contains("iLogic") Then
                    oAddIn.Activate()
                    Dim iLogicAuto As Object = oAddIn.Automation
                    Dim rules As Object
                    rules = iLogicAuto.rules(mInvApp.ActiveDocument)
                    If (Not rules Is Nothing) Then
                        For Each Rule As Object In rules
                            If InStr(Rule.Name, sRuleName, Microsoft.VisualBasic.CompareMethod.Text) Then
                                ' Rule.run()
                                iLogicAuto.runrule(mInvApp.ActiveDocument, Rule.Name)
                                Exit Sub
                            End If
                        Next
                    End If
                End If
            Next
        Catch ex As Exception
        End Try
    End Sub

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0 Likes
546 Views
1 Reply
Reply (1)
Message 2 of 2

MjDeck
Autodesk
Autodesk

This is a bug in iLogic, and we should be able to fix it.

 

Here's a workaround that will not change the name of the rule.  Instead of looping thru the rules, you can ask for the rule by name:

 

Dim rule As Object = iLogicAuto.GetRule(mInvApp.ActiveDocument, sRuleName)

If (rule IsNot Nothing) Then
iLogicAuto.RunRuleDirect(rule)
End If


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes