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: 

ControlDefinition.Execute2(True) from iLogic rule is raising COM error E_FAIL (Unspecified Error) when triggered from Parameter Change event

0 REPLIES 0
Reply
Message 1 of 1
saifP9SUR
135 Views, 0 Replies

ControlDefinition.Execute2(True) from iLogic rule is raising COM error E_FAIL (Unspecified Error) when triggered from Parameter Change event

I've added a control definition named, say, "MyAddInCommand" in my add-in.

Then an iLogic rule in my assembly model has the following line of code which executes that internal command.

 

ThisApplication.CommandManager.ControlDefinitions.Item("MyAddInCommand").Execute2(true)

 

That's dead simple. Works like a charm when I run the rule. 

 

But that awesome line of code has its hissy fit when the rule is triggered from the "Any User Parameter Change" event.

saifP9SUR_0-1712226680804.png

The notorious COM exception E_FAIL is raised. And this was the stack trace from .NET COM interop.

 

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.ControlDefinition.Execute2(Boolean Synchronous)
at ThisRule.Main() in rule: MY_RULE_v2, in document MyAssembly.iam:line 3
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

But it works with other triggers like "Before Save Socument".

 

Am I missing any formalities in the event handler method in my add-in, or even anything else?

 

 

Labels (3)
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