Multiple Inventor Drawing Opened Files Check in

Multiple Inventor Drawing Opened Files Check in

SPALANIAPPANTN47S
Enthusiast Enthusiast
1,910 Views
9 Replies
Message 1 of 10

Multiple Inventor Drawing Opened Files Check in

SPALANIAPPANTN47S
Enthusiast
Enthusiast

Hi Guys,

I need to check in the multiple drawing files into vault by default macros in inventor.

 

For that, I tried using with the below code. 

 

Sub CheckInMultipleOpenDrawings()

Dim oDoc As Inventor.Document

For Each oDoc In ThisApplication.Documents.VisibleDocuments

If oDoc.DocumentType <> kDrawingDocumentObject Then
GoTo NextDoc

ElseIf oDoc.DocumentType = kDrawingDocumentObject Then

oDoc.Save

Set ControlDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop")
ControlDefinition.Execute2 (True)

oDoc.Close
End If

NextDoc:
Next

MsgBox "Checked-in the drawings"
End Sub

 

In that it will checking in only one or two files. Not working for all the opened drawing files.

 

If u have any ideas to check multiple drawing files via macro..

Please suggest..

0 Likes
Accepted solutions (1)
1,911 Views
9 Replies
Replies (9)
Message 2 of 10

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @SPALANIAPPANTN47S 

Executing a controldefinition will give the same result as clicking the button in the UI manually. Therefore, the check in command will be run on the document that is active at the time when you execute the command.

I think you'll get your desired result if you make sure to activate each drawing document before executing the command (oDoc.Activate). Otherwise it's like a lottery which document will be checked in (The one that gets activated when the previously active document is closed)

 

Try this 🙂

 

Sub CheckInMultipleOpenDrawings()

Dim oDoc As Inventor.Document

For Each oDoc In ThisApplication.Documents.VisibleDocuments

If oDoc.DocumentType <> kDrawingDocumentObject Then
GoTo NextDoc

ElseIf oDoc.DocumentType = kDrawingDocumentObject Then
oDoc.Activate 'Activate the drawing
oDoc.Save

Set ControlDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop")
ControlDefinition.Execute2 (True)

oDoc.Close
End If

NextDoc:
Next

MsgBox "Checked-in the drawings"
End Sub

 

0 Likes
Message 3 of 10

SPALANIAPPANTN47S
Enthusiast
Enthusiast

Thanks for your solution..

Its working now..

0 Likes
Message 4 of 10

Anonymous
Not applicable

Does not work for me, I am getting this error....

 

PowelMajewski2379_0-1609888267244.png

Probably something simple 

 

 

0 Likes
Message 5 of 10

JhoelForshav
Mentor
Mentor

@Anonymous 

This is VBA not iLogic... If you want to run it as an iLogic rule you could use something like this 🙂

For Each oDoc As Document In ThisApplication.Documents.VisibleDocuments
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Continue For
oDoc.Activate 'Activate the drawing
oDoc.Save
ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop").Execute2 (True)
If oDoc IsNot ThisDoc.Document Then oDoc.Close
Next
MsgBox("Checked-in the drawings")
0 Likes
Message 6 of 10

SPALANIAPPANTN47S
Enthusiast
Enthusiast

Also need your thoughts, on how to suppress/close  the ilogic/forms pop up/dialog  box while checking in..

 

It comes at intermediate.

 

 

0 Likes
Message 7 of 10

JhoelForshav
Mentor
Mentor

@SPALANIAPPANTN47S 

You can set options for vault dialog suppression.

Vault tab > Vault Options > Dialog Supression 🙂

 

Message 8 of 10

SPALANIAPPANTN47S
Enthusiast
Enthusiast

Suppression is available for Check in / check out dialog only.. Apart from this i need to suppress the ilogic forms dialog..

SPALANIAPPANTN47S_0-1610076918890.png

 

0 Likes
Message 9 of 10

SPALANIAPPANTN47S
Enthusiast
Enthusiast

For Example, 

If there are 5 visible drawings, only first & last are getting checked in..

0 Likes
Message 10 of 10

SPALANIAPPANTN47S
Enthusiast
Enthusiast

Hi Jhoel,

 

Even after providing the code to activate the document only two files are checking in..

 

For example , If i opened 5 Drawings (Name : 101,102,103,104 & 105)

Only First and last are getting checked in..

 

Is there any solution to check in for all the visible/opened drawings.

 

@JhoelForshav 

0 Likes