Remove redundant pads/holes and update padstacks to have proper pads/holes

Version 4

    When EE library is generated by migrating from other flow, it will have lots of redundant pads/holes, whose names are not generated automatically, duplicated with each other.
    The pad/via names can be changed to automatically generated names by checking each pads/holes in Padstack Editor, but this operations will produce many ' _1 _2 _3 ...' pads/holes, instead of removing the redundant pads/holes.
    In order to remove the redundant pads/holes, user should re-assign correct pads/holes names to each padstacks, and then remove redunt pads/holes manually; very tedious task.

     

    This script is designed to perform removal of redundant pads/holes by below steps:
      1. Set autoname to each pads/holes whose names are not automatically generated ones
      2. Correct the generated names in order to keep the name of each pad/hole being short (Padstack Editor will append '_1 _2 _3 _4...')
      3. Assign correct pad names/hole names to each padstacks
      4. Remove redundant pads/holes that were processed in step 2.

     

    I have tested with one of my customer's translated library;
    Number of pads : 2311 -> 656
    Number of holes : 49 -> 21

     

    Download the attached script and execute by mgcscript command as below:
    > mgcscript refinepads.vbs

     

    Note:
      1. Please backup your library database before running this script.
      2. This script is designed to attach to Padstack Editor application. That is, Padstack Editor should be open before running this script.
      3. Save required after running this script & reviewing the result in Padstack Editor.
      4. This script tries to delete the padstacks whose name begin with 'ORG_'. Block line 89~90(DeleteBackupPadstack function call) in order to keep 'ORG_' padstacks.
      5. You may define pads & holes that should not be renamed in the beginning of the script(arrPadsProtected, arrHolesProtected).

      6. This script was developed and tested with EE7.9.1 on Windows7.

     

    Associated DR: dts0100683091 -  Padstack Editor autoname function overlows character name limit (Status:Postponed)

     

    '==========================================================================
    ' DISCLAIMER OF WARRANTY:  Unless otherwise agreed in writing,
    ' Mentor Graphics software and associated files are provided "as is"
    ' and without warranty.  Mentor Graphics has no obligation to support
    ' or otherwise maintain software.  Mentor Graphics makes no warranties,
    ' express or implied with respect to software including any warranty
    ' of merchantability or fitness for a particular purpose.
    '
    ' LIMITATION OF LIABILITY: Mentor Graphics is not liable for any property
    ' damage, personal injury, loss of profits, interruption of business, or for
    ' any other special, consequential or incidental damages, however caused,
    ' whether for breach of warranty, contract, tort (including negligence),
    ' strict liability or otherwise. In no event shall Mentor Graphics'
    ' liability exceed the amount paid for the product giving rise to the claim.
    '==========================================================================