I have two assembly files which throw a "member not found" error when running the following line of code in iLogic:
oAsmCompDef = ThisDoc.Document.ComponentDefinition
I've tried with declaring oAsmCompDef as either ComponentDefinition or AssemblyComponentDefinition and without declaring it. All variations fail.
I tried one of these assemblies on a co-workers machine with no difference.
Other assembly files run fine.
I'm using Inventor 2015.
Any ideas would be appreciated.
Solved! Go to Solution.
Solved by xiaodong_liang. Go to Solution.
Hi,
I gave a simple test on my Inventor 2015. It works well. The attachment is the video.
Does this problem occur with specific document?
Sorry, I should've attached the file to begin with.
Please, open the attached file. It's an empty assembly with just one rule (for reproduction purposes). Skip any missing references, they're not needed to show the issue. Try running Rule1. It only contains the above code which should throw a member not found error.
Hi Mike,
sorry, my video was not uploaded successfully last time.
I used your assembly to test again. The rule can still work without error. The video is available at:
https://autodesk.box.com/s/t4d4z1o0bvnn5u555zbl
Could you take a look?
Hi Mike,
I got the comments from our engineer team. Could you check if it helps?
This problem is caused by interaction with other addins. It depends on the history of a particular Document object in a session. It’s hard to reproduce. But there is a workaround: declare a document object of a specific type.
Instead of the statement:
oAsmCompDef = ThisDoc.Document.ComponentDefinition
In an assembly, use these statements:
Dim assemDoc As AssemblyDocument = ThisDoc.Document
oAsmCompDef = assemDoc.ComponentDefinition
In a part, use these:
Dim partDoc As PartDocument = ThisDoc.Document
oPartCompDef = partDoc.ComponentDefinition