ilogic check out all open active documents only check the one showing on the screen

ilogic check out all open active documents only check the one showing on the screen

j.wang4QB4L
Explorer Explorer
367 Views
4 Replies
Message 1 of 5

ilogic check out all open active documents only check the one showing on the screen

j.wang4QB4L
Explorer
Explorer
M1 = MessageBox.Show("Do you want to check Out all open files?", "Vault Check-out", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If M1 = vbYes Then
	Dim oDoc As Inventor.Document
	Dim docs As Documents
	docs = ThisApplication.Documents
	For i = 1 To docs.VisibleDocuments.Count
		oDoc = docs.VisibleDocuments.Item(i)
		'invoke Check In dialogbox
		ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckoutTop").Execute2(False)
	Next 
	MessageBox.Show("Vault Check-out Complete!!!!", "Vault Check-out")
Else
	MessageBox.Show("Not Successful!!!!","Vault Check-out")
End If 
Return

This is the ilogic I want to use for checking out all the open visible files. But it only check out one file from vault and the stop to proceed the rest.
Could anyone have a look and help me fix it?




 

0 Likes
Accepted solutions (1)
368 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy.goenen
Advocate
Advocate

Hello, one possibility could be that Inventor does not have Time to Checkout the File before you jump to the next, to test if thats the case:

Set your execute2 to True, so your rule waits for Dialogs to dismiss first, and then add a sleep instruction right after that

 

System.Threading.Thread.CurrentThread.Sleep(5000) 'time in milliseconds

 

If this solves the issue, you can shorten the sleep instruction to a point where you can safely assume the Checkout has been completed.

 

Another possibility: Which Document will the Command be

Executed on? (I dont know the Command behavior, and there is no Document specification) Is it only the Active one that gets checked out?

If Yes,

I assume it behaves the same as Clicking the CheckoutButton in the Toolbar, which will  Act for the currently Active, or Preselected Documents. In this case i suggset you Activate the Documents first, before calling the Checkout Command.

 

Fanden Sie diesen Beitrag hilfreich? Fühlen Sie sich frei, diesen Beitrag zu liken.
Wurde Ihre Frage erfolgreich beantwortet? Klicken Sie dann auf die Schaltfläche LÖSUNG AKZEPTIEREN

Inventor Versionen:
2025.2
0 Likes
Message 3 of 5

jeremy.goenen
Advocate
Advocate
Accepted solution

Hello,

i just run a test and here the result, add the Bold Red Line to you code and it should work, this will switch ActiveDocument before Calling the CheckoutCommand

 

	For i = 1 To docs.VisibleDocuments.Count
		oDoc = docs.VisibleDocuments.Item(i)
		docs.Open(oDoc.FullFileName,True)

 

Fanden Sie diesen Beitrag hilfreich? Fühlen Sie sich frei, diesen Beitrag zu liken.
Wurde Ihre Frage erfolgreich beantwortet? Klicken Sie dann auf die Schaltfläche LÖSUNG AKZEPTIEREN

Inventor Versionen:
2025.2
Message 4 of 5

WCrihfield
Mentor
Mentor

TIP:  Instead of using Documents.Open() method on a document that is already open, and specifying FullFileName, which may contain as much info as FullDocumentName...try using Document.Activate method instead (oDoc.Activate), because you already have the Document object (oDoc).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 5

jeremy.goenen
Advocate
Advocate

That would be the proper way to do it, but it wasn't showing up in my Methods list.

Fanden Sie diesen Beitrag hilfreich? Fühlen Sie sich frei, diesen Beitrag zu liken.
Wurde Ihre Frage erfolgreich beantwortet? Klicken Sie dann auf die Schaltfläche LÖSUNG AKZEPTIEREN

Inventor Versionen:
2025.2
0 Likes