5 Replies Latest reply on Sep 30, 2013 7:20 AM by vpoblet

    Library Manager scripting

    MaBUa

      Hi all,

      I play with scripting in library manager and I have a problem with validating license.

      I used a part of script from tutorial.... see the error message dialog.

      It seems the software dowsn't know the VALIDATE property.

      Can somebody help me?

       

      Many thanks

      Martin

        • 1. Re: Library Manager scripting
          Patrick.Cashman

          Martin,

           

          I'm not sure if it's the best practice, but I don't validate the server and it does't cause any problems.  This is the module I use to connect to the library:

           

           

           

          Option Strict Off

          Option Explicit On'

           

          Public Module Automation_Interface

           

              Public job As String

              Public lib_path As String

           

              Public part_ed_dlg As MGCPCBPartsEditor.PartsEditorDlg

              Public pdb_db As MGCPCBPartsEditor.PartsDB

           

              Public partitions As MGCPCBPartsEditor.Partitions

              Public partition As MGCPCBPartsEditor.Partition

           

              Public parts As MGCPCBPartsEditor.Parts

              Public part As MGCPCBPartsEditor.Part

           

              Public cellrefs As MGCPCBPartsEditor.CellReferences

              Public cellref As MGCPCBPartsEditor.CellReference

           

              Public symbs As MGCPCBPartsEditor.SymbolReferences

              Public symb As MGCPCBPartsEditor.SymbolReference

           

              Public props As MGCPCBPartsEditor.Properties

              Public prop As MGCPCBPartsEditor.Property

           

              Public celldlg as CellEditorAddinLib.CellEditorDlg

              Public celldb As CellEditorAddinLib.CellDB

           

              Public clpartitions As CellEditorAddinLib.Partitions

              Public clpartition As CellEditorAddinLib.Partition

           

              Public cells As CellEditorAddinLib.Cells

              Public cell As CellEditorAddinLib.Cell

           

              Public Sub GetLib()

                  'Creates a handle to the Parts Editor in Library Manager

                  part_ed_dlg =CreateObject("MGCPCBLibraries.PartsEditorDlg")

                  pdb_db = part_ed_dlg.OpenDatabaseEx(job, False)

                  If part_ed_dlg.LockServer() Then

                      'do nothing

                  else

                      msgbox("Could not lock database for writing")

                  End If

           

              End Sub

           

              Public Sub DropLib()

                  'Close the open library and release hooks

           

                  'part_ed_dlg.SaveActiveDatabase

                  part_ed_dlg.UnlockServer

                  part_ed_dlg.CloseActiveDatabase

                  pdb_db = Nothing

                  part_ed_dlg = Nothing

              End Sub

           

          End Module

           

           

          To start access to the Part Editor functionality, run GetLib(), then DropLib() when you don't need it anymore.  For example:

           

                  GetLib()

                  partitions = pdb_db.Partitions

           

                  For Each partition In partitions

                      parts = partition.parts

                      For Each part In parts

                          props = part.properties

                          If props.Count > 0 Then

                              For Each prop In props

                                  prop.delete()

                              Next

                          End If

                      Next

                  Next

                  part_ed_dlg.SaveActiveDatabase()

           

                  DropLib()

           

           

          I originally got the starting point for this from another post here in the Communities area.  I forget where or what the subject was, but if you keep looking, you'll probably find it.

           

          -Patrick

          • 2. Re: Library Manager scripting
            MaBUa

            Hi,

            it is strange that I don't have to call licensing for authentication in LIBRARY MANAGER

            but not including it in script for ExpeditionPCB I get an erroro that I HAVE to use licensing call for authentication...?

            I'm a litle confused by it.

             

            But if you say don't have to use it in my script (for library manager) I don't use it .

             

            Thank you

            Martin

            • 3. Re: Library Manager scripting
              vpoblet

              Hi, I'm using part of your droplib function,

               

                    

                      part_ed_dlg.CloseActiveDatabase

                      part_ed_dlg.Quit

                    

                     Set pdb_db = Nothing

                     Set part_ed_dlg = Nothing

               

              I've tried with .closeactiveDatabase, even with .Quit and if the program is still opened due some other functions, the license is not released, the program is still using a library license!!

               

              I don't know how to release the license without closing the program

               

              Any help well be apreciated, thanks

               

              Victor      

              • 4. Re: Library Manager scripting
                Patrick.Cashman

                Martin & Victor,

                 

                I don't know why it works as it does.  I think there is some problem with the way library manager works with Windows.  If you open Library Manager in its normal mode, as in not with automation but opening it through Windows, and close it, it keeps the executable running and the license locked.  We have asked about this with Mentor and so far no response.  Stopped bothering.  It's a pain, but every so often you have to open Task Manager and kill it that way.

                 

                Sorry I don't have a better solution. If you (or anyone) finds one, please make it known.

                 

                Any Mentor guys reading this, please post up and let us know if we are doing something wrong or if there is a fix in the works for this problem.

                • 5. Re: Library Manager scripting
                  vpoblet

                  ThankS for the answer.. knowing than it is a bug, I've used part of the code of a script uploaded byt timo_kyyronen to kill the running task and now I've solved the issue!

                   

                   

                  Automation: kill unnecessary librarymanager.exe process while closing LIbraryManager application

                  Created on: Aug 13, 2012 12:32 AM by timo_kyyronen - Last Modified: Aug 13, 2012 12:39 AM by timo_kyyronen