iLogic Rule Timeout

iLogic Rule Timeout

Anonymous
Not applicable
1,463 Views
8 Replies
Message 1 of 9

iLogic Rule Timeout

Anonymous
Not applicable

How can I avoid my users from getting a Rule Timout when running an iLogic rule?

 

If they run a rule (this one has a VB form) and take time in filling out the form and hitting the Create button, they get an error message stating:

 

Rule timeout in rule Form Rule, in document :Frame Window Double Master Template.ipt

 

Please run the rule again.

 

 

Any suggestions?

 

Thanks,

Randy Mabery

Autodesk Inventor Professional 2009 SP2  (Soon to be 2011)

Autodesk Productstream 2009  (Soon to be Vault Pro 2011)

Autodesk Inventor Certified Professional

Intel i5 3.2 GHz

7 GB Ram

Nvidia Quadro FX 1800

Windows 7

0 Likes
Accepted solutions (1)
1,464 Views
8 Replies
Replies (8)
Message 2 of 9

MjDeck
Autodesk
Autodesk

This problem is fixed in Inventor 2011 (and also in 2010).

There is a workaround for the problem in Inventor 2009.  It requires adding a timer to your VB form code.  The timer would call iLogic at regular intervals to keep it awake.  Let me know if you want more details about this workaround.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 3 of 9

Anonymous
Not applicable

Mike,

 

Yes, I'd appreciate it if you could provide me with more details for this workaround.

 

We will be upgrading to 2011 soon but if I can help in the meantime with a simple fix, I'll go ahead and do that.

 

Thanks,

Randy Mabery

Autodesk Inventor Professional 2009 SP2  (Soon to be 2011)

Autodesk Productstream 2009  (Soon to be Vault Pro 2011)

Autodesk Inventor Certified Professional

Intel i5 3.2 GHz

7 GB Ram

Nvidia Quadro FX 1800

Windows 7

0 Likes
Message 4 of 9

MjDeck
Autodesk
Autodesk
Accepted solution

Here's a VB.NET project for a sample dialog with a Timer that will ping iLogic and prevent a timeout.   The file Instructions.txt tells you how to add a timer to your own dialog.  The sample part NoTimeout.ipt contains a rule that connects to the timer.  The important lines in the rule are:

 

  dlg.iLogicWakeup = AddressOf  iLogicWakeup  ' Connect our wakeup function to the dialog.

and the Sub iLogicWakeup()  at the bottom of the rule.

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 5 of 9

Anonymous
Not applicable

Mike,

 

I'm still getting the timeout.  I am compiling using .NET Framework 2.0 rather than 4.0 as you are.

 

I am pasting my Form Rule for you to see what I am doing wrong.  I'm assuming the problem is here and not in the VB.

 

 

AddReference "WindowFrame2.dll"

Sub Main()
 localTrigger = iTrigger0
 Using dlg As New ClassLibrary1.Dialog1
  dlg.W_Inside = W_Inside
  dlg.H_Inside = H_Inside
  dlg.Flange_Thickness = Flange_Thickness
  dlg.Add_Flange_Left = Add_Flange_Left
  dlg.Add_Flange_Right = Add_Flange_Right
  dlg.Add_Flange_Top = Add_Flange_Top
  dlg.Add_Flange_Bottom = Add_Flange_Bottom
  dlg.X_Hole = X_Hole
  dlg.Y_Hole = Y_Hole
  dlg.M10_X_Qty = M10_X_Qty
  dlg.Horiz_M8_Holes_Before_M10 = Horiz_M8_Holes_Before_M10
  dlg.M10_Y_Qty = M10_Y_Qty
  dlg.Vert_M8_Holes_Before_M10 = Vert_M8_Holes_Before_M10
  dlg.User = iProperties.Value("Custom", "User")  
  dlg.DateCreated = iProperties.Value("Custom", "Created") 
  dlg.GBFamily = UCase(iProperties.Value("Summary","Subject"))
  dlg.Stock1 =UCase(Left(iProperties.Value("Project","Stock Number"),5))
  dlg.Stock2=UCase(Mid(iProperties.Value("Project","Stock Number"),7,3))
  dlg.Stock3=UCase(Mid(iProperties.Value("Project","Stock Number"),11,2))
  dlg.Stock4=UCase(Mid(iProperties.Value("Project","Stock Number"),14,3))
  dlg.Stock5=UCase(Mid(iProperties.Value("Project","Stock Number"),18,1)) 
  dlg.Stock6=UCase(Mid(iProperties.Value("Project","Stock Number"),20,5))
  dlg.iLogicWakeup = AddressOf iLogicWakeup  ' Connect our wakeup function to the dialog.
  Dim i As Integer = dlg.ShowDialog()
  if i <> vbOK then return
  W_Inside =  dlg.W_Inside
  H_Inside =  dlg.H_Inside
  Flange_Thickness =  dlg.Flange_Thickness
  Add_Flange_Left =  dlg.Add_Flange_Left
  Add_Flange_Right =  dlg.Add_Flange_Right
  Add_Flange_Top =  dlg.Add_Flange_Top
  Add_Flange_Bottom =  dlg.Add_Flange_Bottom
  X_Hole =  dlg.X_Hole
  Y_Hole =  dlg.Y_Hole
  M10_X_Qty =  dlg.M10_X_Qty
  Horiz_M8_Holes_Before_M10 =  dlg.Horiz_M8_Holes_Before_M10
  M10_Y_Qty =  dlg.M10_Y_Qty
  Vert_M8_Holes_Before_M10 =  dlg.Vert_M8_Holes_Before_M10
  iProperties.Value("Custom","User") = dlg.User
  iProperties.Value("Custom","Created")=dlg.DateCreated
  iProperties.Value("Summary","Subject")=UCase(dlg.GBFamily)
  iProperties.Value("Project","Stock Number") = UCase(dlg.Stock1 & " " & dlg.Stock2 & " " & dlg.Stock3 & " " & dlg.Stock4 & " " & dlg.Stock5 & " " & dlg.Stock6)
 End Using
 
 
