pcb-rnd knowledge pool
Exporting plugged and filled vias separately using CAM partials
filledvia by Tibor 'Igor2' Palinkas on 2019-09-20 | Tags: howto, via, hole, excellon, export, cam, plugged, filled, menufile2 |
Abstract: This example demonstrates how to use partial CAM export to sort different vias into different excellon files, by via process (filled, plugged, normal).
Theory
As explained in the CAM feature section of the user manual, it is possible to use the CAM syntax to limit which objects are rendered in an export. The object filtering can also be done from a CAM job .
This example demonstrates how to use this feature to sort holes into different excellon files by process. The theory of operation is simple:
- set a custom user defined attribute, called "process" on the vias that need special treatment; possible (also user defined) values are "filled" or "plugged"
- use the partial command with a query expression to mark all objects that should end up in the file
- tell the excellon exporter to do a partial export, rendering only the object that have the mark
- reset the mark using the full command
Note: tented vias normally won't need this kind of special case because tenting happens on the mask layer where padstacks can have a shape. Plugging and filling are special because there are no layer where these can be represented graphically.
Example file
The example board exploits this feature to export 4 excellon files:
- filled.exc: only filled vias (second row of vias on the test board)
- plugged.exc: only plugged vias (third row of vias on the test board)
- normal.exc: vias without special process (first row of vias on the test board)
- all.exc: all vias in one file (6 vias total)
The attributes can be checked:
- using the property editor: right click on a via and select "Edit properties" and scroll down to the "a/" subtree
- or using the advanced search
- or using the query action: query(select, '@.a.process == "plugged"')
Exporting
The easiest way to export the file is using the command line:
pcb-rnd -x cam holes board.lhtwhich tells pcb-rnd to export boards.lht using the cam job called holes .
The same can be achieved using the GUI: file menu, "Export with CAM job..." and pick the "holes" job, which should be the top item in the list on the left.
CAM job config
The CAM job is embedded in the board file in this example (but could be specified in the user config under ~/.pcb-rnd the same way). It is "holes" subtree near the bottom of the board file .
The cam job is in a prepend subtree under pcb-rnd-conf-v1 so that it does not overwrite existing CAM jobs coming from user or system configs, but is inserted before all them.
The desc line is a description, comment, information for the user
The plugin line selects the excellon plugin for export. We are not using any plugin argument here: file names will be specified explicitly, the default coordinate format is good enough.
Next we run a query() using the partial command, marking objects that have a process attribute with value filled . The mark is the EXPORTSEL flag. The following write command will trigger an export to filled.exc . The reason this export will output only two holes is the virtual(purpose=pdrill,partial) supplement which commands the rendering code to render only those objects that have the EXPORTSEL flag - which was set by the partial command. The virtual layer we are picking up objects from has purpose=pdrill , which means we are dealing with plated drills only.
Before doing the next search&mark, we need to reset the EXPORTSEL flag on all objects, with the full command. If this step is not done, the objects marked by the next partial command will join the objects previously marked. This feature can be used to incrementally grow the set of marked objects (not demonstrated by this example).
Exporting plugged vias is done the same way as exporting filled vias above.
Exporting "normal" vias is again the same, only the query expression is more complicated: we need to mark objects that are neither "filled" nor "plugged".
Finally, all.exc is exported after a mark-reset, without the (partial) supplement - all objects, without filtering.
Note: we did not limit our queries to padstacks; the reason for that is that we know the excellon export will only deal with holes and slots so it does not matter if our queries mark other objects (e.g. lines, polygons, subcircuits). Plus the excellon exporter is layer based, and we selected plated hole layers only, except for all.exc where we export both plated and unplated drills (but not slots!).