ilogic scripts are triggered too early when the new or opened document not has fully loaded and led to error.

ilogic scripts are triggered too early when the new or opened document not has fully loaded and led to error.

andreas.jonssonF98YC
Enthusiast Enthusiast
282 Views
2 Replies
Message 1 of 3

ilogic scripts are triggered too early when the new or opened document not has fully loaded and led to error.

andreas.jonssonF98YC
Enthusiast
Enthusiast

Hi 

The triggers "New document" and "after open document" run the scripts before the documents load. some of the codes has been solved with delay loops but in some cases it does not work and it comes fatal error message for ilogic. The Code works absolutly fine when the code has fully loaded so it is not the problem with the code. is there a code feature in ilogic that one can use to check if the part has load and then the code start? 

 

Example:

I would like to trigger a script that deletes the triggers and then recreate the triggers with updated codes. but it becomes fatal error because I think it do not feels the event triggers and _iLogicEventsRules property since it is not fully loaded yet

 

 

0 Likes
283 Views
2 Replies
Replies (2)
Message 2 of 3

JhoelForshav
Mentor
Mentor

Hi @andreas.jonssonF98YC 

Have you tried using

ThisApplication.UserInterfaceManager.DoEvents

Whenever Inventor needs to catch up on its call queue? That usually works for me when my code "runs faster than inventor" 🙂

0 Likes
Message 3 of 3

andreas.jonssonF98YC
Enthusiast
Enthusiast

hi @JhoelForshav 

 

No I have seen it but not understood how to use it. Do you have an exampel how you loop the ThisApplication.UserInterfaceManager.DoEvents when document is loaded and then start go through the script?

0 Likes