' Modifying model based on quantity of M10 holes
 If M10_X_Qty = "2" Then

	Feature.IsActive("M10x18 X Middle Hole") =False
	Feature.Isactive("M10x18 Second X Tapped Hole") = False
	Feature.Isactive("M10x18 Second X Hole Mirror") = False

Elseif M10_X_Qty = "3" Then

	Feature.Isactive("M10x18 X Middle Hole") = True
	Feature.Isactive("M10x18 Second X Tapped Hole") = False
	Feature.Isactive("M10x18 Second X Hole Mirror") = False

Elseif M10_X_Qty = "4" Then

	Horiz_M8_Holes_Between_1_2_M10_Holes= Inputbox("Enter number of M8 holes between the first and second M10 hole, starting at left, on top of the window frame","Horizontal M8 Holes Between First & Second M10 Holes","2")
	Feature.Isactive("M10x18 X Middle Hole") = False
	Feature.Isactive("M10x18 Second X Tapped Hole") = True
	Feature.Isactive("M10x18 Second X Hole Mirror") = True

Else
	Feature.IsActive("M10x18 X Middle Hole") =False
	Feature.Isactive("M10x18 Second X Tapped Hole") = False
	Feature.Isactive("M10x18 Second X Hole Mirror") = False

End if

if M10_Y_Qty = "2" Then

	Feature.IsActive("M10x18 Y Middle Hole") =False
	Feature.Isactive("M10x18 Second Y Tapped Hole") = False
	Feature.Isactive("M10x18 Second Y Hole Mirror") = False

Elseif M10_Y_Qty = "3" Then

	Feature.Isactive("M10x18 Y Middle Hole") = True
	Feature.Isactive("M10x18 Second Y Tapped Hole") = False
	Feature.Isactive("M10x18 Second Y Hole Mirror") = False

Elseif M10_Y_Qty = "4" Then

	Vert_M8_Holes_Between_1_2_M10_Holes= Inputbox("Enter number of M8 holes between the first and second M10 hole, starting at top, on left hand side of the window frame","Vertical M8 Holes Between First & Second M10 Holes","2")
	Feature.Isactive("M10x18 Y Middle Hole") = False
	Feature.Isactive("M10x18 Second Y Tapped Hole") = True
	Feature.Isactive("M10x18 Second Y Hole Mirror") = True

Else
	Feature.IsActive("M10x18 Y Middle Hole") =False
	Feature.Isactive("M10x18 Second Y Tapped Hole") = False
	Feature.Isactive("M10x18 Second Y Hole Mirror") = False

End if
 
 
RuleParametersOutput()

InventorVb.DocumentUpdate()

iProperties.Value("Custom", "AllocationQty") = Round(AllocationQty, 3)
iProperties.Value("Summary", "Author") = iProperties.Value("Custom","User")
iProperties.Value("Project", "Designer") = iProperties.Value("Custom","User")
iProperties.Value("Project", "Creation Date") = iProperties.Value("Custom","Created") 
iProperties.Value("Project","Project") = "MOX " & iProperties.Value("Summary","Subject")

RuleParametersOutput()

InventorVb.DocumentUpdate()

iLogicVb.UpdateWhenDone = True

iLogicVb.RunRule("Error Checking")


End Sub


Sub iLogicWakeup()
   Dim tempV  =  Parameter.Quiet
   tempV = m_pc39483c.Value(0)
   tempV = MultiValue.Quiet
   tempV = iLogicVb.UpdateWhenDone
   tempV = iProperties.Value("Project", "Part Number")
    ' Any other iLogic objects (such as Feature or Component) that are used in the dialog should be listed here
End Sub

 

I didn't quite understand your comment about the other iLogic objects and listing them in the iLogicWakeup sub but I didn't think this would affect it keeping the timeout from happening.

 

