lepton-xyrs(1) | 1.9.7.20181211 | lepton-xyrs(1) |
lepton-xyrs - is a program to batch process XYRS files.
lepton-xyrs file [OPTIONS]
XYRS files are usually generated by PCB design programs, and are used by board assemblers.
Format of XYRS files is discussed in FILES section.
Processing of these files is often needed by board assemblers or designers to suit their process and tools flows.
lepton-xyrs helps batch-processing these files. Rules and commands can be defined to make batch-processing easy.
lepton-xyrs consists on a perl library providing the core functions, and a perl script providing some basic functionality.
It takes some arguments from the command line: input and output files, some modifiers, and an action-file or an action-string.
The action-file or action-script contains some commands. For every line of the input file, lepton-xyrs executes those commands, which can modify the contents of the line, and then writes the resulting line to the output file.
Since lepton-xyrs is written in perl, actions are also written in this language.
It just copies these lines to the output, without further processing.
With this option, it processes these lines as well.
If FILE string is "-" (without double quotes), then output is redirected to standard output STDOUT.
lepton-xyrs defines automatically the following variables:
All the following commands accept a checklist parameter. A checklist is a list of one or more check_items. A checkitem is a list of two single elements:
The commands will only be executed on those lines that match all the checkitems in the checklist.
Returns -1 if error, 0 if not match, 1 if match and changed.
The angle column number is angle_col.
Returns 1 if match and changed, 0 if not match, -1 if error.
Returns 1 if match and changed, 0 if not match, -1 if error.
Units is a string with the desired units. Only "mm" (milimeters), "in" (inches) and "mil" (thousands of an inch) are supported.
It is required that numbers to be converted are followed their units (see supported units above). Otherwise, the number is not changed.
Returns -1 if error, -2 if warning, and 1 if success.
Substitution is an expression with the new string. Old column value can be used here.
Returns -1 if error, 0 if not match, 1 if match and changed.
Example:
translate 2, '^([0-9]+)n$','sprintf("%dnF",$1)', 3, 'C[0-9]+';
if the value in column 3 is C followed by a number, then
if the value in column 2 is a number followed by 'n', translate it to the
same value followed by 'nF'.
If there is 'C10' in column 3 and '10n' in column 2,
change '10n' to '10nF'.
The number in the specified column number may have units at the end.
Returns -1 if error, 0 if not match, 1 if match and changed.
Returns -1 if error, 0 if not match, 1 if match and changed.
Returns -1 if error, 1 if the new column was inserted.
The return value of lepton-xyrs is an integer with the following possible values:
0 if there was no match
-1 if there was an error
-2 if there was a warning
The data stored in these files is usually a header, and one line per component of the board.
For each component, at least the following information is needed by assemblers:
- Reference
- Coordinates (X and Y)
- Rotation angle
- Side where the component is located (top or bottom)
There can be more information, such as description, footprint, but this depends on the design program an its configuration.
This information is organized in lines, one line per component, and each line is divided in as much fields or columns as needed. Field delimiters are used between columns, but field delimiters are not standardized and they depend on the program used to generate the XYRS file.
The program that generates the XYRS file usually write a header (usually the first two or thre lines in the file) with a column title.
lepton-xyrs tries to guess the file format, and column numbers, based on this header. Thus, the known column titles are the following:
- for reference designator: Designator, RefDesignator, RefDes.
- for footprint: Footprint, TopCell, Description (only if there is no other "TopCell" column title).
- for X coordinate: Mid X, X.
- for Y coordinate: Mid Y, Y.
- for rotation angle: Rotation, rotation, Rot.
- for location side: TB, Side, top/bottom.
- for value: Comment, PartNumber, Value.
Each action file should end with the following line (with a carrier return at the end of the line):
1;
lepton-xyrs your_xyrs_file.txt --adjust your_commands.txt --output output_file.txt
lepton-xyrs your_xyrs_file.txt --eval "your_commands" --output output_file.txt
lepton-xyrs your_xyrs_file.txt --eval "del 2, 'R[0-9]+';" --output output_file.txt
lepton-xyrs your_xyrs_file.txt --eval "del \$REF_COL, 'R[0-9]+';" --output output_file.txt
lepton-xyrs your_xyrs_file.txt --eval "rotate \$ANGLE_COL, 90, \$REF_COL, 'R[0-9]+';" --output output_file.txt
lepton-xyrs your_xyrs_file.txt --eval "change_units 'mm', 3, 5;" --output output_file.txt
lepton-xyrs your_xyrs_file.txt --eval "subst 3 , '100nF', 3, '0.1u'" --output output_file.txt
lepton-xyrs your_xyrs_file.txt --eval "subst \$REF_COL , 'D1', \$VALUE_COL, '1n4148';" --output output_file.txt
Value in column 3 can be in other units (for example: '640mil'):
lepton-xyrs your_xyrs_file.txt --eval "offset \$X_COL, '102.5mm', \$REF_COL, 'R[0-9]+' ;" --output output_file.txt
Value in column 3 can be in other units (for example: '640mil'):
lepton-xyrs your_xyrs_file.txt --eval "mul_col_val \$X_COL, 2.5, \$REF_COL, 'R[0-9]+' ;" --output output_file.txt
lepton-xyrs your_xyrs_file.txt --eval "swap_columns 3, 4, 4, 'R[0-9]+' ;" --output output_file.txt
lepton-xyrs your_xyrs_file.txt --eval "insert_column 0, 'new_column_value';" --output output_file.txt
December 11, 2018 | Lepton EDA |