Creating xgbrvu job file

This page describes how to create the xgbrvu job file from a script.
Specifically, the script will look at the working directory for all the files that end with .gbr extension, and create a job file which contains all the Gerber files found.

This feature is very useful when you have many Gerber files you wish to view at once. It eliminates the need to load one Gerber file at a time to the xgbrvu layer table.


Procedure

We recommend you start from a clean directory and then run the gds2gbr engine to create the gerber files. This way there are no old gerber files in the working directory.

The utility assumes that your aperture file name is gerber.apt . Please make sure to name your aperture file as gerber.apt.
Or, The aperture file name is defined in the second line of the job file so you can modify it if you want to list your specific aperture file name.

Run the script we provide below to create the job file. The output file name is called output.job and it contains all the Gerber files (.gbr extension) that exist in the local directory.

Finally, you can run the xgbrvu with the job file on the command line to view all the Gerber files.

hagai@argonx6:~/cad/asm600/examples$ ~/cad/asm600/bin/xgbrvu output.job
executing script /home/hagai/cad/asm600/bin/xgbrvu64
Running: /home/hagai/cad/asm600/bin/xgbrvu64 "output.job"

Attempting to load font fixed ... Success


asm600u_gerber.gif


Download Script

Please copy the script below and save it as an executable file to a directory in your path. It is a good idea to save it in the asm600/bin directory where the xgbrvu is located.

#!/bin/bash

# Output file
OUTPUT_FILE="output.job"

# Initialize fill option values
FILL_VALUES=(2 3 4 5 6 7)
FILL_INDEX=0

# Colors list
COLORS=("red" "green" "yellow" "blue" "magenta" "cyan")
COLOR_INDEX=0

# Clear the output file before writing
> "$OUTPUT_FILE"

# Write the fixed first two lines
echo ":Ver   100" >> "$OUTPUT_FILE"
echo ":Cfg   gerber.apt" >> "$OUTPUT_FILE"

# Scan for .gbr files in the current directory
for FILE in *.gbr; do
    # Check if any .gbr files exist
    [ -e "$FILE" ] || continue

    # Get current fill and color
    FILL_VALUE=${FILL_VALUES[FILL_INDEX]}
    COLOR=${COLORS[COLOR_INDEX]}

    # Write to the output file
    echo ":Drw   $FILE" >> "$OUTPUT_FILE"
    echo ":OnOff on" >> "$OUTPUT_FILE"
    echo ":Color $COLOR" >> "$OUTPUT_FILE"
    echo ":Fill  $FILL_VALUE" >> "$OUTPUT_FILE"

    # Update fill index (cycle through 2-7)
    FILL_INDEX=$(( (FILL_INDEX + 1) % ${#FILL_VALUES[@]} ))

    # Update color index (cycle through colors)
    COLOR_INDEX=$(( (COLOR_INDEX + 1) % ${#COLORS[@]} ))
done

echo "Processing complete. Output saved to $OUTPUT_FILE."