iLogic - Close all files in the invisible mode

iLogic - Close all files in the invisible mode

M.iwanow
Participant Participant
1,384 Views
2 Replies
Message 1 of 3

iLogic - Close all files in the invisible mode

M.iwanow
Participant
Participant

Hi All.

Is there a way to close all files open in the invisible mode.

Or I just could clean up inventor memory.

Thaks

0 Likes
Accepted solutions (1)
1,385 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

For iLogic, you would have to have at least one visible document in order to run the rule.

 

 

Dim oApp As Inventor.Application = ThisApplication
Dim oDoc As Document

For Each oDoc In oApp.Documents
	oDoc.Close(TRUE)
Next

 

 

This will close all documents in your Inventor session (tested working). I did not find a flag to use to identify Invisible documents.

 

If you could be sure that the display name of every document was unique, you could compare the DisplayName of the document to the collection ThisApplication.VisibleDocuments and skip the close if it matches. That might look something like this. (Not tested)

Dim oApp As Inventor.Application = ThisApplication
Dim oDoc, vDoc As Document
Dim isVisible As Boolean = False

For Each oDoc In oApp.Documents
	For Each vDoc In oApp.Documents.VisibleDocuments
		If oDoc.DisplayName.Equals(vDoc.DisplayName) Then
			isVisible = True
		End If
		If Not isVisible Then
			oDoc.Close(True)
		End If
		isVisible = False
	Next
Next

I hope this helps.

 

Message 3 of 3

M.iwanow
Participant
Participant

Thanks a lot. It works grate.

0 Likes