Save as of Vaulted file leaves the Vault Checkin command greyed out

Save as of Vaulted file leaves the Vault Checkin command greyed out

connor.ferguson
Advocate Advocate
504 Views
2 Replies
Message 1 of 3

Save as of Vaulted file leaves the Vault Checkin command greyed out

connor.ferguson
Advocate
Advocate

I am writing my own version of Inventor data standards and i'm handling the OnSaveAsDialogOnFileSaveAsDialog event to show my own form that ultimately saves the document via the API. This works fine for new files and even when a user does a save as. the issue i am having is that when a user does a save as of a file from Vault, the Vault Check in command is greyed out so the user has to close and re open the document and the command is available again. In the Vault browser window it says the file is read only but checking the file properties in window explorer it isn't.

 

 

To try to resolve i  am trying to close and reopen the document in Inventor which re opens the file without error but Inventor then becomes unresponsive and crashes. Code below shows what i am trying after my form has shown in the If NewFileFrm.RequiresOpen block.

 

 

    Private Sub UIEvents_OnSaveAsDialogOnFileSaveAsDialog(ByRef FileTypes() As String, SaveCopyAs As Boolean,
                                                              ParentHWND As Long, ByRef FileName As String, Context As NameValueMap,
                                                              ByRef HandlingCode As HandlingCodeEnum)

            Try

                    Dim InventorDoc As Document = Context.Item("TopLevelDocument")

                    If InventorDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Or
                        InventorDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Or
                        InventorDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then

                        If LoginToVault() = False Then
                            MsgBox("Save cancelled, log in to Vault through Inventor and try again", MsgBoxStyle.Information, "")
                            HandlingCode = HandlingCodeEnum.kEventCanceled
                        Else

                            Dim NewFileFrm As New NewFileForm
                            NewFileFrm.InventorDoc = InventorDoc
                            NewFileFrm.InvApp = InvApp
                            NewFileFrm.SaveCopyAs = SaveCopyAs
                            NewFileFrm.ShowDialog()

                            If NewFileFrm.Cancelled Then
                                HandlingCode = HandlingCodeEnum.kEventCanceled
                            Else
                                HandlingCode = HandlingCodeEnum.kEventHandled

                                If NewFileFrm.RequiresReOpen Then

                                    'Reopen the document when a save as has been performed to refresh it
                                    'not doing this leaves the the Vault check in command greyed out


                                    Dim DocumentFullFileName As String = InvApp.ActiveDocument.FullDocumentName
                                    InventorDoc.Close(True)
                                    InvApp.Documents.Open(DocumentFullFileName)

                                End If

                            End If

                        End If

                    Else
                        HandlingCode = HandlingCodeEnum.kEventNotHandled
                    End If           

            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Critical, "")
            End Try

        End Sub

 

 

I have tried rebuilding the document but that doesn't work either, any ideas?

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

connor.ferguson
Advocate
Advocate

An easier way to test the issue is to just download a locked file from Vault. Create an iLogic Rule in it then use the below snippet to do a save as and you won't be able the check the file into Vault.

ThisDoc.Document.SaveAs("<FILEPATH>", false)
0 Likes
Message 3 of 3

connor.ferguson
Advocate
Advocate
Accepted solution

Simple solution just execute the vault refresh command after doing a save as

 

InvApp.CommandManager.ControlDefinitions.Item("VaultRefresh").Execute()

0 Likes