8 Replies Latest reply on Apr 28, 2011 5:11 AM by Wolfgang_Antrey

    How to extract data from symbol using automation

    navit.alaouf

      Hi,

      I'm developing an application that supposed to automate some of the librarian work.

      While exploring the automation capabilities of LM I encountered some difficulties which I hope some of you could help me.

      In general, the application will create a new part using an existing symbol in the library.

      I managed to create the part and assigned the symbol, but I couldn't make a preliminary search to check if the symbol exists and extract his pin mapping data and the gate number.

      Is there a way to reach this data?

      Thanks,

      Navit

        • 1. Re: How to extract data from symbol using automation
          john_dube

          Hi Navit,

           

          You need to use the Part Editor interface, which is documented in the Library Manager and Library Editors automation manual.

           

          The Part Editor interface includes a symbolreference object that lists the pins, and a pinmapping object that keeps track of gates and slots.

           

          John

          • 2. Re: How to extract data from symbol using automation
            navit.alaouf

            Thank you john for your answer,

            I know this object and I used it, but it doesn't give me all the information I need.

            I can see the pin names but not the numbers.

            I'm also trying to read the data I see in the symbol editor - pcb properties: parts number (=number of gates), ref designator and the pin number.

            Also I first need to find the symbol in the library before creating the part. This is a preliminary request for the operation.

            When trying to access the symbol partition, I only succeeded in going throw the different partition but not the symbol object.

             

            For example, in this code, the application doesn't enter the first IF clauses (sym is null)

             

            For Each symPartition In appObj.ActiveLibrary.Partitions(MGCLMObjectType.kSYMBOL)

                        For iSym = 1 To symPartition.Count

             

                            Dim sym = symPartition.Item(iSym)

                            If sym IsNot Nothing Then

                                If sym.AssociatedParts.Count = 0 Then

                                    Debug.WriteLine("Symbol " & sym.PartitionName & ":" & sym.Name & " has no associated parts")

                                End If

                            End If

             

                        Next

                    Next

             

             

             

            I used the example given in the automation manuale "Part pin mapping definition". It's almost all I have to do, but it should be based on existing symbols. So I need to be able to find them and extract all the data I need for the mapping.

             

            Thanks,

            Navit

            • 3. Re: How to extract data from symbol using automation
              john_dube

              Hi Navit,

               

              Please refer to Creating PDB’s for Dx Symbol library from DxDatabook

               

              There is no automation interface to read symbols directly, you need to choose one of the following approaches:

              1. read the ascii file
              2. place a symbol onto a schematic then use DxDesigner methods to loop over attributes and connections
              3. use TCL script in Symbol Editor

               

              The script referenced above parses the ascii file, but I would recommend approach number 2 instead.

               

              Not sure why symPartition.Item is returning null, do you have any empty symbol partitions?

               

              John

              • 4. Re: How to extract data from symbol using automation
                navit.alaouf

                Thank you John,

                 

                I tried to run the script you gave me throw that link and it crashes all the time (see picture attached).

                 

                I tried to follow the code and understand what it does.

                From what I understand, it collects the attributes each part has according to the associate library. Then it deletes all parts existing in the LM and create everything from scratch. Is it right?

                 

                Unfortunately, since I can't get it running, I can't test it to see if it helps me.

                 

                 

                Does option 1 - read the ascii file of the symbol could be something I can based my application?

                Is there some documentation of the ascii format?

                Is it something that is going to last over the expedition upgrades?

                Thanks,

                Navit

                • 5. Re: How to extract data from symbol using automation
                  Wolfgang_Antrey

                  We use the scripts John gave you.

                   

                  We use the scripts to create a PDB in EE7.9 - we modified the scripts from Mentor to our needs.

                  Like creating LOG files for each DxDatabook section - adding verbose logging in case of trouble shooting .....

                   

                  I also modified the script in a second stage just to add new parts or to recreate incomplete parts.

                  What this script cannot do are attributes like PINSWAP !!!

                   

                  I did some experimental things for common mode chokes - it worked.

                   

                  The Script original script uses attributes from EE2005.3 (REFDES, VALUE, PKG_TYPE) these values are comming out from an Access Database.

                  It take the values an builds a PDB in EE7.9

                   

                  Wolfgang

                  • 6. Re: How to extract data from symbol using automation
                    john_dube

                    Hi Navit,

                     

                    Make sure the dxdb.vbs and DxDesignerSymbol.vbs are saved to a directory in your WDIR, and make sure every library has the appropriate primary key for the Part Number.

                     

                    As I mentioned, I would recommend option #2, place the symbol in a schematic to read the properties and connection. The ascii file format is not documented and could become obsolete with any future release.

                     

                    John

                    • 7. Re: How to extract data from symbol using automation
                      john_dube

                      Hi Wolfgang,

                       

                      The PINSWAP attribute is interpreted by the symbol parsing code, see the SymbolBlock.SetSwapGroups function.

                       

                      The PDB builder uses the swap identifier that is calculated by the SetSwapGroups, namely the SymbolPin.SwapIdentifier property.

                       

                      It is possible that the some complex PINSWAP expressions may not be supported, but the typical swap expressions should work fine.

                       

                      John

                      • 8. Re: How to extract data from symbol using automation
                        Wolfgang_Antrey

                        Hi John,

                         

                        Sorry - that I wrote PINSWAP do not work - yes it supports the typical settings. More complex swaps are not supported like [(A,B),(C,D)].

                        The scripts work pretty fine.

                         

                        Wolfgang