Open ilogic forms from vb.net addin

Open ilogic forms from vb.net addin

Slothian
Contributor Contributor
953 Views
3 Replies
Message 1 of 4

Open ilogic forms from vb.net addin

Slothian
Contributor
Contributor

This one has me puzzled, can you open an ilogic form from an addin?

If so, do you need to know the name of the form to do so programatically?

 

Why - we have a large catalog of different design "templates" which generally have an ilogic form which controls the configuration of each design, ranging from dimension parameters to what components are used. Each template has a different name for the form and in 99% of cases only 1 form per template file. Only a handful of templates have a rule to open the form. I would like to add an "easy" button to the ribbon which allows access to the different configuration forms without knowing the name. I would need to make this work with our existing legacy files so renaming all the forms in the templates wouldn't be a solution.

Steve

0 Likes
Accepted solutions (1)
954 Views
3 Replies
Replies (3)
Message 2 of 4

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @Slothian ,

I did some testing and managed to open the first form in the active document like this:

Dim _invApp As Inventor.Application = GetObject(, "Inventor.Application")
Dim _iLogic As Inventor.ApplicationAddIn = _invApp.ApplicationAddIns.ItemById(
"{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")
Dim oDoc As Document = _invApp.ActiveDocument
_iLogic.Automation.AddRule(oDoc, "tempRule", "iLogicForm.Show(iLogicForm.FormNames.ElementAt(0))")
_iLogic.Automation.DeleteRule(oDoc, "tempRule")

I couldn't find a way to open iLogic forms via API so my workaround is to create a rule via API that opens the form and then simply delete the rule.

 

Message 3 of 4

Slothian
Contributor
Contributor

Thanks @JhoelForshav , that did the trick, never thought of that workflow!

 

One interesting note... adding this to an addin (load on start with inventor) worked fine for me, no hassles.

I usually test all code through a .exe plug-in that hooks into Inventor (same method as described in the myfirst plug-in tutorial) which allows rapid test and debugging without the need to constantly restart inventor.

When I tested this code in the plug-in, the form would display blank, and Inventor would hang, requiring me to restart Inventor.

If anyone knows why would be interested to hear any theories?

 

FYI runnign Inventor 2019.4 and VS2017

 

0 Likes
Message 4 of 4

JhoelForshav
Mentor
Mentor

Hi @Slothian,

I actually experienced the same problem with Inventor freezing while running this code from a windows forms app. Don't really know why. Maybe @MjDeck can answer that 🙂

 

I'm glad it worked for your purpose however!

0 Likes