pcb-rnd knowledge pool

 

User scripts from EDAkrill: via tenting

script_krill by Tibor 'Igor2' Palinkas on 2019-06-21

Tags: howto, user, script, awk, mawk, via, pad, tent, untent, mask, paste, install, installing, user script

node source

 

 

Abstract: This howto demonstrates how to download an user script from EDAkrill and how to use it for tenting or untenting vias.

 

Step 1: scripting support

Stock pcb-rnd normally does not have scripting support. You need to install a few extra libs from source and pcb-rnd from source. This installation document describes the steps. Make sure you have libmawk installed before fungw, the script we are going to use for this example will depend on libmawk. (Note: installing mawk is not enough, it's libmawk that you need.)

Step 2: download the script

Download the script from EDAkrill. We are using the via tenting script for this example. When you download other scripts, always make sure the script is from trusted source : user scripts have the same power as any executable, and downloading and executing random programs (and pcb-rnd user scripts) from unverified source is dangerous.

Unpack the tarball and place the script somewhere in the file system. Most user scripts will contain a single script file and will not need any special installation. Some more complex scripts will require extra steps, but that should be described in a document included in the tarball.

Step 3: load the script

Run pcb-rnd, open the Plugins menu and select the Manage scripts... submenu. This will bring up a dialog box with empty lists (when you do not have scripts loaded on a vanilla pcb-rnd). Click the load button:

empty manage scripts dialog with the load button marked

A file selection dialog comes up; navigate to the place where you unpacked the user script and select via_tent.awk there.

A new, small dialog box pops up for naming the script and selecting language:

script ID and language dialog

The ID is used to name the script once it is loaded. There can be multiple scripts and their file name may be the same if they are coming from different directories. Thus pcb-rnd uses an user assigned unique ID for identification of scripts loaded. Mostly used when you are referencing your scripts from actions. You can pick any ID - the one pcb-rnd offers is usually good enough.

Make sure scripting language is set to mawk.

Click the ok button.

Step 4: check script actions

Now you have the script loaded and it shows up in the manage script dialog box. Click the script on the left side list. This will list all actions provided by the script, on the right side:

manage scripts dialog with the newly loaded script

What these actions do is script-specific and should be documented in the user manual coming with the script. In the via_tent script, the file is called via_tent.txt. It's best practice to read the manual before using a script.

Step 5: prepare the test board

We are going to tent and untent vias. For this, place a few vias on the empty board, randomly and turn on the mask layer (e.g top-mask) on the left side layer selector:

test board with random vias, mask on

Step 6: using the script: GUI

Invoke the via tenting dialog executing the via_tent_dialog action: press the ':' key to get a command prompt, enter via_tent_dialog and press enter.

via tent dialog

Change the operation between tent and untent and press the Do it! button. Repeat a few times to see how it affects the design.

Step 7: using the script: CLI

A good user script also supports the CLI. The CLI for this script, as documented in its user manual is the via_tent action. To achieve the same effect as above, press the ':' key to get a command prompt and enter one of the following two commands:


	via_tent(all, untent, both, none)
	via_tent(all, tent, both, none)

Arguments is as documented in the script's user manual - basically matching the GUI.

Remarks

This script can be used to manipulate the mask or paste layer shapes of padstack objects. Which means it can be used to tent/untent vias or paste/unpaste SMD pads - with the right settings.

The scope of the script can be limited by not running it on all padstacks but only selected padstacks and using the query() action or the advanced search feature to make only a few padstacks selected.

Step 3 is the GUI way. It is also possible to load scripts from the CLI, using an action:


LoadScript(foo, via_tent.awk, mawk)

where foo is the user assigned ID and via_tent.awk can be a full path to the file.

It is also possible to edit the script within pcb-rnd, using the live script mechanism . However, live scripts can not declare persistent actions, so the script will do nothing. To get it useful, e.g. to open the dialog box, you will need to add a function call at the end of the BEGIN block on the bottom of the file, right above the closing brace. Enter this line there:


	via_tent_dialog();

Yet another way is to make the user script "permanent", which means it would be loaded automatically on pcb-rnd startup. For this:


li:pcb-rnd-perma-script-v1 {
	ha:via_tent { path=scripts/via_tent.awk; lang=mawk; }
}

After (re)starting pcb-rnd, the script will be automatically loaded on every startup.