Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Event Triggers Not Firing

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
jonathan4FEG3
397 Views, 12 Replies

Event Triggers Not Firing

Good day,

I hope that you're doing well.  I've been writing a few pieces of iLogic code for the last several months.  These all heavily depend on Event Triggers.  Up until last week these were working without any issue.  However, in the last week all of my Event Triggers have quit working.  Even if I create a new document and basic piece of code the new triggers and document do not work.  As far as I know I have not updated anything, I am running the latest version of Inventor 2021. Does anyone know how to fix this?

Thanks,

Jonathan

12 REPLIES 12
Message 2 of 13
WCrihfield
in reply to: jonathan4FEG3

Hi @jonathan4FEG3.  Is anything else acting odd in Inventor lately?  Are you still using the same 'Project' file as before, or has any major changes been made to the Project file you normally use?  Have you changed any of the iLogic Configuration settings lately, such as the External Rule Directories?  To view the iLogic Configuration settings, go to the Tools tab, then within the Options panel, click on the iLogic Configuration button.  You may have to expand the Options panel down to see it.  Do you have any rules set up on any of the other tabs within the Event Triggers dialog, other than the "This Document" tab?  If so, is this problem only effecting the rules on the 'This Document' tab, or all rules in all tabs?  The settings for the stuff on the This Document tab are stored within each document, in a hidden PropertySet (where iProperties are stored), but the settings on other tabs (for All, or specific types of documents) are stored in a single external XML file called "RulesOnEvents.xml".

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 13
jonathan4FEG3
in reply to: WCrihfield

Hi @WCrihfield.  To answer your questions:

 

Is anything else acting odd in Inventor lately?

     Everything appears to be working fine apart form event triggers

 

Are you still using the same 'Project' file as before, or has any major changes been made to the Project file you normally use?

     I am using the same 'Project' file as usual.  There have been no changes made to it.

 

Have you changed any of the iLogic Configuration settings lately, such as the External Rule Directories?

     Although I do have an external rule directory setup, these have not been changed and the code previously worked with all of these in place.

 

Do you have any rules set up on any of the other tabs within the Event Triggers dialog, other than the "This Document" tab? If so, is this problem only effecting the rules on the 'This Document' tab, or all rules in all tabs?

     I do not have any rules apart from two located in "This Document" under the "Before Save Document" and "After Save Document" (pictured below).

jonathan4FEG3_0-1698688227398.png

 

Thanks for your help,

Jonathan

 

Message 4 of 13
WCrihfield
in reply to: jonathan4FEG3

OK.  Next thing to try would be to remove those two rules from those two events in the Event Triggers dialog manually, then add them back again, then check if those triggers are functioning after that.  If it is possible for the rules to do something that is not noticeable, then it might be worthwhile to include a temporary MsgBox or MessageBox.Show type line of code just within those rules, to help determine if they may be running, but not doing anything to the document, as you are expecting.  Sometimes that simple act of removing, then re-adding them fixes problems.  Not sure why.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 13

Sometimes, just open the Event Trigger dialog will get it working.

Message 6 of 13
jonathan4FEG3
in reply to: WCrihfield

@WCrihfield 

 

I tried removing an adding the rules several times without any success.  I then create a new rule with a simple message box within it and tried to add that without any more luck.

Message 7 of 13

@WCrihfield 

 

I found a solution, I created a new project file and replaced the one I currently have.  The iLogic rules started working as they should.  Thank you for all of your help.

Message 8 of 13
Hendrik_Bu
in reply to: Frederick_Law

Hi Frederick,

 

you seem to know the issue well, I am having it too.

Whenever a part (seems to be just parts migrated from older Inventor versions) is opened in a new Inventor session, the Triggers are not firing. 

Opening the Event Trigger dialog allways gets it working. And then it works for all parts opened after that.

Do you have some ideas what I can do to "load the event triggers" in a new Inventor session automatically?

 

We are running Inventor 2022.3.

Message 9 of 13
WCrihfield
in reply to: Hendrik_Bu

Did those older files have any internal iLogic rule in them, or maybe any internal iLogic Forms?  If so, then the Document.DocumentInterests collection should contain a DocumentInterest for the iLogic ApplicationAddIn.  This can be checked with the DocumentInterests.HasInterest method, where you would supply the ApplicationAddIn.ClientId of the iLogic add-in as input.

 

This was one of the things we learned that we had to check when manipulating the Event Triggers settings that are stored locally in the document by code.  If the document did not already have any internal iLogic rules, or any internal iLogic Forms, then it did not have that DocumentInterest, there when that was the case, creating the 'hidden' PropertySet in the document for storing the local Event Triggers settings would visually appear to have worked, because the rules could then be seen in the Event Triggers dialog, under the correct events, but then the actual 'triggering' was not happening.  What was needed was to simply create a temporary, empty internal iLogic rule in the document, then create the special, hidden PropertySet, then add some properties in it, then when done, delete the temporary rule again.  That process seemed to fix the issues where the triggering was not working after code based manipulations of the local Event Triggers settings.  Usually, if the document already had some internal rules or forms, this was not an issue.  But file migration may simply be another layer of complication that can be involved.  The older file may simply need to be saved again first, which should automatically migrate it to the latest version of Inventor.  That may fix the issues.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 10 of 13
Frederick_Law
in reply to: Hendrik_Bu

Since 2023.4, I haven't notice any missed trigger.

Just updated to 2023.5.

My trigger is on external rules.

I don't have any internal rule.

Message 11 of 13
Hendrik_Bu
in reply to: Frederick_Law

So there is some hope for the future.

My triggers are for external rules too.

Message 12 of 13
Hendrik_Bu
in reply to: WCrihfield

Thanks, that was very insightful.

 

The ipt-files in questions were already saved/migrated, so that was not the issue. But you were right, the ilogic-addin "hasinterest" was false for these files, as opposed to other files that are working fine.

When I added an empty local ilogic rule to the part, the "hasinterest" changed and the triggers worked even when opened in a new Inventor session.

If the local ilogic rule is deleted, the file goes back to "hasinterest" = false.

 

Maybe there is a better way to make these files "interesting" but it is a workaround.

I guess I will have a rule checking for files with "hasinterest" = false and just add empty rules to those files automatically.

Message 13 of 13
Hendrik_Bu
in reply to: Hendrik_Bu

Just in case anybody is looking for answers, this is what I ended up integrating in our Rule that runs on Save for all ipt-files:

If ThisDoc.Document.DocumentInterests.HasInterest("{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}") = True
	Logger.Debug("hasInterest")
ElseIf ThisDoc.Document.DocumentInterests.HasInterest("{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}") = False
	Logger.Debug("hasInterest False ")
	iLogicVb.Automation.AddRule(ThisDoc.Document, "TriggerRule", "'This rule is used to activate the iLogic environment.")
	Logger.Info("The local rule TriggerRule was created to activate the iLogic environment.")
End If

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report