Hi everyone,
I have an iLogic rule using API objects, methods and properties that iterate through the contents of the BOM rows. However, sometimes I get an error when getting the ComponentDefinition of the BOM Row (oCompDef = oRow.ComponentDefinitions.Item(1)). For some reason, sometimes it works and sometimes it doesn't. I'm always working with a custom LOD but I always switch to Master when running the BOM rules. Additionally, I've checked the BOM API sample "Using the BOM APIs API Sample" and I don't see any difference the way the ComponentDefinition of the row is set.
Do you have any idea why this is happening? Thanks in advance!
Here is the error:
Error in rule: Rule1, in document: Assembly1.iam
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Inventor.BOMRow.get_ComponentDefinitions()
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
Solved! Go to Solution.
Solved by Francois.NICAISE. Go to Solution.
Same here with version 2020. Sometimes it works well. sometimes it crashes with same exception.