pcb-rnd knowledge pool
Loading drc_query scripts
drc_load by Tibor 'Igor2' Palinkas on 2020-05-19 | Tags: howto, drc_query, drc, script, rule, load, import |
Abstract: Two of the most important advantages of the new drc_query system is that users can write/manage their own DRC scripts and that those scripts can be shared and loaded by other users. This article describes how to load and use such DRC scripts.
1. Loading/Importing a script
From the GUI
The easiest way is to import scripts using the GUI. Such scripts are saved in the board file so you will need to import them in each board you want to use them with. The process is as follows:
- 1. open the 3rd tab of the preferences window (press {i c p})
- 2. click the "drc_query" button
- 3. click the "Import..." button
- 4. select the file and load it
- 5. save the board
Using actions
Loading drc rules and definitions from a tEDAx file:
LoadTedaxFrom(drc_query, filename.tdx , "", 0)
The "" is an empty argument, the ID of the rule to load. Being empty it will load all rules from the file. If it is non-empty, the action will load only the rule with matching name. This only matters if there are multiple rules in a tEDAx file.
The script is saved in the board file so you will need to import them in each board you want to use them with. Do not forget to save the board file after executing the action.
Manual editing of config files
This version works only if the drc rule/definition comes in a lihata file. The advantage of this method is that the rule van be placed in any config source/role not only in the board file.
Take the li:definitions and li:rules subtrees from the script file and copy them under the plugins/drc_query/rules config subtree in your target config file. Depending on the role, you may want to create a new subtree under li:pcb-rnd-conf-v1 called ha:append (instead of ha:overwrite ), so the new script doesn't overwrite the list of existing drc rules but is appended to it.
2. Saving/Exporting a script
From the GUI
The easiest way is to export scripts using the GUI. The process is as follows:
- 1. open the 3rd tab of the preferences window (press {i c p})
- 2. click the "drc_query" button
- 3. select the rule to export
- 4. click the "Export..." button
- 5. specify a file name and save
Using actions
Exporting drc rules and definitions to a tEDAx file:
SaveTedax(drc_query, filename.tdx , " ruleID ")
The ruleID is the unique name of the DRC rule. The rule and the definitions the rule use are all saved in filename.tdx .
3. Sharing DRC scripts
The easiest way to share DRC scripts is using edakrill .
If you need a DRC check not shipped with the standard pcb-rnd distribution, it's a good idea to check if there is something similar available on edakrill.
If you have written a DRC script, please consider sharing it on edakrill. Beside the DRC script file, it is recommended to share a .txt file (using the same name) to describe the details. The .krill file, also with the same name prefix, should contain at least the following fields:
- type=drc
- software=pcb-rnd
- license/dist= your preferred license, normally GPL2+
- source=original
- author= your name
- description= one-liner summary