pcb-rnd knowledge pool

 

How refdes works with subcircuits

subc_refdes by Tibor 'Igor2' Palinkas on 2017-10-19

Tags: spec, refdes, subc, subcircuit, element, footprint, name

node source

 

 

Abstract: Details on how the refdes worked with the old element model and how it works with the new subcircuit model.

  Imported from the mailing list archives.

The last piece of the subc "refdes text" cleanup is done. The new code fits nicely into the new data model and pcb-rnd's approach: instead of hardwired hacks and side effects that happen to do The Right Thing for one specific case, provide a few, orthogonal features that can be combined to do the same thing, or 100 other things.

Old, pcb-mainline model: "element text"

An element has 3 hardwired text objects that have to contain the refdes, the value and the footprint name. Further limitations:

New, pcb-rnd model: subc

Instead of the bunch of hardwired properties and restrictions of an element text, subcircuits offer a set of orthogonal features that can be used to reproduce the behavior of element texts too, but can also be used more flexibly:

How to emulate the old behavior with the new features

To get a subc refdes that behaves the same as an element refdes text, except that it's only a refdes text and not a 3-fold "magic text":

Note: when you convert buffer to subc and it doesn't have a refdes text, the code automatically adds one, so you don't need to do this manually for each new subcircuit you draw.

Attributes

property name in old element default/automatic subc attribute name manual override subc attributes pre-subc lihata text object role property
desc footprint visible_footprint, plugin::footprint desc
name refdes (n/a) name
value value (n/a) value

When the code needs to figure what footprint file was used for a subcircuit (e.g. when deciding if a footprint has changed on a new forward annotation), it will always use the default/automatic "footprint" attribute. The manual override affects only the output of some exporters. Note: the footprint attribute should not be overwritten as it may lead to unpredictable effects on importing a schematics. Overwriting the refdes attribute really does change the refdes.

Old fp format element variants:


Element[* "desc" "name" "value" **]
Element(* "desc" "name" "value" **)
Element(* "desc" "name" **)

Old (pre subc) lihata format for Elements will have the 3 magic text objects, with a "role" property. The roles are as described in the above table.

The import action:


ElementList(Need, refdes, footprint, value)