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

iLogic form not updating between open documents when they become active

Anonymous

iLogic form not updating between open documents when they become active

Anonymous
Not applicable

Does anyone have this issue. 

I have created lots of external iLogic rules and when I manually run any of these rules in any open document they all work fine.

To make things easier I created a global form, with which I can press a button and fire the corresponding iLogic rule.

This works well for all rules in a newly opened drawing, but when I move to another already open drawing certain rules don't work. If I close the form and reopen the form in that already open drawing all the rules work again.

 

I have the event trigger on "open drawing" to fire a rule which loads the form, so if I only open one drawing at a time I have no problems...less than ideal.

All my code is pretty robust, with "thisapplication.activedocument" and " oDoc.ActiveSheet" etc to look only at the current document

Any suggestions?

 

Using Inv2018.3

64 bit

 

0 Likes
Reply
Accepted solutions (2)
2,216 Views
23 Replies
Replies (23)

rhasell
Advisor
Advisor

Hi

 

As far as I know, this is not possible. It has been mentioned a few times in the past already.

 

What I have done, is place a Field showing the active file relating to the displayed form. At least I can see at a glance if the loaded form is or is not current.

(The example is a drawing form, but I have the same for the Modeling environment.)

 

active file.JPG

 

Reg
2025.2
0 Likes

Anonymous
Not applicable

I have seen the other posts around lamenting the lack of "globalform.close". This would be a possible way to solve my issue. I could insert the close form code at the start of any of my rules and then "globalform.show" and then run the rest of the rule.

The form rules that seem to work between active drawing are the ones that do something to the idw, although not all of them. The ones that don't work between active drawings are the ones that are doing something to the model reference.

Is Inventor holding the first active drawing model reference in the ilogic form memory? and if it is can you code it to clear memory and then reload the model reference of the active file?

I might try the same process with a vba form and see if that solves it.

The part number in the form certainly helps, and you can see which file it is stuck on.

 

0 Likes

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Try to use ThisDoc.Document instead of ThisApplication.ActiveDocument to get active document (Drawing Document). This might help in your situation.

 

Thanks and regards,

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes

Anonymous
Not applicable

Thanks Chandra,

 

I have used the "thisdoc.document"  and it still fails in the form. I have added the iProperties "Part Number" to the form as was suggested, and I can see that it doesn't change when going between active documents, it only displays the part number of the drawing the form was opened in.

If i run the iLogic external rules by clicking on them and hitting run rule in any active document the rule always works. The problem still appears to be that the form does not refresh its memory between active documents when it comes to referenced model documents, and creating pdf's calling the pdf addin.

For now I can keep closing and opening the form between active documents.

 

Regards

 

Jim

0 Likes

bradeneuropeArthur
Mentor
Mentor
Accepted solution
You need to pass the document to your form. But that is not easy in I logic. I prefer to use VBA or better .net. then these issues are solved easily. Like the issue here and modal and modeless forms and all the other benefits. Secondary: believe me it will become easier for you......

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

Anonymous
Not applicable

Branden can you make a simple rule VB.Net to run as a straight VBA code to use like a reload button for the global form?????

0 Likes

bradeneuropeArthur
Mentor
Mentor

Of course.

I am far from my desk now.

Earliest on Monday I am able to send you an example either VBA or Vba.net.

What do you prefer?

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

Anonymous
Not applicable

I prefer VB.net if able

0 Likes

bradeneuropeArthur
Mentor
Mentor

Could you please send me a private message. I am working on a solution. Seems that it works....

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

bradeneuropeArthur
Mentor
Mentor

@Anonymous

Could you provide me the Add-in setup in VB.net from your side.

Than I will paste my piece of code in it to make this work.

It works for me but the add in is made for Inventor 2019.

To let it work I need your add in for your version of Inventor.

Otherwise I can give you the steps you need to take to let this work.

 

