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
pdb_db = part_ed_dlg.OpenDatabaseEx(job, False)
If part_ed_dlg.LockServer() Then
msgbox("Could not lock database for writing")
Public Sub DropLib()
'Close the open library and release hooks
pdb_db = Nothing
part_ed_dlg = Nothing
To start access to the Part Editor functionality, run GetLib(), then DropLib() when you don't need it anymore. For example:
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
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.
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 .
Hi, I'm using part of your droplib function,
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
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.
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