Intermitent Problem with setting Paramaters Ilogic

Intermitent Problem with setting Paramaters Ilogic

ctrinch
Explorer Explorer
661 Views
6 Replies
Message 1 of 7

Intermitent Problem with setting Paramaters Ilogic

ctrinch
Explorer
Explorer

Hi,

 

I have been working on code in Ilogic to setup parts and assemblies with.  Recently I have found the need to update old parts and assemblies so i have created an external rule.  This rule works but occasionaly it will result in an error saying "Member not found. (Exception form HRESULT: 0x80020003 (DISP_E_mEMBERNOTFOUND))".  Unfortunately, I have not been able to force this error to occur.  Oddly enough the only way to get past the error is to close Inventor and restart it at which time the rule runs fine. 

 

More Info (On Error)

System.Runtime.InteropServices.COMException (0x80020003): Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
   at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
   at LmiRuleScript.Main()
   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

I have traced the problem to this line of code but have not been able to figure out how to correct it (in red).

 

Code

Imports Inventor.UnitsTypeEnum

 

Dim oParams As Parameters
oParams=ThisDoc.Document.ComponentDefinition.Parameters

.....

 

Any information on how to correct this would be greatly appreciated as I would like to roll this out to my Workgroup but cannot until this error is resolved.

0 Likes
662 Views
6 Replies
Replies (6)
Message 2 of 7

Vladimir.Ananyev
Alumni
Alumni

It is not easy to give an advice.   My first idea – ThisDoc points to wrong document.

Put temporary MsgBox just before the call to ThisDoc.  This could help you to track which document is used to get the Parameters collection:

MsgBox(ThisDoc.Document.FullFilename)
oParams=ThisDoc.Document.ComponentDefinition.Parameters

Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 7

ctrinch
Explorer
Explorer

Thanks for the advice I will try this and get back to you.

 

Chris

0 Likes
Message 4 of 7

ctrinch
Explorer
Explorer

I tested this theory.  The message box is identifying the doucment correctly.  Any other thoughts?

0 Likes
Message 5 of 7

rjay75
Collaborator
Collaborator

What kind of documents is it erroring on. For instance is it a DrawingDocument, PartDocument, AssemblyDocument etc..

 

Usually an error like that means the property you're requesting doesn't exist on that type object. Or you're loosing the reference to the object.

 

For instance if you're on a DrawingDocument it could fail as there's no defined ComponentDefinition.

 

Is it always failing on the same documents or same type of documents. If it's varying then it may not be that line of code.

 

 

0 Likes
Message 6 of 7

ctrinch
Explorer
Explorer

It happens with both Parts and Assemblies I do not use it on Drawings at this point. 

 

The reason I think the code I have is the problem is because thats where the computer runs to then errors out.  Also, it seems that this error appears at random and goes away at random.

0 Likes
Message 7 of 7

Vladimir.Ananyev
Alumni
Alumni

It could be useful if you transform problematic iLogic code to the equivalent VBA code for debug purposes.

VBA debugger provides you much more information on errorrs.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes