iLogic Error: Object reference not set to an instance of an object

iLogic Error: Object reference not set to an instance of an object

Brian.Price
Advocate Advocate
1,150 Views
2 Replies
Message 1 of 3

iLogic Error: Object reference not set to an instance of an object

Brian.Price
Advocate
Advocate

I am working on moving some rules I have been using to  external, so that I don't have to go through and update each rule in each part/assembly.

 

I am stuck with the error: "Object reference not set to an instance of an object".

 

Here's the other info with the error message.

 

System.NullReferenceException: Object reference not set to an instance of an object.
at iLogic.CadAssemblyUtil.FindComponentOccurrence(Document rootDoc, Object compoName, Boolean topLevelOnly, Boolean inTopLevelContext)
at iLogic.CadCompoOrDoc..ctor(Document rootDoc, Object oName)
at iLogic.ParamDynamicFinder.GetParameterInCompoOrDoc(Object compoOrDocName, String paramName)
at iLogic.ParamDynamic.set_Item(Object compoOrDocName, String paramName, Object value)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

 

SyntaxEditor Code Snippet

Parameter("SHELL PL1 - A:1", "ShellPL1ID")=Parameter("ShellPL1ID")

 

I have narrowed it down to just this parameter change.

The weird thing is, is that the error pops up and then Inventor proceeds to change the part according to the rule, so the rule is actually working. It just keeps throwing up an error before it changes it though.

 

The part it is changing is a just circular contour flange. The part is pretty simple and if I add this rule to the assembly with the part in it. It works just fine with no errors.

 

Thanks for the help.

0 Likes
1,151 Views
2 Replies
Replies (2)
Message 2 of 3

Lewis.Young
Collaborator
Collaborator

Hello,

 

At the start of the code you can try adding this:

 

SyntaxEditor Code Snippet

On Error Resume Next

If in doubt, post the whole code here and i will try have a proper look

 

Lewis Young
Windows 7 x64 - 32GB Ram
Intel Xeon E5-1620 v2 @ 3.70GHz
nVidia Quadro M2000 - 4GB
Inventor Professional 2017.3
Vault Basic 2017
3ds Max 2018

0 Likes
Message 3 of 3

Brian.Price
Advocate
Advocate

It still displays the error and does not move to the next function as there is none.

0 Likes