Prevent display update while running rule

Prevent display update while running rule

s342014
Explorer Explorer
916 Views
3 Replies
Message 1 of 4

Prevent display update while running rule

s342014
Explorer
Explorer

Hi,

 

I'm working on an assembly where I use iLogic and Forms to update dimensions, constraints, and parts.

It all works well, but when I run my "Update rule", which updates all rules in the assembly, I want to prevent Inventor from  updating the display until all parts and settings are updated.
The closest I've come is using a suggestion I found on these forums earlier:

 

ThisApplication.ScreenUpdating = False 
            ... some iLogic commands ...

ThisApplication.ScreenUpdating = True

 

However, this freezes the whole application, while I only want to prevent the assembly display to not update.

I've seen this being done on other assemblies, but cannot for the life of me figure out how it is done.

 

I hope I've stated my issue in an understandable way, please ask for additional info if that is needed.

0 Likes
917 Views
3 Replies
Replies (3)
Message 2 of 4

JelteDeJong
Mentor
Mentor

This are the options that i know of that do something similar:

ThisApplication.AssemblyOptions.DeferUpdate
ThisApplication.UserInterfaceManager.UserInteractionDisabled
ThisApplication.ScreenUpdating
ThisApplication.SilentOperation

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 4

s342014
Explorer
Explorer
Thank you for the answer.
As stated in my post, ThisApplication.UserInterfaceManager.UserInteractionDisabled does pretty much what I want done, but not exactly, as it locks the entire application (the icon even disappears from the Windows taskbar).

As of now, it seems this is the closest I can get, thank you for responding.

Even though your response comes close to solving my issue, I will not mark it as a solution, as I hope other users may give a "better" solution.

0 Likes
Message 4 of 4

yan.gauthier
Advocate
Advocate

What I do in those case is to set InvApp visibility to false and display a progress bar to let know the user something is happening (example is in VBA)

 

Public Sub ASub()

Dim invapp As Inventor.Application
Dim progBar As ProgressBar
Dim MainAssembly As AssemblyDocument
Dim refDoc As Object

Set invapp = ThisApplication

On Error GoTo MyErr'Handle further error by exiting the sub
If TypeOf invapp.ActiveDocument Is AssemblyDocument Then
    Set MainAssembly = invapp.ActiveDocument
    

    Set progBar = invapp.CreateProgressBar(False, MainAssembly.AllReferencedDocuments.count, "ProgressBarName", False)
    
    invapp.Visible = False 'Hide inventor during routine
    

    For Each refDoc In MainAssembly.AllReferencedDocuments ' Get all referenced file in assembly
        progBar.UpdateProgress
        'do work!
    Next refDoc
    
Else
    MsgBox "Active File is not an Assembly"
End If

MyErr:
If Err Then
    MsgBox "Unexpected error during routine: " & Err.description, Title:="RoutineName"
    Err.Clear
    invapp.Visible = True
    If Not progBar Is Nothing Then
        progBar.Close
    End If
    Exit Sub
End If

invapp.Visible = True
progBar.Close

End Sub