- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Does not work for me, I am getting this error....
Probably something simple
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@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")
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Also need your thoughts, on how to suppress/close the ilogic/forms pop up/dialog box while checking in..
It comes at intermediate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
You can set options for vault dialog suppression.
Vault tab > Vault Options > Dialog Supression ![]()
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Suppression is available for Check in / check out dialog only.. Apart from this i need to suppress the ilogic forms dialog..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For Example,
If there are 5 visible drawings, only first & last are getting checked in..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.