Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
vpeuvion
495 Views, 5 Replies

Inventor 2022 : Call iLogicVb in an external EXE application.

Hello

Is it possible to call iLogicVb as ILowLevelSupport in an external EXE application?
What I would like to do:

Dim MyiLogicVb As Autodesk.iLogic.Interfaces.ILowLevelSupport
MyiLogicVb =

I did a lot of searching without success. I don't know if this is possible, does anyone know and can help me?
Any help would be appreciated, thanks.

Vincent.

Louie_Harvey
in reply to: vpeuvion

Hi vpeuvion sorry if I'm barking up the wrong tree but cant you use "Autodesk.iLogic.Interfaces.IiLogicAutomation" it seems to have nearly all the same Methods?

 

Public Sub GetAuto()
    Dim Doc As Inventor.Document = Globals.m_inventorApplication.ActiveEditDocument
    Dim iLogicAddinGuid = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}"
    Dim iLogicAddin As ApplicationAddIn = DirectCast(Nothing, ApplicationAddIn)
    Dim iLogicAutomation As IiLogicAutomation = DirectCast(Nothing, IiLogicAutomation)
    Try
        iLogicAddin = Globals.m_inventorApplication.ApplicationAddIns.ItemById(iLogicAddinGuid)
        iLogicAutomation = CType(iLogicAddin.Automation, IiLogicAutomation)
    Catch
        MessageBox.Show("fail")
    End Try
End Sub

 

 

vpeuvion
in reply to: Louie_Harvey

Hi @Louie_Harvey ,

Thank you for your answer, I can easily access the Automation property.

But I can't access iLogicVb which is at a higher level.

I'm not sure it's possible, maybe it's too "high" and access is not possible outside iLogic?

vpeuvion_0-1679416147738.png

Vincent.

Louie_Harvey
in reply to: vpeuvion

Hi Sorry for a late reply I've looked into it and ILowLevelSupport doesn't even show up in "autodesk.inventor.interop.dll" i went though a few .dll's in "C:\Program Files\Autodesk\Inventor 2022\Bin" and found it in "Autodesk.iLogic.Interfaces.dll" but it only provides the class not a way to use it like ilogicVb, I would say that ThisRule, ThisApplication, esc are native and cant be accessed outside the application but if u find a way around it please post it here sorry to be little help
WCrihfield
in reply to: vpeuvion

Hi @vpeuvion.  I do not create add-ins or exe's myself, but it looks to me like that 'iLogicVb' is just a term (like a variable) that is declared within the 'ThisRule' Class for us automatically in the background in the iLogic rule editor environment.  So, it seems to me that as long as you have included a reference to the Autodesk.iLogic.Interfaces resource, I'm thinking you should be able to simply recreate that same variable within your routine.  And I don't think you even need to instantiate it with the 'New' keyword.

Dim iLogicVb As Autodesk.iLogic.Interfaces.ILowLevelSupport

Likely the biggest catch in trying to use it in an external exe is that this is a resource for an Inventor ApplicationAddIn, which resides inside of the Inventor process, and likely only gets looked at after Inventor has fully loaded, and after the iLogic add-in has loaded, so that resource may be looking for / referring to / trying to access other accompanying resources that are only available after that stage in the process.  And I believe exe's run outside of the Inventor process, by design, making this an odd situation.  There may need to be accompanying resources referenced/imported in order to make that work.  But I am not an expert in coding for exe's, so I may not be making much sense here.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

vpeuvion
in reply to: WCrihfield

Hello @Louie_Harvey and @WCrihfield , thank you for your answers.
I really feel like you can't use it outside of iLogic, but you can declare it easily.
I did quite a bit of testing and when I was coding 

Dim iLogicVb As Autodesk.iLogic.Interfaces.ILowLevelSupport

I was getting an error saying 'iLogicVb was Nothing' when I tried to use it.
I tried creating a new instance and I got an error saying 'New' cannot be used on an interface.
I had thought to have found a track while passing by addIn.parent but I did not manage to find the continuation.

Dim addIn As ApplicationAddIn = ThisApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")
addIn.Parent


My EXE is started after Inventor is fully loaded, it connects to the current inventor application, I thought it was possible to grab the current application's iLogicVb.
I asked the question to a consultant who replied that it was not valid outside of ilogic.
Maybe since it's part of ThisRule.iLogicVb, it's only accessible when an iLogic rule is running.
For the moment I have no more ideas, I work in degraded mode by passing the Automation As IiLogicAutomation.
In any case thank you for your answers, if I have news I will post them.
THANKS.

Vincent.