My code here is not quite rocket science:
I wrote this in 2010 and it's always worked fine. Pulled it up in 2013 today and it's flipping out with errors:
Error in rule: cage_type, in document: LADDER.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.ComponentOccurrence.Replace(String FileName, Boolean ReplaceAll)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
And the code:
if CAGE_TYPE = 1 Then
Component.Replace("LAD_CAGE_EXIT:1", "LAD_CAGE_EXIT_LEFT.iam", TRUE)
ELSEIF CAGE_TYPE = 2 Then
Component.Replace("LAD_CAGE_EXIT:1", "LAD_CAGE_EXIT_RIGHT.iam", TRUE)
ELSEIF CAGE_TYPE = 3 Then
Component.Replace("LAD_CAGE_EXIT:1", "LAD_CAGE_EXIT_LR.iam", TRUE)
ELSEIFCAGE_TYPE = 4 Then
Component.Replace("LAD_CAGE_EXIT:1", "LAD_CAGE_EXIT_NIL.iam", TRUE)
END IF
It's just an if then statement and it gets inside the 'if' so the error has to be in the component.replace section - however, i'm at a loss. The name of the assembly in the iam to replace is LAD_CAGE_EXIT:1, and it's been manually entered so it will not change. The iam file to replace it with is copy and pasted from windows into the code so there are no typo's. Lastly the assemblies are all in the same folder.
Why will this NOT replace the assembly like it used to??