Can someone point me to the latest valid instructions to create an ilogic rule that will add add event triggers?
I've built my rule by piecing together various bits of code from here and there in the forum. I can get a before save event trigger to work, but once I try adding an "Any Model Parameter Change" trigger, this rule and/or any subsequent rules will not trigger. The non-working rules do appear in the event triggers dialog.
I can delete the trigger, then add it manually and it will fire as intended.
Many of the links I try to follow are broken or not applicable. I think I need to recreate my rule from scratch, utilizing the latest known good routine for adding event triggers.
Solved! Go to Solution.
Can someone point me to the latest valid instructions to create an ilogic rule that will add add event triggers?
I've built my rule by piecing together various bits of code from here and there in the forum. I can get a before save event trigger to work, but once I try adding an "Any Model Parameter Change" trigger, this rule and/or any subsequent rules will not trigger. The non-working rules do appear in the event triggers dialog.
I can delete the trigger, then add it manually and it will fire as intended.
Many of the links I try to follow are broken or not applicable. I think I need to recreate my rule from scratch, utilizing the latest known good routine for adding event triggers.
Solved! Go to Solution.
Solved by WCrihfield. Go to Solution.
Hi @j3scat. This process is entirely user originated, so there is no official set of instructions for it. That has been a known issue for years now. There is a small detail that most folks miss in this process. I actually believe that one of the Autodesk employees helped us figure it out once, not too long ago. I believe that you may simply need to have at least one other internal iLogic rule saved within the target document before you create and / or edit that hidden PropertySet, or the edits will not get properly registered behind the scenes. When you add an internal iLogic rule to a document, that adds what is known as a DocumentInterest to the Document for the iLogic add-in, which seems to be part of what is needed. But you can not simply add a DocumentInterest to the Document directly, without there actually being anything in the document that is iLogic related, or it seems it will just disappear again. Try that and let us know if that helps.
Wesley Crihfield
(Not an Autodesk Employee)
Hi @j3scat. This process is entirely user originated, so there is no official set of instructions for it. That has been a known issue for years now. There is a small detail that most folks miss in this process. I actually believe that one of the Autodesk employees helped us figure it out once, not too long ago. I believe that you may simply need to have at least one other internal iLogic rule saved within the target document before you create and / or edit that hidden PropertySet, or the edits will not get properly registered behind the scenes. When you add an internal iLogic rule to a document, that adds what is known as a DocumentInterest to the Document for the iLogic add-in, which seems to be part of what is needed. But you can not simply add a DocumentInterest to the Document directly, without there actually being anything in the document that is iLogic related, or it seems it will just disappear again. Try that and let us know if that helps.
Wesley Crihfield
(Not an Autodesk Employee)
Thanks for the feedback. While I was waiting, I looked around a bit through older forum posts that include the term "Event Triggers", and I found a thread that was started back in 2019, where Mike Deck (Autodesk employee and guru of all things Inventor API and iLogic related) responded to one of these inquiries and mentioned this little trick.
...but I think I was thinking of another similar post later than that one that I may have been trying to help out with at the time.
Wesley Crihfield
(Not an Autodesk Employee)
Thanks for the feedback. While I was waiting, I looked around a bit through older forum posts that include the term "Event Triggers", and I found a thread that was started back in 2019, where Mike Deck (Autodesk employee and guru of all things Inventor API and iLogic related) responded to one of these inquiries and mentioned this little trick.
...but I think I was thinking of another similar post later than that one that I may have been trying to help out with at the time.
Wesley Crihfield
(Not an Autodesk Employee)
That last link was very helpful.
In that thread it looked like the routine was to check for the required 'DocumentInterest'. If not found, create an internal rule, create the external rule trigger, then delete the internal rule.
In my code, I added a subroutine that tries performing the DocumentInterest check. When it doesn't find the required property set, Create an internal rule and immediately delete it. After returning to the Main sub, my code then adds the external rule triggers.
My initial test was a failure. However, if I run my create triggers rule twice; everything works. I double checked running my rule twice without calling the DocumentInterest propertyset check and the triggers don't fire. So far, with consistent testing, as long as I run the rule(that creates and deletes a blank internal rule) twice, my triggers function correctly.
That last link was very helpful.
In that thread it looked like the routine was to check for the required 'DocumentInterest'. If not found, create an internal rule, create the external rule trigger, then delete the internal rule.
In my code, I added a subroutine that tries performing the DocumentInterest check. When it doesn't find the required property set, Create an internal rule and immediately delete it. After returning to the Main sub, my code then adds the external rule triggers.
My initial test was a failure. However, if I run my create triggers rule twice; everything works. I double checked running my rule twice without calling the DocumentInterest propertyset check and the triggers don't fire. So far, with consistent testing, as long as I run the rule(that creates and deletes a blank internal rule) twice, my triggers function correctly.
Good to hear. I generally do the check at the beginning of my routine that will be editing the event triggers property set, then if it is not found, I add a rule named "DeleteMe" to the target document, then do all the editing needed, then check for a rule with that name in the target document, and if found, delete it. I was trying to use a single routine, either at the start, or at the end for a while too, but I believe after I split that added routine into two smaller chucks added to my regular routine for editing the PropertySet, that's when it started working better for me. Another thing that helps is having some internal iLogic rules and/or Event Triggers settings present in the 'template' files, that you start all your other new files from. That seems to carry over to the new files that are created from those templates, so that I do not have these troubles when dealing with them. I learned this from another user who was asking similar questions before. He was having these problems, but I wasn't, so he sent me a file to test on, and that file would cause the problems. I realized that most of my templates already had a 'history' of internal iLogic rules & event triggers settings, so I tried creating some truly NEW files from the templates provided by Autodesk, instead of from my own custom templates, then I started seeing those problems with those new files. That seemed to be part of the issue that helped me understand that there needed to be something in the file related somehow to the iLogic add-in. Then I saw another post from Mike Deck somewhere where he mentioned that little detail about the DocumentInterest and the trick with the temporary internal iLogic rule. It seems that either situation (internal iLogic rules being present, or event triggers settings having been created manually in it before) will cause there to be the needed DocumentInterest present.
The technique of editing that hidden PropertySet to edit the Event Triggers dates all the way back to early 2012 when users (primarily a person with user name "MegaJerk") started posting about their discoveries after doing a lot of trial & error snooping / testing.
Wesley Crihfield
(Not an Autodesk Employee)
Good to hear. I generally do the check at the beginning of my routine that will be editing the event triggers property set, then if it is not found, I add a rule named "DeleteMe" to the target document, then do all the editing needed, then check for a rule with that name in the target document, and if found, delete it. I was trying to use a single routine, either at the start, or at the end for a while too, but I believe after I split that added routine into two smaller chucks added to my regular routine for editing the PropertySet, that's when it started working better for me. Another thing that helps is having some internal iLogic rules and/or Event Triggers settings present in the 'template' files, that you start all your other new files from. That seems to carry over to the new files that are created from those templates, so that I do not have these troubles when dealing with them. I learned this from another user who was asking similar questions before. He was having these problems, but I wasn't, so he sent me a file to test on, and that file would cause the problems. I realized that most of my templates already had a 'history' of internal iLogic rules & event triggers settings, so I tried creating some truly NEW files from the templates provided by Autodesk, instead of from my own custom templates, then I started seeing those problems with those new files. That seemed to be part of the issue that helped me understand that there needed to be something in the file related somehow to the iLogic add-in. Then I saw another post from Mike Deck somewhere where he mentioned that little detail about the DocumentInterest and the trick with the temporary internal iLogic rule. It seems that either situation (internal iLogic rules being present, or event triggers settings having been created manually in it before) will cause there to be the needed DocumentInterest present.
The technique of editing that hidden PropertySet to edit the Event Triggers dates all the way back to early 2012 when users (primarily a person with user name "MegaJerk") started posting about their discoveries after doing a lot of trial & error snooping / testing.
Wesley Crihfield
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.