Index: drc_query/index.html =================================================================== --- drc_query/index.html (nonexistent) +++ drc_query/index.html (revision 30144) @@ -0,0 +1,86 @@ + + + + pcb-rnd user manual + + + + +

drc_query: query() based, scriptable Design Rule Checker

+

+The drc_query plugin is a glue layer between the +query plugin and the DRC infrastructure. It allows the +user (and sch import flows) to script DRC checks and use these script as part +of the normal DRC workflow. This chapter describes the +how to configure and use query() based DRC scripts +and offers a tutorial on developing DRC scripts. + +

Configuration

+

+DRC rules are specified as a list of hash nodes under the plugins/drc_query/rules +config path, from the config source of the user's choice. Commonly used config +sources: +

+

+Example 1: a full example of an user config, saved as ~/.pcb-rnd/drc_query.conf: + +li:pcb-rnd-conf-v1 { + ha:overwrite { + ha:plugins { + ha:drc_query { + li:rules { + ha:hole_dia { + type = single hole + title = hole too small + desc = padstack hole diameter is too small + disable = 0 + query = {@.hole < 0.2mm} + } + } + } + } + } +} + +

+Text fields type, tilte and desc are optional user readable strings +that will be presented in the DRC report. The type::title pair serves +as an unique identifier for the rule. If optional disable is 'yes' or +'true' or a non-zero integer value, the rule is temporarily disabled. +

+Note: since drc errors are presented on a per type basis, and drc rules +are executed each in its own, independent context, the order of the hash +node within the rules list (merged from different config sources) +does not matter. +

+Query text may consists of multiple lines. The format is as described +at the query plugin. There are two alternate forms: +

+

+Example 2: a rule based query script example is finding overlapping drilled holes: +

+query = {
+  rule overlap
+  let A @.type==PSTK
+  let B A
+  assert (A.ID > B.ID) && (distance(A.x, A.y, B.x, B.y) < (A.hole + B.hole)/2) thus mklist(A, B)
+}
+
+

+Note: since drc errors are presented on a per type basis, and drc rules +are executed each in its own, independent context, the order of rules does not +matter. + +

Tutorial

+