Hi
We have been experimenting with Parallel threading. The situation is that I have an assembly that contains multiple parts (approx. 40) which all have contained "almost" the same code. In order to rationalize this; we have rearranged the code in such way that we now only reference External iLogic rules form these 40 part files (only one place to revise the code if necessary).
The side effect to this rationalization has been tha we have problems in executing the codes in parallel, see this simplified example:
Imports System.Threading.Tasks Parallel.For(1,40, Sub(h As Integer) iLogicVb.RunRule ("Part "& h &"", "iTriggerRule") End Sub)
Now all of these 40 part files try to execute their code.
'Configutation of Part files iTrigger=iTrigger0 iLogicVb.RunExternalRule("Cut configuration") iLogicVb.RunExternalRule("Bracing of the part") iLogicVb.RunExternalRule("Parameter context")
As they all are dependent upon running the same external rules the result is that not all part files are updated according to the required design requirements. It seem as if one of the part files calls the external rule and the rule is "busy" handling another part file it just terminates without warnings or errors.
Can multiple part files run the same external rule at the same time?
Is there some form of queue?
I do not get any warnings or errors, the partfiles just do not update. How can I make sure that all the part files run the external rules and is there a way of checking this?
Regards
Kari
Solved! Go to Solution.
Solved by Holgarsson. Go to Solution.
Solved by philippe.leefsma. Go to Solution.
Hi Kari,
iLogic is based on the Inventor API, which doesn't support multithreading and parralel tasks, so there is no chance iLogic can take advantage of parallel programming for the moment.
Being a COM API, the calls to the Inventor API are just getting queued in the order they are performed and then being executed sequentially, however with the iLogic extra layer and the potentially complex inter-dependencies between the rules, it is possible to have side effects like the one you mentionned.
My advice would be just not make use of parralel programming when using Inventor API or iLogic as you will hardly get any benefit out of it anyway.
Regards,
Philippe.