If you need to see the vb code, let me know.

 

Thanks,

Randy

 

0 Likes
Message 6 of 9

Anonymous
Not applicable

I decided to go ahead and post the VB code as well.

 

 

Imports System.Windows.Forms
Public Delegate Sub iLogicWakeup()

Public Class Dialog1
    Public W_Inside As Double
    Public H_Inside As Double
    Public Flange_Thickness As Double
    Public Add_Flange_Left As Double
    Public Add_Flange_Right As Double
    Public Add_Flange_Top As Double
    Public Add_Flange_Bottom As Double
    Public X_Hole As Double
    Public Y_Hole As Double
    Public M10_X_Qty As Double
    Public Horiz_M8_Holes_Before_M10 As Double
    Public M10_Y_Qty As Double
    Public Vert_M8_Holes_Before_M10 As Double
    Public User As String
    Public Username As String
    Public CreateDate As Date
    Public DateCreated As Date
    Public GBFamily As String
    Public Stock1 As String
    Public Stock2 As String
    Public Stock3 As String
    Public Stock4 As String
    Public Stock5 As String
    Public Stock6 As String
    Dim oInvApp As Inventor.Application


    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub Dialog1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        oInvApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
        Username = oInvApp.GeneralOptions.UserName
        CreateDate = Format(Now(), "d")
        TextBox1.Text = W_Inside
        TextBox2.Text = H_Inside
        TextBox3.Text = Flange_Thickness
        TextBox4.Text = Add_Flange_Left
        TextBox5.Text = Add_Flange_Right
        TextBox6.Text = Add_Flange_Top
        TextBox7.Text = Add_Flange_Bottom
        TextBox8.Text = X_Hole
        TextBox9.Text = Y_Hole
        ComboBox1.Text = M10_X_Qty
        TextBox10.Text = Horiz_M8_Holes_Before_M10
        ComboBox2.Text = M10_Y_Qty
        TextBox11.Text = Vert_M8_Holes_Before_M10
        TextBox12.Text = Username
        TextBox13.Text = CreateDate
        TextBox14.Text = GBFamily
        TextBox15.Text = Stock1
        TextBox16.Text = Stock2
        TextBox17.Text = Stock3
        TextBox18.Text = Stock4
        TextBox19.Text = Stock5
        TextBox20.Text = Stock6
        Timer1.Start()

    End Sub

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        W_Inside = TextBox1.Text
        H_Inside = TextBox2.Text
        Flange_Thickness = TextBox3.Text
        Add_Flange_Left = TextBox4.Text
        Add_Flange_Right = TextBox5.Text
        Add_Flange_Top = TextBox6.Text
        Add_Flange_Bottom = TextBox7.Text
        X_Hole = TextBox8.Text
        Y_Hole = TextBox9.Text
        M10_X_Qty = ComboBox1.Text
        Horiz_M8_Holes_Before_M10 = TextBox10.Text
        M10_Y_Qty = ComboBox2.Text
        Vert_M8_Holes_Before_M10 = TextBox11.Text
        User = TextBox12.Text
        DateCreated = TextBox13.Text
        GBFamily = TextBox14.Text
        Stock1 = TextBox15.Text
        Stock2 = TextBox16.Text
        Stock3 = TextBox17.Text
        Stock4 = TextBox18.Text
        Stock5 = TextBox19.Text
        Stock6 = TextBox20.Text
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

#Region "Code For Timer"
    Public iLogicWakeup As iLogicWakeup

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If (iLogicWakeup IsNot Nothing) Then
            iLogicWakeup()
        End If
    End Sub

    Private Sub Dialog1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Timer1.Stop()
    End Sub

#End Region

End Class

 

 

0 Likes
Message 7 of 9

MjDeck
Autodesk
Autodesk

Randy,

 

 In the rule, you have to ping each predefined standard iLogic object to keep it alive.  So add this line to your Sub iLogicWakeup:

 

tempV = Feature.IsActive("M10x18 X Middle Hole")

 

 Your dialog code looks OK as far as the timer code is concerned. One thing I would recommend:  instead of using GetActiveObject, you could pass the UserName from the rule.

In the rule:

dlg.UserName = ThisApplication.GeneralOptions.UserName

 

 

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 8 of 9

Anonymous
Not applicable

Mike,

 

Works like a charm now.  I appreciate the assistance.  I marked the above as the solution.

 

What is the pro to passing the UserName from the rule rather than GetActiveObject?  Is it just cleaner?

 

Pardon my ignorance.  

 

Thanks,

Randy

0 Likes
Message 9 of 9

MjDeck
Autodesk
Autodesk

Yes, the main reason is that it's cleaner.  But also, if you have more than one session of Inventor running on the same machine, GetActiveObject could give you the other session instead!  It would probably be the same user, but other things would be different.

 

 If you need more things from the Application, you can pass an Application object to the dialog:

 

dlg.ThisApplication = ThisApplication

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes