As explained on other pages, horizon supports parametrizable padstacks and (to a limited extent) packages. To apply the given parameters to the existing geometry, each padstack and the like is accompanied by a small program.
These programs are written in a custom stack-based language. Users of HP calculators should feel familiar. Since there aren’t any loops, these programs will terminate in finite time. The stack holds signed 64bit integers. Conceptually, it grows from top to bottom.
On the top level, a program is made up of tokens. Tokens are separated by any amount of whitespace.
Token types:
- Integers: a number, optionally prefixed by a sign
- Dimension: a number with optional fractional part, suffixed by “mm”. The float before mm will get multiplied by 1e6, since horzion’s internal unit of measurement is 1nm
- Mathematical operators such as:
+ - * /
- Strings
- Argument start
[
and end]
any token between these two will get appended to the last command’s arguments
get-parameter [ <parameter> ]
gets paramter and pushes it onto the
stack
Before the operation, the stack looks like this: . . . . +---+ | a | +---+ Operators: | pushes dup | a a chs | -a
Before the operation, the stack looks like this: . . . . +---+ | a | +---+ | b | +---+ Operators: | pushes + | a+b - | a-b * | a*b / | a/b dupc | a b a b (Duplicate coordinate)
Before the operation, the stack looks like this: . . . . +---+ | a | +---+ | b | +---+ | c | +---+ Operators: | pushes +xy | a+c b+c -xy | a-c b-c
In order for an object (shape, etc.) to be manipulated by the program,
it needs to be assigned a parameter class. ## set-shape
set-shape [ <parameter class> <form> ]
Sets a shape to the specified
form or moves it to the specified position Valid forms:
rectangle
, pops height, widthcircle
, pops diameterobround
, pops height, widthposition
, pops y, x
set-hole [ <parameter class> <shape> ]
Sets a hole to the specified
shape Valid shapes:
round
, pops diameterslot
, pops length, diameterposition
, pops y, x
set-polygon [ <parameter class> <shape> <x0> <y0> ]
Sets a polygon
to the specified shape with center at (x0,y0) Valid shapes:
rectangle
, pops height, widthcircle
, pops diameter
set-polygon-vertices [ <parameter class> <n_vertices> ]
Pops
n_vertices
coordinates from the stack and replaces the polygon's
vertices with them.
expand-polygon [ <parameter class> <x0> <y0> <x1> <y1> ... <xn> <yn> ]
Pops expansion. Expands the polyon specified by the coordinates in the
argument by the dimension popped from the stack.
get-parameter [ pad_width ] get-parameter [ pad_height ] dupc dupc set-shape [ pad rectangle ] get-parameter [ solder_mask_expansion ] 2 * +xy set-shape [ mask rectangle ] get-parameter [ paste_mask_contraction ] 2 * -xy set-shape [ paste rectangle ]