ilogic code help

ilogic code help

mwighton
Collaborator Collaborator
504 Views
3 Replies
Message 1 of 4

ilogic code help

mwighton
Collaborator
Collaborator

Is there a way to end a rule from another rule.

 

I have an asssembly file that opens another assembly based on inputs that the user gives. I want the original assembly to close when the new assembly is opened. ( i got this to happen) However, when my new assembly opens and closes the original assembly i get a catastrophic error saying the first rule that runs in the original assembly did not get a chance to end. 

 

thanks,

Did this post help out? Hope it did.
If so please use the 'Accept as Solution' or 'Kudos' Button below.
God Bless

Mwighton
0 Likes
505 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Try to post some of your code, that ,might help us to work with you.

0 Likes
Message 3 of 4

mwighton
Collaborator
Collaborator

This is the part where i am getting the error.

 

SyntaxEditor Code Snippet

Start:startup = MessageBox.Show("The following is an Inventor program that will assist in rendering the desired model." & vbCrLf & "Do you wish to conintue?", "Start-Up",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
Title = ThisDoc.FileName(False) 'without extension
OriginalPath = ThisDoc.Path
If startup = vbYes Then
    
    iLogicVb.RunRule("Assemble")

ElseIf startup = vbNo Then
    safety = MessageBox.Show("Are you sure you do not want to use this program?", "Warning",MessageBoxButtons.YesNo,MessageBoxIcon.Warning)
    
    If safety = vbYes Then
    
    
    ElseIf safety = vbNo Then
    
    restart = MessageBox.Show("You should run iLogic rule titled 'Start'", "Suggestion",MessageBoxButtons.RetryCancel,MessageBoxIcon.Question)
    If restart = vbRetry Then
    
    Goto Start

    Else
    End If

    
    End If

End If

 when assemble starts it asks the user which of 2 options they would like and then opens an assembly of the chosen path. at the openning of the new doc an external rule runs to close the first file which includes the above code. the error i get is attached as a picture.

Did this post help out? Hope it did.
If so please use the 'Accept as Solution' or 'Kudos' Button below.
God Bless

Mwighton
0 Likes
Message 4 of 4

Anonymous
Not applicable

First, you do not show how the object iLogicVb is created. Does your rule starts?

 

Also, it is recommended to specify the

 

Here's an example showing similar code for starting a rule from VBA:

 

 

Sub test()
 Dim iLogicAddinGuid As String
 iLogicAddinGuid = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}"
 
 Dim addin As Inventor.ApplicationAddIn
 Dim tempaddin As Inventor.ApplicationAddIn
 For Each addin In ThisApplication.ApplicationAddIns
  If addin.ClassIdString = iLogicAddinGuid Then
   Exit For
  End If
 Next
 
 If (addin.Activated = False) Then
  addin.Activate
 End If
 
 addin.Automation.RunRule ThisApplication.ActiveDocument, "MyRule"
 
End Sub

 

You have to specify the document where the rule resides (in my exemple it's the ActiveDocument)

 

Hope that helps.

0 Likes