tEDAx - pcb-rnd drc_query

# tEDAx - pcb-rnd drc_query scripts

## purpose

This pcb-rnd specific block describes drc rules for the drc_query plugin. Other software should ignore this block.

The main use case for the block is allowing schematics editors to translate design/layout requirements extracted from the schematics into a rule set that then can be checked by pcb-rnd.

## blocks

Block type is "drc_query_rule" and "drc_query_def", version is "v1". The unique identifier should be single word rule name or constant name.

Commands for drc_query_rule are:

command | parameter names | explanation
--- | --- | ---
type | str... | Rule type (for grouping on the DRC list). Only one instance per rule allowed.
tilte | str... | Rule title (summary). Only one instance per rule allowed.
desc | str... | Detailed description of the violation and suggestions how to resolve it Only one instance per rule allowed.
query | str... | The next line of the query script. Multiple instances per rule allowed.

Commands for drc_query_def are:

command | parameter names | explanation
--- | --- | ---
type | typename | Constant data type (anything the conf system accepts; typically coord, real or boolean). Only one instance per const allowed. Must be the first command.
desc | str... | Human readable description of the constant. Only one instance per const allowed.
default | val | Default value in case the config node is not filled in, in the format required by the data type. Only one instance per const allowed.

## Examples

Below is the hole overlap rule (standard drc_query script from the stock config) translated into tEDAx drc_query_* blocks:

    tEDAx v1
    begin drc_query_def v1 hole_overlap_factor
    	type real
    	default 0.0
    	desc How much drilled holes may overlap [-1..+1]; 0 means touching holes are reported; positive numbers allow more overlap, negative numbers report non-overlapping but close holes
    end drc_query_def

    begin drc_query_rule v1 hole_overlap
    	type pair hole
    	title overlapping holes
    	desc padstack holes overlap

    	query rule overlap
    	query let A @.type==PSTK
    	query let B A
    	query assert (A.ID > B.ID) && (distance(A.x, A.y, B.x, B.y) < (A.hole + B.hole)/(2*(1+$hole_overlap_factor))) thus violation(DRCGRP1, A, DRCGRP2, B, DRCMEASURE, distance(A.x, A.y, B.x, B.y), DRCEXPECT, (A.hole + B.hole)/(2*(1+$hole_overlap_factor)))
    end drc_query_rule