Padstack Editor : Batch Padstack Library Editor

Version 2

    The EditLibraryPadstacks.vbs script provides the mechanics for Editing Padstacks, Pads, Custom Drill Symbols and Holes in the Central Library's Padstack Partition. It begins by compiling a list of partitions and Padstack Editor objects to process. It does this in a way that allows you to easily customize the resulting compilation by allowing you to define and specify filter functions that specify whether or not to include or exclude a partition and object. After compilation it will execute the edit process which will open each Padstack Editor object and feed its object to an edit function that you define and specify. This function is required to return a true or false value to indicate whether or not to save the Padstack Database. Below is an example use of the Subroutine "EditCLPadstacks" that is included in the script and the functions that it uses, specified and defined by you.

    'Modify the call to EditCLPadstacks to specify your

    'Partition Filter Function name (IE "myPartitionFilter")

    'Padstack Object Filter Function name (IE "myPadstackFilter")

    'Editor Function name (IE "myReport")

    'Do not change the Subroutine name "main()"

    Sub main()
         EditCLPadstacks libPath & libName,"myPartitionFilter","myPadstackFilter","myReport"
    End Sub


    'Define your Partition Filter Function

    'The Partitions are not real partitions but this script treats Padstack Editor Objects (Holes, Pads, CustomDrillSymbols,Padstacks & Technology) as their own partitions

    'Return True to include

    'This example includes all partitions except the “Technology” partition

    Function myPartitionFilter(sPartition)
         If sPartition="Technology" Then myPartitionFilter=False
    End Function


    'Define your Padstack Object Filter Function

    'Return True to include

    'This example includes every Padstack Editor object

    Function myPadstackFilter(oCell)
    End Function


    'Define your Editor

    'Return True to save

    'This example just reports Holes and the Mountside Pad of each padstack within each technology

    Function myReport(sPartition,oItem,sTechnology)

                Dim hole,pad,lyr

                If sPartition="Padstacks" Then

                            file.writeline("     " & sTechnology & " / " & oItem.Name)

                            For Each hole In oItem.Holes

                                        file.writeline("          " & hole.Name)



                            Set pad=oItem.Pad(CInt(lyr))

                            If Not pad Is Nothing Then file.writeline("          MountSidePad : " & pad.Name)


                            file.writeline("     " & oItem.Name)

                End If


    End Function


    At the top of the script is a Const DBUG=0 statement that controls the maximum number of object to process where 0=All. This will allow you to minimize the runtime for debug purposes.

    The script may be executed one of two ways:

    1) Executed via "mgcscript" in a windows command prompt with the Pathname of the library given as the sole argument:

    "mgcscript C:\VBScripts\EditLibraryPadstacks.vbs C:\Libraries\20078\Library.lmc"

    2) Open the script in IDE - Library Manager's File->Open Script Form and execute the "Play" button. However, this may require an Automation Pro license. It does in Expedition/FablinkXE/Drawing Editor.

    The script will write to "EditCLPadstacks.txt" in the library's LogFile directory. Use this file to determine status of the run. Use an editor to view the file that will open files in use, ie Notepad.exe. When completed, this file will open in Notepad.

    HINT: when writing/debugging your Editor Function, do so first in a separate script, drag & drop unto an open cell in the cell editor. Otherwise, it will take considerably longer for debug.