pcb-rnd knowledge pool
How to select subcircuits per footprint/value for manual assembly
asm by Tibor 'Igor2' Palinkas on 2018-10-30 | Tags: insight, subcircuit, footprint, value, select, manual, assembly, build, solder, populate |
Abstract: A short description of what options are available in pcb-rnd for assisting manual assembly of boards, with insight on how these work in the background and comparison of the related infrastructure to geda/pcb's.
Original question via email:
> On Wed, 5 Sep 2018, Bdale Garbee wrote: > > You can do this in pcb with view / displayed element name / value, > followed by using select / select by name / all objects and typing in > the value. DJ taught me how to do this, and he even shared some > scripting with me once that I never ended up using to allow for a > one-key step through the BOM highlighting each part in sequence. > > I haven't quite figured out if there's a (clumsy?) way to do the same > thing with the re-structured pcb-rnd UI menus yet. Completely agree > that a simple UI for scrolling through the BOM by value and having all > the parts matching the current value highlighted would be a huge feature > for doing hand-loading of SMT prototype boards.
By now we have a simple GUI, invoked with the asm() action.
For the rest, we have a less hackish way.
For us, all these fields are just attributes of subcircuits. If you take a board with sch-imported subcircuits and right-click on a subc and click on the property editor, scroll down, you will see they are a/footprint, a/value and a/value. In pcb they were special fields with extra code all around, so they had to have extra menus and special casing. In pcb-rnd they are just attributes so anything that can handle attributes will handle them easily. Plus you can extend the set of attributes any time without having to write C code.
For displaying: we can change what's printed on the subcircuit virtual layer using View/Displayed subcircuit ID/ - these really just set a text template using action Display(SubcID, ...). The template is a string, what you write in there is displayed, but besides fixed characters it also supports referencing attributes using the "%%" syntax, e.g. %a.refdes% is substituted with the value of the refdes attribute. This allows you to have random extra atributes, e.g. whether your resistor is in the 1% or 5% tolerance group, and also display that.
For selecting: use the advanced search (or from the CLI the query() action). This mechanism offers a query language where you can write a logical expressions and get selected anything that matches. It is easy to math on attribute values. For example:
query(select, "@.type == SUBCIRCUIT && @.a.value==\"100nF\"")
(String comparison is case sensitive, but you can use regex match too)
The asm plugin is a mixiture of the above functionality plus a thin GUI layer that presents the results in a tree and helps navigating it by selecting subcircuits in question.