AnsweredAssumed Answered

ProE files won't check in after variable update

Question asked by Benjamin Abshire on Apr 5, 2012
Latest reply on Apr 5, 2012 by Jeff Sweeney

I’m having trouble getting Pro/E files to check back in after a variable is updated. The code below checks out and updates the variable correctly for SolidWorks and Pro/E files (as evidenced in the Data Card). It then checks in a SolidWorks file just fine but fails on all Pro/E files with the error: E_EDM_INVALID_FILE, The format is not recognized. But the file is already in the vault so obviously it is a recognized format.

 

I am using Enterprise PDM 2012 SP1.0 with the EPDM Addin “Add/Renamer” from SolidWorks and the Pro/E Connector for Wildfire 5.0. I'm compiling the .NET 4.0 code in MSVB 2010 Express and using Interop.EdmLib 5.15.

 

Note: If I comment out the Update the Variable section, the Pro/E files check out and in just fine. The error only occurs when I change something.

 

Here is the code

 

Imports EdmLib

Module Module1

    Sub Main()
        On Error GoTo Err_Main
        Dim Vault As IEdmVault7 'Vault object
        Vault.Login("Admin", "PassWord", "PDM_Vault")

        Dim myFileObj As IEdmFile5 = Nothing
        Dim MyRetFldrObj As IEdmFolder5 = Vault.RootFolder
        Dim FilePath As String = "C:\PDM_Vault\Projects\Test Area\CAD\101-A20020.drw"
        'Dim FilePath As String = "C:\PDM_Vault\Projects\Test Area\CAD\101-A20020.slddrw"

        Dim loc As Integer = Len(FilePath) - InStr(FilePath, ".")
        Dim FileExt As String = UCase(Microsoft.VisualBasic.Right(FilePath, loc))

        MyRetFldrObj = Vault.RootFolder
        myFileObj = Vault.GetFileFromPath(FilePath, MyRetFldrObj) 'Get the interface of the file and its parent folder

        myFileObj.LockFile(MyRetFldrObj.ID, 0) 'Check out the file

 

        '***************Update the variable***************

        Dim varEnum As IEdmEnumeratorVariable8
        varEnum = myFileObj.GetEnumeratorVariable

        Select Case FileExt
            Case Is = "SLDDRW"
                varEnum.SetVar("Revision", "@", NewRev)
            Case Is = "DRW"
                varEnum.SetVar("Revision", "generic", NewRev) '<-- Not sure if "generic" is the correct configuration name to use. It does update the datacard correctly.
        End Select
        varEnum.Flush()
        varEnum.CloseFile(True)

        '***************Update the variable***************

 

        Dim NewRev As String = "A"
        myFileObj.UnlockFile(0, "Revision variable updated to " & NewRev & ".") 'Check in the file with comment  *** Here is where if fails ***
        Exit Sub

 

Err_Main:
        Dim ErrName As String = ""
        Dim ErrDesc As String = ""
        If Not Vault Is Nothing Then
            Vault.GetErrorString(Err.Number, ErrName, ErrDesc)
            MsgBox("ErrHld initiated. Errors: " & ErrName & " " & "Description: " & ErrDesc)
        Else
            MsgBox("Error Number: " & Err.Number & " Description:" & Err.Description)
        End If
    End Sub

End Module

 

Any Suggestions?

Outcomes