## Render script

The core renders the board for the GUI and for graphical export plugins (such as gerber, png, ps, etc.). In composite renders, when all layers are combined to create a single image (e.g., GUI rendering, png export, eps export), the order of layers matters: layers rendered later appear being above layers rendered earlier. Furthermore some layers, like screen-only marks, are not rendered in export targets.

With pcb-rnd versions newer than 2.3.1, rendering is controlled by the render script which is stored in the config tree as appearance/render_script. The render script is written in a Domain Specific Language designed exclusively for this task so that it can be quick enough not to slow down on-screen rendering.

The render script language consists of statements and comments. A comment is anything from a hashmark (#) character to the end of the line. A statement is a single line in one of two forms:

    command [arg1 arg2 ... argN]
    if cond1 [and cond2 ... and cond3] then command

Commands can have zero or more arguments. Each argument is a single word. Each 'if' applies only to one command, that is in the same line as the 'if. Only the 'and' relation can be used between conditions of an 'if'. All keywords are case sensitive. Below is the list of commands.

command | args | description
--- | --- | ---
stop |  | stop executing the script (render finished early; useful with 'if')
silk_tune_color |  | change the color of far_side silk layers to the configured "invisible" color (useful in screen rendering)
copper_order_UI |  | set up copper rendering order to match UI history: drw_copper will render current group on top, and then goes in order of how recently a group was selected
drw_copper |  | render copper layers in the selected order
drw_invis |  | render the invisible layer (if the GUI or export plugin accepts it; invisible layers include the far_side silk and doc layers)
drw_pstk |  | render padstacks (without holes)
drw_mask |  | render the mask layers
drw_layers | loc type | render all layer groups that match loc:type, in order they appear in the layer stackup. Loc is one of top, bottom, intern, global, this_side, far_side.
drw_hole |  | render holes
drw_paste |  | render paste layers
drw_virtual |  | render virtual layers: auto generated assy and fab layers and cross-section
drw_ui_layers |  | render UI layers
drw_marks |  | render marks (subcircuit frames and IDs, terminal IDs, etc.)
drw_boundary_mech |  | render boundary and mech layers

Conditions for an 'if' are:

condition | description
--- | ---
GUI | true for on-screen (GUI) rendering, false for export
check_planes true if the editor/check_planes conf node is true