AssemblyComponentDefinition throws member not found

AssemblyComponentDefinition throws member not found

mrattray
Advisor Advisor
1,372 Views
7 Replies
Message 1 of 8

AssemblyComponentDefinition throws member not found

mrattray
Advisor
Advisor

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.

Mike (not Matt) Rattray

0 Likes
Accepted solutions (1)
1,373 Views
7 Replies
Replies (7)
Message 2 of 8

xiaodong_liang
Autodesk Support
Autodesk Support

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?

 

0 Likes
Message 3 of 8

mrattray
Advisor
Advisor

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.

Mike (not Matt) Rattray

0 Likes
Message 4 of 8

xiaodong_liang
Autodesk Support
Autodesk Support

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?

0 Likes
Message 5 of 8

mrattray
Advisor
Advisor
Well, this is frustrating.
When I posted that file I did the same steps you did in order to reproduce the problem multiple times and each time threw the error. Now, after the holiday, I tried again in order to record a video for you and I can no longer reproduce the problem either with this file nor the original file.
I'm confident that this will come up again as it seems to be an issue that comes and goes. When it does I'll be sure to get a video of it.
In the mean time, do you have any theories as to what could cause something like this? If you did get an error what would be the first thing you looked at?
Mike (not Matt) Rattray

0 Likes
Message 6 of 8

mrattray
Advisor
Advisor

I knew it would crop up again. This time it's in a part file. Here's a video I captured here.

I'll attach the part file to this post.

Mike (not Matt) Rattray

0 Likes
Message 7 of 8

xiaodong_liang
Autodesk Support
Autodesk Support
Accepted solution

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

 

 

Message 8 of 8

mrattray
Advisor
Advisor
This seems to work. Thank you, very much!
Mike (not Matt) Rattray

0 Likes