7 Replies Latest reply on Mar 23, 2016 10:05 AM by Patrick.Cashman

    How to delete unwanted properties in part editor and symbols by easy method

    ks.lokesh@lnttechservices.com

      I did DC library translation to DX. We are going to use Dxdatabook now, So we decided to remove the properties in part editor and Symbol. Can anybody help on this how to remove the properties by automation method.

       

      Thanks

      Lokesh K S

        • 2. Re: How to delete unwanted properties in part editor and symbols by easy method
          ks.lokesh@lnttechservices.com

          Hi Peter,

           

           

           

          I have installed the Advanced Library Editor version ALE - v3.4.62 - x32.

           

          After opening the Advanced Library Editor I could not open LMC or connect to LMC. ALE is not connecting to Library. Attached is the error in picture.

           

           

           

           

           

          I am working on EE 7.9.5 version, Is it because of the reason may be the ALE version is not supporting to EE 7.9.5.

           

           

           

          Please help on this.

           

           

           

          Thanks

           

          Lokesh K S

          • 3. Re: How to delete unwanted properties in part editor and symbols by easy method
            jeremy_parker

            There seems to be a backwards compatibility issue with EE7.9 in the latest release that I'm trying to work through. Stay tuned.

            • 4. Re: How to delete unwanted properties in part editor and symbols by easy method
              ks.lokesh@lnttechservices.com

              Hi Peter,

               

               

               

              I have installed the Advanced Library Editor version ALE - v3.4.62 - x32.

               

              After opening the Advanced Library Editor I could not open LMC or connect to LMC. ALE is not connecting to Library. Attached is the error in picture.

               

               

               

               

               

              I am working on EE 7.9.5 version, Is it because of the reason may be the ALE version is not supporting to EE 7.9.5.

               

               

               

              Please help on this.

               

               

               

              Thanks

               

              Lokesh K S

              • 5. Re: How to delete unwanted properties in part editor and symbols by easy method
                jeremy_parker

                I just put a new 32-bit build up that might fix the EE7.9.X problem.

                • 6. Re: How to delete unwanted properties in part editor and symbols by easy method
                  ks.lokesh@lnttechservices.com

                  It is still not working for me, Please confirm me following doubts:

                  What is the ALE version which you fixed it. I tried with ALE - v3.4.64 - x32 version but it is not working.

                  Is it Standalone library manger license required for this.

                  In my system Microsoft .NET Framework 4.5.2 has been installed. Is this ok.

                  • 7. Re: How to delete unwanted properties in part editor and symbols by easy method
                    Patrick.Cashman

                    Here is code that will delete unwanted properties from PDB:

                         Sub delete_unwanted_props()

                              Get_Part_Editor()

                              partitions = pdb_db.Partitions

                              For Each partition In partitions

                                   parts = partition.parts

                                  For Each part In parts

                                       part.description = part.label

                                       props = part.properties

                                       If props.Count > 0 Then

                                            For Each prop In props

                                                 if not prop.name = "Height" then

                                                      prop.delete()

                                                 End If

                                                  'alternatively, you could reference a list of

                                                  'properties to keep, or a list to delete

                                                  'and compare prop.name to items in the list

                                            Next

                                       End If

                                  Next

                              Next

                              part_ed_dlg.SaveActiveDatabase()

                              Drop_Part_Editor()

                         End Sub

                    Here is the Get_Part_Editor subroutine, and global variables used by both subroutines:

                         Public Sub Get_Part_Editor()

                            '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, it's ok

                            else

                                 msgbox("Could not lock database for writing")

                            End If

                        End Sub

                        

                         Public job As String     'path to the central library .lmc file

                         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 props As MGCPCBPartsEditor.Properties

                        Public prop As MGCPCBPartsEditor.Property

                    This is written for vb.net, so the variable declarations include the 'As' statements.  You may have to adapt the code a bit if you are using EFM or vbscript to create your automation.

                     

                    Editing symbols is a different story. They are text-based files, so the easiest way is to edit the text files directly.  Here is an example script that does many kinds of operations on a symbol file.  It assumes that there is an externally declared arraylist called sym_file, which contains 1 line of the text file for each element of the arraylist.  If you are not using a .net platform for your scripts, you'd have to read the file into an array or something and reference that where I reference sym_file. 

                     

                    After editing the text according to your needs, you'd need to save the data back out to the original symbol text file. I'm assuming you know how to read and write from/to a text file, but if you don't, let us know in a reply and we can show you how.

                     

                    One more thing - working with the symbol files is very cryptic.  There is a some information available to decode everything in them.  If you need this information, send me your email address and I'll get it to you.  Without the decoder information, editing the symbol files can be very tricky.

                     

                         Sub edit_symbol()

                              Dim tmp, row() As String

                             

                              Dim n, i As Integer

                              dim top_pins, bottom_pins, num_pins as Integer

                              Dim val_idx, value_idx As Integer

                              dim x, x0, x1, y, y0, y1, fontsize as Long

                             

                              top_pins = 0

                              bottom_pins = 0

                              has_refdes = 0

                              has_partname = 0

                              has_value = 0

                              has_val = 0

                              num_pins = 0

                             

                              'first loop through to count the number of pins

                              For n = 0 To sym_file.Count - 1

                                   If instr(1, sym_file(n), "P") = 1 Then

                                        num_pins = num_pins + 1

                                   End If

                              Next

                             

                              'set digits per the number of pins

                              digits = 2

                              if num_pins > 100 then digits = 3

                             

                              'check the first line in the file for the units & precision

                              If instr(sym_file(0), "V 54") Then

                                   fix_precision()

                              End If

                             

                             

                              '--------------------------------------------------------------------------------------------

                              '                           LOOP THROUGH THE FILE TO GATHER INFORMATION AND FIX CERTAIN ITEMS

                              '--------------------------------------------------------------------------------------------

                             

                              val_idx = 0

                             

                              For n = 0 To sym_file.Count - 1

                                   'get bounding box size

                                   If instr(1, sym_file(n), "D") = 1 Then

                                        row = split(sym_file(n), " ")

                                        x0 = row(1) 'left

                                        x1 = row(3) 'right

                                        y0 = row(2) 'bottom

                                        y1 = row(4) 'top

                                        If x0 > x1 Then

                                             tmp = x0

                                             x0 = x1

                                             x1 = tmp

                                        End If

                                        If y0 > y1 Then

                                             tmp = y0

                                             y0 = y1

                                             y1 = tmp

                                        End If

                                       

                                   End If

                                  

                    '               'do all the pin-related tasks

                    '               'determine if there are pins on top and bottom

                    '               'go out to fix_pin_attributes() and make sure attribute locations etc are correct

                                   if mod_pins = true then

                                        If instr(1, sym_file(n), "P") = 1 Then

                        

                                             row = split(sym_file(n), " ")

                        

                                             Select Case row(7)

                                                  Case 0

                                                       'top side pins

                                                       top_pins = 1

                                                       side = 0

                                                  Case 1

                                                       'bottom side pins

                                                       bottom_pins = 1

                                                       side = 1

                                                  Case 2

                                                       'left side pins

                                                       side = 2

                                                  Case 3

                                                       'right side pins

                                                       side = 3

                                             End Select

                        

                                             fix_pin_attributes(n) ' go to fix_pin_attributes subroutine

                        

                                             'fix_pin_attributes will correct certain things about the pin attributes

                                             'before the script continues on.

                                        End If

                                   End if

                                  

                                  

                                  

                                  

                                   'change font to yellow

                                   If instr(1, sym_file(n), "Q 11 5 0") = 1 Then

                                        sym_file(n) = "Q 14 5 0"

                                   End If

                                  

                                   If instr(1, sym_file(n), "Q 3 5 0") = 1 Then

                                        sym_file(n) = "Q 14 5 0"

                                   End If

                                  

                                   'change pin number fontsize to size 8

                                   If instr(1, sym_file(n), "L") = 1 Then

                                        row = split(sym_file(n), " ")

                                        If row(3) <> 8 Then row(3) = 8

                                       

                                        tmp = ""

                                        For i = 0 To ubound(row)

                                             tmp = tmp & row(i) & " "

                                        Next

                                        'may need to take out the last space here

                                        sym_file(n) = tmp

                                   End If

                                  

                                   'change pin name fontsize to size 8

                                   If instr(1, sym_file(n), "A") = 1 Then

                                        row = split(sym_file(n), " ")

                                        If row(3) <> 8 Then row(3) = 8

                                       

                                        tmp = ""

                                        For i = 0 To ubound(row)

                                             tmp = tmp & row(i) & " "

                                        Next

                                        'may need to take out the last space here

                                        sym_file(n) = tmp

                                   End If

                                  

                                   'change font to SanSerif

                                   If instr(1, sym_file(n), "|FNTSTL") = 1 Then

                                        sym_file(n) = "|FNTSTL -1 5"

                                   End If

                                  

                                   'set pin and graphic object line width

                                   If instr(1, sym_file(n), "|GRPHSTL") = 1 Then

                                        row = split(sym_file(n), " ")

                                        row(4) = 2

                                        row(1) = 65535'16711935

                                        sym_file(n) = string.Join(" ", row)

                                   End If

                                  

                                  

                                  

                                   'look for existing REFDES, PART_NAME, VAL, & SCHEMATIC_VALUE properties

                                  

                                   tmp = sym_file(n)

                                   tmp = check_props(tmp)

                                   sym_file(n) = tmp

                                  

                                  

                                  

                                                 

                              Next'                                                    ***** END OF THE MAIN FOR LOOP *****

                             

                             

                             

                              'get rid of the val and value properties

                              For n = 0 To sym_file.count - 1

                                   if sym_file(n).length > 4 then

                                        If instr(1, sym_file(n), " VAL") then

                                             val_idx = n

                                        End If

                                   End If

                              Next

                              if val_idx > 0 then

                                   sym_file.removeat(val_idx + 2)

                                   sym_file.removeat(val_idx + 1)

                                   sym_file.removeat(val_idx)

                              End If

                             

                              For n = 0 To sym_file.count - 1

                                   If instr(1, sym_file(n), " Value") then

                                        value_idx = n

                                   End If

                              Next

                             

                              If value_idx > 0 Then

                                   sym_file.removeat(value_idx + 2)

                                   sym_file.removeat(value_idx + 1)

                                   sym_file.removeat(value_idx)

                              End If

                             

                             

                             

                              '--------------------------------------------------------------------------------------------

                              '                                 CREATE THE LINES THAT WILL ADD REFDES, PART_NAME, AND VALUE

                              '--------------------------------------------------------------------------------------------

                              'set up to place refdes

                              If top_pins = 0 Then

                                   x = (x1 - x0)/2

                                   x = round(x/5)*5

                                   y = y1 + 10

                              Else

                                   x = x0

                                   y = y1

                              End If

                             

                              fontsize = 8

                              tmp = ""

                             

                              '-----------------------------------------------------------------------------------------                    setup to place REFDES

                              If has_refdes = 0 Then

                                   tmp = tmp & "U " & x & " " & y & " " & fontsize & " 0 5 3 REFDES" & vbcrlf

                                   tmp = tmp & "Q 14 5 0" & vbcrlf

                              Else

                                   For n = 0 To sym_file.Count - 1 ' this part fixes the property if it already exists in the file

                                        If instr(1, sym_file(n), "REFDES") Then

                                             sym_file(n) = "U " & x & " " & y & " " & fontsize & " 0 5 3 REFDES"

                                        End If

                                   Next

                              End If

                             

                              '------------------------------------------------------------------------             setup to place part_name and SCHEMATIC_VALUE

                              If bottom_pins = 0 Then

                                   x = (x1 - x0)/2

                                   x = round(x/5)*5

                                   y = y0 - 10

                              Else

                                   x = x0 + 10

                                   y = y0

                              End If

                             

                             

                              'next place part_name

                              if has_partname = 0 then

                                   tmp = tmp & "U " & x & " " & y & " " & fontsize & " 0 5 0 PART_NAME" & vbcrlf 'visibility is 0 so nothing is visible.  This property is not displayed

                                   tmp = tmp & "Q 14 5 0" & vbcrlf

                              Else If has_partname >= 1 Then

                                  

                                   For n = 0 To sym_file.Count - 1 ' this part fixes the property if it already exists in the file

                                        If instr(1, sym_file(n), "PART_NAME") Then

                                             sym_file(n) = "U " & x & " " & y & " " & fontsize & " 0 5 0 PART_NAME"

                                        End If

                                   Next

                              End If

                             

                              'next place SCHEMATIC_VALUE

                              If has_value = 0 Then

                                   If bottom_pins = 0 Then

                                        'center justified because it will be below the symbol

                                        tmp = tmp & "U " & x & " " & y & " " & fontsize & " 0 5 3 SCHEMATIC_VALUE" & vbcrlf

                                        tmp = tmp & "Q 14 5 0" & vbcrlf

                                   Else

                                        'right justified because it will be offset to the left and need to avoid bottom pins

                                        tmp = tmp & "U " & x & " " & y & " " & fontsize & " 0 8 3 SCHEMATIC_VALUE" & vbcrlf

                                        tmp = tmp & "Q 14 5 0" & vbcrlf

                                   End If

                              Else If has_value >= 1 Then

                                  

                                   For n = 0 To sym_file.Count - 1 ' this part fixes the property if it already exists in the file

                                        If instr(1, sym_file(n), "SCHEMATIC_VALUE") Then

                                             If bottom_pins = 0 Then

                                                  'center justified because it will be below the symbol

                                                  sym_file(n) = "U " & x & " " & y & " " & fontsize & " 0 5 3 SCHEMATIC_VALUE"

                                             Else

                                                  'right justified because it will be offset to the left and need to avoid bottom pins

                                                  sym_file(n) = "U " & x & " " & y & " " & fontsize & " 0 8 3 SCHEMATIC_VALUE"

                                             End if

                                        End If

                                   Next

                                  

                              End If

                                       

                              tmp = tmp & "E" & vbcrlf

                             

                              'add graphic object statement to pin if it's missing

                              For n = 0 To sym_file.count - 1

                                   If instr(1, sym_file(n), "P") = 1 Then

                                        If instr(1, sym_file(n + 1), "|GRPHSTL") = 1 Then

                                             'do nothing

                                        Else

                                             'add the |GRPHSTL statement

                                             sym_file(n) = sym_file(n) & vbcrlf & "|GRPHSTL -1 0 0 2"

                                        End If

                                   End If

                              Next

                             

                             

                             

                              '--------------------------------------------------------------------------------------------

                              '                               replace existing end of file character "E" with the new stuff

                              '--------------------------------------------------------------------------------------------

                              i = 0

                              For n = 0 To sym_file.Count - 1

                                   If instr(1, sym_file(n), "E") = 1 Then

                                        sym_file(n) = tmp

                                        i = 1

                                   End If

                              Next

                             

                              If i = 0 Then

                                   sym_file.add(tmp)

                              End If

                             

                              '--------------------------------------------------------------------------------------------

                              '                move all the sym_file data to output so it can be written in the symbol file

                              '--------------------------------------------------------------------------------------------

                             

                              output = ""

                              For n = 0 To sym_file.Count - 1

                                   output = output & sym_file(n) & vbcrlf

                              Next

                             

                             

                             

                         End Sub

                        

                    1 of 1 people found this helpful