Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Component.replace not working

0 REPLIES 0
Reply
Message 1 of 1
mslosar
625 Views, 0 Replies

Component.replace not working

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??

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report