Author : Scott Williams
Platform/Format: Windows, Visual Basic 2010 Express
Use case description:
This was developed to clean up cells translated from BoardStation to Expedition. It is a good example of using Visual Basic to modify cells in bulk from outside the Cell Editor.
Visual Basic, unlike VB Script, has strong variable typing, auto-completion, and an Object Browser that help the programmer better understand the code and choose available objects and methods.
Visual Basic 2010 Express can be downloaded free of charge from the following location: http://www.microsoft.com/express/Downloads/#2010-Visual-Basic
The program is menu-driven and pops up the standard disclaimer before continuing.
The script modifies cells as follows:
- Set pen width for all text to 0
- Set height for all text to 0.040”
- Silkscreen text - set font to Veribest Gerber 0
- Silkscreen Ref Des - set origin to 0, 0
- Assembly Ref Des - set font to Arial
- Assembly Part # - create from assembly ref designator (at 0,0)
- Assembly outline - set line width to 0
- Remove duplicate assembly ref designator, move remaining one to layer "mount side", display condition "any mount"
- Remove duplicate silkscreen ref designator, move remaining one to layer "mount side", display condition "any mount"
- Remove duplicate placement outlines, move remaining one to layer "mount side", display condition "any mount"
- Remove any item on layer COMP_DIMENSION
Update 9/18/2013: I added a new program called Cell Cleanup Layer Mapping. This reads a layer mapping instruction file to delete user layers, move user layers to different user layer names, or move user layers to "intelligent" layers. An example mapping file is included with the code. I support a few intelligent layer types currently. The program can easily be modified to support additional data types if you download the source code. If you have no need to modify the source, download just the executable.
The layer mapping file format is as follows:from user layer,to layer,side,display condition
to layer = to layer = user layer name,DELETE,SOLDER PASTE,SOLDER MASK,RULE AREA,ETCH,ASSEMBLY,SILKSCREEN,TEST POINT OBSTRUCT,PLACE OBSTRUCT
side = user,top,bottom,mount,opposite
display condition = top_only,bottom_only,any_mount
Examples:
CLEAR_SILK_TOP,Clear Silk Top,user,top_only
PASTE_TEXT_TOP,Solder Paste,top,any_mount
LAYER_NOT_NEEDED,delete,delete,delete
Update 3/15/2014: I added a VX version of the Cell Cleanup Layer Mapping executable. In VX, be sure to run the script through the "MGC PCB Command Window" or it will not work correctly.
Update 3/24/2014: I added a new keyword to remove placement obstructs from cells. This is to help with translations from Allegro where placement outlines are turned into placement obstructs.
[Intelligent Layers]
Remove_Placement_Obstructs=1
Update 4/3/2014: I updated the source code, now supporting builds for both EE and VX with shared forms and source files.