5 Replies Latest reply on Nov 5, 2012 7:17 AM by jens.radeloff

    Library Automation: Problem with PartsEditorDlg (ErrorCode: H80040239)

    jens.radeloff

      Hi,

       

      I'm just trying to automate readout and analysis of our CentralLibrary. In order to do this I've written a dotnet application. The application based on differnet vbscript source code examples.

       

      Here the code:

      Private Shared LibPathName As String
      Private Shared ObjPartEditorDlg As New MGCPCBPartsEditor.PartsEditorDlg
      Private Shared ObjPartLibrary As MGCPCBPartsEditor.PartsDB


      Public Shared Function OpenMentorCentralLibPartEditor() As Boolean

           Try
                '---open CentralLib with Part Editor

                LibPathName = <Path to MentorCentralLib>

               ObjPartLibrary = ObjPartEditorDlg.OpenDatabaseEx(sFileName:=LibPathName, bReadOnly:=TRUE)

               

                OpenMentorCentralLibPartEditor = True

          

           Catch ex As Exception
                OpenMentorCentralLibPartEditor = False
           End Try
      End Function

       

      When running the result is an exception at codeline: "ObjPartLibrary = ObjPartEditorDlg.OpenDatabaseEx(sFileName:=LibPathName, bReadOnly:=TRUE)".

      The exception tells me: (0x80040239): The Central Library is incorrect or not migrated

       

      Then I'm doing the same with the CellEditorDlg the code works fine!!!

      Here the code:

      Private Shared LibPathName As String

      Private Shared ObjCellEditorDlg As New CellEditorAddinLib.CellEditorDlg

      Private Shared ObjCellLibrary As Object

       

      Public Shared Function OpenMentorCentralLibCellEditor() As Boolean

           Try

                 '---Open CentralLib with Cell Editor

                 LibPathName = <Path to MentorCentralLib>

                 ObjCellLibrary = ObjCellEditorDlg.OpenDatabase(LibPathName, True)

       

                OpenMentorCentralLibCellEditor = True

       

            Catch ex As Exception

                OpenMentorCentralLibCellEditor = False

            End Try

      End Function

       

      Thinks I tried:

      - working with a vbscript (with the well known CreateObject-Methode) --> same failure

      - Path to a Expedition PartDB.pdb instead of the CentralLib.lmc --> same failure

       

      Has anyone an idea??

       

      Thanks for help!!!

      Jens

        • 1. Re: Library Automation: Problem with PartsEditorDlg (ErrorCode: H80040239)
          al_layson

          'Here's the correct way to open/close PartsDB in VBScript, executed from library manager's File > Open Script

           

          Set libApp=Application 'currently opened Lib Mgr
          Set PartEdObj = CreateObject("MGCPCBLibraries.PartsEditorDlg")

          Set PartDB = PartEdObj.OpenDatabaseEx(libApp.ActiveLibrary.FullName)

          'Display Number of Partitions

          msgbox(PartDB.Partitions.Count)

          PartEdObj.Quit

          Set PartEdOb=Nothing

           

          Hope this helps,

          Al

          • 2. Re: Library Automation: Problem with PartsEditorDlg (ErrorCode: H80040239)
            jens.radeloff

            Hi Al,

             

            thank you for your answer. In the meantime I could find the real cause. Your code was not the solution but it led to the real cause...

             

            During my testings I did a copy of our official CentralLib. But I've never opened it by the Library Manager. After starting and opening the copy of the CentralLib, where came up a window with a message (see attachment). After confirming this message the failure were no longer present. So staring the Library Manager and trying to run a script from the Library Manager was the right way to solve the problem

             

            Thank you very much!

             

            Best regards,

            Jens

            • 3. Re: Library Automation: Problem with PartsEditorDlg (ErrorCode: H80040239)
              al_layson

              In actuality, you don't need to have library manager opened on a library to open the part editor. Reference script at http://communities.mentor.com/docs/DOC-2211. This is a batch library parts editor which can be executed within Library Manager's IDE or through the "mgcscript" command. Look towards bottom of script after "' 'Executor: Allows execution from command line or Application/IDE", to see how this is done. You will also need to review "mgcscript". There are two modes of script execution in Mentor, internal (script executed inside the mentor application), external (script executed outside the mentor application - requires mgcscript).

              Good Luck!

              Al

              • 4. Re: Library Automation: Problem with PartsEditorDlg (ErrorCode: H80040239)
                al_layson

                Just a correction on statement made "There are two modes of script execution in Mentor". This should be "There are two modes of script execution in the Expedition flow".

                • 5. Re: Library Automation: Problem with PartsEditorDlg (ErrorCode: H80040239)
                  jens.radeloff

                  Hi Al,

                   

                  thanks for the answer. Today I tried a couple of things. My problem was not the scripting mode but the copy of the CentralLib. I did the following procedure:

                   

                  1.) Copy our CentralLib(whole CentralLib folder) to a local path

                  2.) Rename the Local .LMC to another Lib-Name (let say "CentralLib.LMC" to "Test.LMC")

                  3.) Running my script outside the mentor application (without started Lib Manager)

                   

                  The problem is copying and renaming the CentralLib. If you only rename the "CentralLib.LMC" to "Test.LMC" there is no relation to the config file. The config file has the same name like the CentralLib itself (means in the example case: "CentralLib.cfg"). Because of missing this config file the failure happens. To solve this problem you can do two possible ways:

                   

                  Case #1:

                  1.) Copy our CentralLib(whole CentralLib folder) to a local path

                  2.) Rename the Local .LMC to another Lib-Name (let say "CentralLib.LMC" to "Test.LMC")

                  3.) Start the Lib Manager and open the local CentralLib (now you will be asked after the Mentor Flow and Updating)

                  4.) Running my script outside the mentor application (without started Lib Manager)

                  No Problems!!

                   

                  Case #2:

                  1.) Copy our CentralLib(whole CentralLib folder) to a local path

                  2.) Rename the Local .LMC to another Lib-Name (let say "CentralLib.LMC" to "Test.LMC")

                  3.) Rename the Local .CFG to the new Lib-Name too (let say "CentralLib.CFG" to "Test.CFG")

                  4.) Running my script outside the mentor application (without started Lib Manager)

                  No Problems!!

                   

                  Best regards,

                  Jens