Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can't get ComponentDefinitions of BOMRow object

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
sergio_duran
494 Views, 2 Replies

Can't get ComponentDefinitions of BOMRow object

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)

2 REPLIES 2
Message 2 of 3

Same here with version 2020. Sometimes it works well. sometimes it crashes with same exception.

Message 3 of 3

Solved with setting LOD to Master.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report