uncatcheble error when running a single external rule twice at the same time

uncatcheble error when running a single external rule twice at the same time

Jacob__with__a__k
Enthusiast Enthusiast
314 Views
5 Replies
Message 1 of 6

uncatcheble error when running a single external rule twice at the same time

Jacob__with__a__k
Enthusiast
Enthusiast

version: Inventor Professional 2022.5 

problem: when you have 2 instances of Inventor open and those run the same external rule at the same time this error pops up:

Jacob__with__a__k_1-1691742962606.pngJacob__with__a__k_2-1691742995474.png

error happens when the external rule is called from a different rule or as event trigger

 

usually this happens:

-when the same external rules that gets called multiple times in both documents at the same time

-when opening/closing multiple documents that have the same external rule as event trigger "open/close document"

 

placing a try/catch around iLogicvb.RunExternalRule(..) does not catch the error!

 

Anyone noticed this as well? are there solutions for this problem?

I would be fine with an option to automatically log this error instead of a reocurring pop-up that pauzes al code...

or if it could be catched...

As long as this problem exists I won't be able to turn certain reocurring rules into external rules because I'd be limited to be working in a single instance of Inventor...

0 Likes
315 Views
5 Replies
Replies (5)
Message 2 of 6

Andrii_Humeniuk
Advisor
Advisor

Hi @Jacob__with__a__k . I suspect this may be related to your external rules using ThisApplication.ActiveDocument to retrieve the document instead of ThisDoc.Document.

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

0 Likes
Message 3 of 6

WCrihfield
Mentor
Mentor

Hi @Jacob__with__a__k.  That is a fairly common error.  Have you recently renamed the external rule, or moved the external rule file to a different folder, or added another folder in its path by putting the external rule file into a sub folder of the folder it was originally in?  Doing that will cause your previously created Event Triggers for that rule to not be able to find it.  When this has happened, you usually just need to open your Event Triggers dialog, remove that rule from all events, then add it back manually again.  That fixes the 'path' of the rule within the stored settings.  Also, if you have a main directory specified within your iLogic Configuration settings, but your external rule is not within that directory directly, but within a sub directory of that listed directory, and that sub directory is not specifically listed in your iLogic Configuration settings, that will also cause those types of problems.  It will want you to specify the name of that sub directory, then "\", then the name of the external rule, when trying to run that rule from another rule.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 6

Jacob__with__a__k
Enthusiast
Enthusiast
The rule from the pictures that I posted doesn't use ThisApplication.ActiveDocument 😞
Also the error is undetecteble by a catch in either a rule that triggers the external one or in the external rule, so it doen't look to be an error in the code self? cause that should be catcheble

Looking at the errormessage the error happens while Inventor is retrieving the code from the external rule?
like it can't retrieve or find the actual .txt file with the code in...

Granted, a single one of the rules that sometimes gives me this error does have ThisApplication.ActiveDocument written in it, and I'll change that one (just to be sure)
0 Likes
Message 5 of 6

Jacob__with__a__k
Enthusiast
Enthusiast

hi,

no renamed, replaced or moved rules (I would remember cause that's a hassle when your external rules are also checked in in vault 😉 ), also they do work fine on their own, just not when running them with 2 instances of inventor at the same time.

I do have a quite few subfolders, but I am already used to specifying the subfolder when adding the rules to events or when triggering them manually

Jacob__with__a__k_0-1691754365003.png

Jacob__with__a__k_1-1691754431514.png

Either way, I'll try adding all the subfolders to the directory and check if the errors are still happening

 

0 Likes
Message 6 of 6

WCrihfield
Mentor
Mentor

Interesting situation.  I do not currently use Vault, so I could not make any suggestions related to that, but I just assume that two sources asking to check out the same rule at the same time is not a problem, since that seems to simply create a local read/write copy of the file.  But maybe the Vault will not let two sources use the same file at the same time?  When you often see in some of those error messages is a file path pointing to a locally cached copy of the rule's code, which I assume is a stability/performance related routine that the iLogic add-in does routinely.  I believe this may have to do with keeping the code from being able to change while it is running, because we have the ability to create custom event handler type routines from iLogic rules, and those routines can not be changed while they are 'active' (running in the background).  Maybe it can not have two rules with the same exact name running at the same time though...probably another stability/security related behavior.  Not sure, because I very seldomely use two instances of Inventor at the same time, on the same computer.

 

Edit:  Oh, and by the way, I don't know if you noticed before, but all of those iLogic methods for running another rule are actually functions (return something, not just do something), and they all return an Integer.  The value of that Integer indicates whether the function was able to run the rule or not (not whether the rule ran successfully or not).  It should return Zero (0) if successful.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)