Error in Rule - InventorVb.RunMacro

Error in Rule - InventorVb.RunMacro

Anonymous
Not applicable
771 Views
4 Replies
Message 1 of 5

Error in Rule - InventorVb.RunMacro

Anonymous
Not applicable

Hello Everybody,

 

I have a macro, which one is working perfectly if I let run it from the Menu (Tools/Macros)

I made a little Rule to start this macro automaticly.

InventorVb.RunMacro("ApplicationProject", "Module2", "Perimeter")

If I try to use this Rule I got the following message:

 

Error in rule: Rule0, in document: Part1

User interrupt.

 

System.Runtime.InteropServices.COMException (0x80040561): User interrupt.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Inventor.InventorVBAMember.Execute(Object& FunctionReturnValue)
at iLogic.LowLevelInRule.RunMacro(String projectName, String componentName, String macroName, Object[] args)
at ThisRule.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

Unfortunately I can't find any solution to solve this problem. Can anybody help for me?

Thank you!

0 Likes
772 Views
4 Replies
Replies (4)
Message 2 of 5

Sergio.D.Suárez
Mentor
Mentor

Hi, try this ilogic code to trigger a macro, if you can not activate it with the previous code.

Dim oP As InventorVBAProject
For Each oP In ThisApplication.VBAProjects
	If oP.Name = "ApplicationProject" Then
	  Dim oC As InventorVBAComponent
	  For Each oC In oP.InventorVBAComponents
	    If oC.Name = "Module1" Then
	      Dim oM As InventorVBAMember
	      For Each oM In oC.InventorVBAMembers
	        If oM.Name = "prueba" Then ' "MyFunction"
	          oM.Execute()
	        End If
	      Next oM
	    End If
	  Next oC
	End If
Next oP

Check correctly the location path of the macro, otherwise it will not perform any action

1.jpg

 I hope this helps solve your problem


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 3 of 5

Anonymous
Not applicable

Hi,

 

Thank you for your help. Unfortunately the situation is the same. The macro completed, my costum property made, but I got the error message. I need to use this property in another Rule.

A solution could be for me a rule which can close this error message.

0 Likes
Message 4 of 5

Sergio.D.Suárez
Mentor
Mentor

Hi, What kind of error does the rule that provides you?


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 5 of 5

tmueller6RR3D
Participant
Participant

I have a similar issue. Apparently the "ApplicationProject" was not loading correctly when this was run from a .dll, but worked from a local rule. This resolved it. @Sergio.D.Suárez  Thank you very much! - Tim

0 Likes