Using iLogic with C#

Using iLogic with C#

Anonymous
Not applicable
2,671 Views
3 Replies
Message 1 of 4

Using iLogic with C#

Anonymous
Not applicable

Hi, I'm trying to interface with the iLogic add-in via a .Net c# program. When I access a method from the iLogicAuto "object", Visual Studio 2013 throws an error: 'object' does not contain a definition for 'Method Name Goes Here'. When I use the "dynamic" data type instead of "object", I don't receive any errors but, then the methods don't work. Any suggestions?

0 Likes
2,672 Views
3 Replies
Replies (3)
Message 2 of 4

Balaji_07
Advocate
Advocate

Hi Eric,

 

Are you trying to execute iLogic from .NET code?

 

If yes, then refer the below vb.net snippet and convert it to C#

 

If this does not work, give more description on your code or paste your code, so that we can analyse where you have went wrong.

 

************************************

 

Dim _iLogicAutomation As Object
Dim iLogicAddIn As ApplicationAddIn = m_inventorApplication.ApplicationAddIns.ItemById("{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}")
iLogicAddIn.Activate()
_iLogicAutomation = iLogicAddIn.Automation
_iLogicAutomation.RunExternalRule(odoc, externalRule)

 

*************************************

 

Thanks,

Balaji A

 

Accept this post as Solution if  you found it usefull and do not forget to hit Kudos! Smiley Wink

0 Likes
Message 3 of 4

Anonymous
Not applicable

That's my point. I have lots of VB.Net code that works just fine. It's when I convert it to C# is when the issue arises.

0 Likes
Message 4 of 4

rjay75
Collaborator
Collaborator

Code in an iLogic rule will not directly translate and run in C#. Even if it's written using C# syntax but uses any iLogic specific methods, like iProperty.Value... etc.. Any of the snippets on the side it won't run in C# as the objects those methods are based on don't exist outside of the iLogic API.

 

To reuse the existing rules from C# you'd have to do as mention previously. Get a reference to the iLogic add in and call the rules by name from C#.

0 Likes