New Version Available 1/26/2012: Removed the work-around for memory bug fixed in 7.9.2. The download includes both versions (Pre 792 and 792+)
New Version Available 3/25/2013: Fixed minor bug in the 792+ version.
The EditLibraryCells.vbs script provides the mechanics for Editing Cells in the Central Library's Cell Partition. It begins by compiling a list of partitions and cells 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 specifiy whether or not to include or exclude a partition and cell. After compilation it will execute the edit process which will open each cell and feed its document 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 cell. Below is an example use of the Subroutine "EditCLCells" that is included in the script and the functions that it uses, specified and defined by you.
'Modify the call to EditCLCells to sepcify your
'Partition Filter Function name (IE "myPartitionFilter")
'Cell Filter Function name (IE "myCellFilter")
'Editor Function name (IE "TextCell")
'Do not change the Subroutine name "main()"
EditCLCells libPath & libName,"myPartitionFilter","myCellFilter","TextCell"
'Define your Partition Filter Function
'Return True to include
'This example excludes all partitions except the "smd_conn" partition
If oPartition.Name="smd_conn" Then myPartitionFilter=True
'Define your Cell Filter Function
'Return True to include
'This example includes every cell except testpoints and jumpers
If oCell.Type=epcbCelltypePackage Then
If Not oCell.PackageGroup=epcbPackageJumper And Not oCell.PackageGroup=epcbPackageTestPoint Then myCellFilter=True
'Define your Editor
'Return True to save
'This example creates a FabricationLayerText at 0,0 in each cell
Set tObj=oCellDoc.PutFabricationLayerText("EditCLTest",0,0,epcbFabAssembly,epcbSideMount,.065,0,10,"VeriBest Gerber 0",0,epcbJustifyLeft,epcbJustifyBottom,Nothing,epcbUnitInch,epcbAngleUnitDegrees)
If Not tObj Is Nothing Then TextCell=True
At the top of the script is a Const DBUG=0 statement that controls the maximum number of cells 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\EditLibraryCells.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
The script will write to "EditCLCells.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. At This posting, it is known that after script "completion" & "Data CellDB Saved", IDE/Libray Manager will crash due to bug in IDE. Hence, I recommend using command prompt until this is fixed.
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.