8 Replies Latest reply on Feb 17, 2010 2:11 PM by gprintzis

    Read and manipulate Part Attributes in PADS Libraries

    PR

      Hello,

       

      Is there a possibility to read out and manipulate Part Attributes directly via Scripts?

       

      Does somebody know where to get detailed information about handling PADS Libraries with script or macro?

      ("PADS Automation Server Help"-Documents seems to be not complete or at least too less detailed!)

       

      thx for your response!

        • 1. Re: Read and manipulate Part Attributes in PADS Libraries
          esko.leppanen

          Hi

           

          I have not full ansver for Yours problem but I try same matter.

           

          First step I have make script with basic what read library list > read parttypes from library > put one part (any parttype) to the shematic.

          This works wery vell.

           

          Second step is read all parts and them attributes to Excel. (PADS script examples support ready this feature)

           

          Now You can manipulate attributes in Excel.

           

          Same script than Step 2 can put attributes back to the parts in the schematic.

           

          All this is clear and works with three different scripts and it is not difficult.

           

          My single trouble is save parts to back library, right part to right library.

           

           

          Somebody say that script can controls PADS menu items and its a way to make lo of different things...

          I never try:(

           

          I hope that this help You

           

          (Sorry my bad English)

          • 2. Re: Read and manipulate Part Attributes in PADS Libraries
            PR

            Hello esko,

             

            Thank you for your response!

             

            Can you tell me, how i can read attributes (like "Geometry.height") from multiple libraries in one list?

            • 3. Re: Read and manipulate Part Attributes in PADS Libraries
              esko.leppanen

              Hi

               

              This is example script for reading all library and all parts from library to the shematic.

              It add attribute CurrentLib and type in to attribute name of library where part is,

               

              You can enlarge script so that it report all attributes to the Excel.

               

              Dim X1 As Object
              Dim Row As Integer
              Dim Col As Integer
              Sub Main
              Set X1 = CreateObject("Excel.Application")  'open new Excel-sheet
              X1.Workbooks.Add
              X1.Visible = True
              Set cell = X1.ActiveCell
              Row = 2
              Col = 1
              cell.Item(1, 1) = "PartType"
              cell.Item(1, 2) = "Library"
              Set items = GetLibraryItems()

              For Each item In items
                On Error GoTo ErrHandle
                Set Parts = Item
                If Parts.type = plogLibraryItemTypePartType Then
                 cell.Item(Row, 1) = item
                 cell.Item(Row, 2) = item.Library

                 Set comp = ActiveDocument.ActiveSheet.AddComponent(Item,,2000,10000)
                 Comp.selected = True
                
                 cell.Item(Row, 1) = item
                 cell.Item(Row, 2) = item.Library
                 Temp = cell.Item(Row, 2)
                 If comp.Attributes("CurrentLib") Is Nothing Then comp.Attributes.Add("CurrentLib", Temp)
                 'Row = Row+1
              Takaisin:
                End If
              Next item

              GoTo Loppu
              ErrHandle:
              Err.Clear
              cell.Item(Row, 2) = "Decali missing or something else..."
              Row = Row+1
              GoTo Takaisin


              Loppu:
              X1.Columns("A:V").AutoFit

              End Sub

              • 4. Re: Read and manipulate Part Attributes in PADS Libraries
                PR

                Thank's a lot!

                We'll try this ASAP ...

                • 5. Re: Read and manipulate Part Attributes in PADS Libraries
                  PR

                  Hello,

                   

                  I'm not able to use or understand getting my specific attribute value.

                   

                  In this case (see pic) i would like to get the value of the attribute "ID-NR".

                  Attributes.jpg

                  Can you explain me following line in this script:

                  Set comp = ActiveDocument.ActiveSheet.AddComponent(Item,,2000,10000)

                   

                  do you have a better reference manual than " PADS Layout Automation Server Reference" ?

                   

                   

                  Thank You!

                  lG

                  • 6. Re: Read and manipulate Part Attributes in PADS Libraries
                    esko.leppanen

                    Hi

                     

                    This line put new component from library to the shematic in cordinate 2000,1000.

                    When You run script, all parts from library will be to placed the shematic.

                    Now You can see attributes of all parts.

                     

                    If You want read the attribute of part You can try this example:

                     

                    'Print ID-NR attribute of all parts of shematis to then debug window

                    For Each Comp In ActiveDocument.Components

                         MyVar = comp.Attributes("ID-NR")

                         Debug.Print MyVar

                    Next Comp

                     

                     

                    If You want write the attribute of part You can try this example:

                     

                    'Add and write ID-NR attribute and increment value to all parts of the shematic

                         A = 1

                    For Each Comp In ActiveDocument.Components

                         If comp.Attributes("ID-NR") Is Nothing Then comp.Attributes.Add("ID-NR","")     'This line add attribute if it missing

                         comp.Attributes("ID-NR") = A

                         A = A + 1

                    Next Comp

                     

                     

                    I'm hopefull that I understand Your's trouble now and this is it what You want to know.

                     

                    EL

                    • 7. Re: Read and manipulate Part Attributes in PADS Libraries
                      PR

                      Hello,

                       

                      Now it works ...

                       

                      Thank You!

                      • 8. Re: Read and manipulate Part Attributes in PADS Libraries
                        gprintzis

                        Here is a tool I have been using, it is free for up to 5 to 10 parts.

                         

                        http://www.protocadeng.com/gpage10.html