let me know what you prefer.

 

Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Dimension Component! | Partlist Export! | Derive I-properties! | Vault Prompts Via API! | Vault Handbook/Manual!
Drawing Toggle Sheets! | Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

Anonymous
Not applicable

I am a newbie progammer in Inventor. I use rules and ilogic. I have done some programing in excel via Vb.net. Just now i am reading about inventor addinns. I see it is a powerful tool, so i would prefer the steps if possible......

 

Of the subject, I have learned ilogic programing a lot in the past few yeary. It was time consuming so I must say i am a little scared about learning inventor add-inn programing. Any thoghts and recomadations to share for a newbie?

0 Likes

bradeneuropeArthur
Mentor
Mentor

Don't hesitate to ask questions!

After all you will see that it was not that hard to learn. And you will have more possibilities that are much easier than with ilogic. You will also see the benefits afterwards.

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

bradeneuropeArthur
Mentor
Mentor

Start by creating Your first add in from template.

Please let me know if this is done successfully...

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

Anonymous
Not applicable

bradeneurope thank you for the help. I am starting to learn about Inventor addins, but i want to learn it slowly. I have learned a lot about inventor's API programing in the last year and I want to test a lot of programs i am using right now.

Updating between open documents is very important when using invetor forms(not sure how it works for addin) but i would appriciate if you send me or post it here the code for the add in needed or the addin alone and how it works.... of course if you are able

0 Likes

bradeneuropeArthur
Mentor
Mentor

@Anonymous

are you able to create your add in setup yourselves with visual studio.

this makes it a little easier for me.

because i can post my add in of ourse but i don't  have all your settings available here.

that makes it a little complicated.

let me know if this is possible for you

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

Anonymous
Not applicable

No I don't . During the weekend i will learn it then i will contact you,ok? 

0 Likes

bradeneuropeArthur
Mentor
Mentor

@Anonymous

that would be helpfull.

Do you understand what i mean and what the problem is from my side?

 

this is the code you need to place in your add in:

 
Public Sub Activate(ByVal addInSiteObject As Inventor.ApplicationAddInSite, ByVal firstTime As Boolean) Implements Inventor.ApplicationAddInServer.Activate
            ' Initialize AddIn members.
            g_inventorApplication = addInSiteObject.Application

            ' Connect to the user-interface events to handle a ribbon reset.
            m_uiEvents = g_inventorApplication.UserInterfaceManager.UserInterfaceEvents
            appevent = g_inventorApplication.ApplicationEvents            ' TODO: Add button definitions.
            f = New Form1(g_inventorApplication)

 

 



Private Sub appevent_OnActivateDocument(DocumentObject As _Document, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, ByRef HandlingCode As HandlingCodeEnum) Handles appevent.OnActivateDocument If BeforeOrAfter = EventTimingEnum.kAfter Then ) Try f.Show() f.Text = DocumentObject.DisplayName 'f.Refresh() Catch ex As Exception 'MsgBox("g") End Try End If End Sub Private Sub appevent_OnOpenDocument(DocumentObject As _Document, FullDocumentName As String, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, ByRef HandlingCode As HandlingCodeEnum) Handles appevent.OnOpenDocument If BeforeOrAfter = EventTimingEnum.kAfter Then Try f.Show() f.Text = DocumentObject.DisplayName 'f.Refresh() Catch ex As Exception MsgBox("h") End Try End If End Sub

 

 

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

Anonymous
Not applicable

You need a specific add-in setup to make this code work?

0 Likes

bradeneuropeArthur
Mentor
Mentor

yes, with the API from inventor there is also a template delivered and installed.

this add in is to create your actual add in and is needed for this coding I posted.

because I am running inventor 2019 this will not work for you if you don't use the same version.

if the add in configuration is complete, this add in doesn't do anything, because there is no actual code in it.

at this moment it starts for you as programmer to add your specific codes.

so actually the inventor add in setup doesn't do anything till you add your buttons and codes and modules etc. etc.

 

you understand now?

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes