AnsweredAssumed Answered

Find Associated Symbols for each Part in Library Manager (Automation)

Question asked by eduardocustodio on May 15, 2018



I'm trying to create a python script that simply opens a library and goes through all parts and prints the associated symbols for each one.


Currently I have something like this:


lmc = "mylib.lmc"


client = win32com.client

app = client.Dispatch("LibraryManager.Application")

lib = app.OpenLibrary(lmc)


allpartitions = lib.Partitions(enum.kPART)


for partition in allpartitions:

   for part in partition:

   print part.Name, part.PartitionName, part.type

   # print part.AssociatedSymbols


This piece of code runs without errors. As expected it shows the name, partition and type for each part in the library. example output:

1234 resistors 1

2345 resistors 1

3456 resistors 1




However, if I un-comment the "part.AssociatedSymbols" it does not work:

AttributeError: '<win32com.gen_py.LibraryManager Type Library.IMGCLMLibraryObject instance at 0x59124072>' object has no attribute 'AssociatedSymbols'

This happens because when iterating the partition, the returned items are MGCLMLibraryObject and not MGCLMPart.


Question: Any suggestion for retrieving one MGCLMPart from a library?


More information on the variable types for the code above:

app = {ILibraryManagerApp} <win32com.gen_py.LibraryManager Type Library.ILibraryManagerApp instance at 0x59632536>

lib = {IMGCLMLibrary} <win32com.gen_py.LibraryManager Type Library.IMGCLMLibrary instance at 0x59096520>

allpartitions = {IMGCLMPartitions} None

partition = {IMGCLMPartition} None

part = {IMGCLMLibraryObject} <win32com.gen_py.LibraryManager Type Library.IMGCLMLibraryObject instance at 0x59124072>


Thank you!