Mailing list archives : pcb-rnd

ID:5778
From:rn...@igor2.repo.hu
Date:Thu, 11 Aug 2022 08:48:42 +0200 (CEST)
Subject:[pcb-rnd] sch-rnd: new: auto-number unnamed syms for compilation and renumber plugin
replies: 5779 from rn...@igor2.repo.hu
Hi all,
 
I am gradually redirecting traffic from the cschem mailing list to this 
mailing list now that sch-rnd is reaching beta testing phase. 
 
(There's been reduced traffic on this list in 2022 because most 
development effort went into sch-rnd while pcb-rnd got mostly bugfixes. 
Now that I am merging the mailing list, we'll get back our normal traffic 
volume.)
 
Erich started to test sch-rnd on real boards and reported a lot of bugs 
and misfeatures. These two are related to the situation when you place a 
lot of symbols initially.
 
Note: in the cschem model groups have the "name" attribute to name them. 
This is true to symbols as well. In other systems there are different 
attribute/property keys to name things, like "refdes" for the name of a 
symbol. So whenever you see "name" in the context of symbols, it is what 
we often call "refdes" in other systems.
 
 
We have two new features:
 
 
1. name "unnamed" (R??) symbols for compilation
 
There is a convention to have library symbols' name field contain the 
right prefix but "??" suffix instead of number. So a resistor symbol's 
initial name is R??, a capacitor's is C??, an opamp's U??, etc. I've 
followed this convention in the standard lib.
 
When you initially place them, this means you will get a lot of symbols 
that will be combined into the same component during compilation due to 
name match. This may cause attribute collisions (compilation errors), 
especially if you start assigning different values and footprints before 
actually naming your symbols.
 
To overcome this inconvenience, I've implemented an optional feature, on 
by default, which renames "?" ending symbols to autogenerated unique named 
symbols during compilation. Note: this code does _not_ change your 
drawing, the concrete model, it changes only the abstract model. So your 
symbols are still named R?? and C?? and so on, until you rename them.
 
It's a similar mechanism how unnamed nets are automatically named. There 
is a big difference tho: in case of networks, we have to name every 
network at the end of the day. In case of symbols if a symbol does not 
have a name attribute, that means you do not want it to show up in the 
output ("netlist"). So this feature does not _create_ a name attribute on 
symbols, it only transforms existing names if they are ending in one or 
more "?" characters, assuming these are "yet-to-be-named" symbols.
 
The feature can be disabled via the plugins/std_cschem/fix_unnamed_syms 
config node.
 
 
 
2. renumber plugin: CLI and GUI
 
Once you are done with arranging your symbols, you definitely want to name 
them, tho. You can go and manually do this symbol by symbol (quickest way 
is hotkey {a a}), but sch-rnd now also offers a way to semi-automate it.
 
We have a Renumber() action and a RenumberDialog() action. The dialog is 
also accessible via the menu: 
 
edit/change multiple objects/renumber symbols.
 
The dialog shows and explains all arguments to the Renumber() action. The 
action takes all selected symbols (or all symbols on the sheet) and starts 
renumbering them from the specified base number (1 by default). It tries 
to assign numebrs per prefix (i.e. counting separately for R's, C's, U's, 
and whatever non-numeric name prefixes you used) but it also makes sure it 
does not assing a name that is already in use on the sheet by a symbol you 
are not renaming.
 
There is a sort argument that tells how symbols-to-be-renumbered should be 
sorted before renumbering. This affects how the numbering goes, 
e.g. left-to-right or right-to-left.
 
The typical use cases:
 
- you are lazy, and just renumber everything on your sheet, e.g. once it's 
already too messy
 
- your drawing contains sections; you select everything within a section 
and renumber them with a base of 100, so you get R100, R101, R102, etc; 
then you renumber another section starting from 200, etc.
 
 
Unlike the feature discussed in 1., the renumber plugin really renames 
your symbols on the drawing (in the concrete model).
 
 
Note: at the moment the action works on sheet basis. Later we may extend 
this to project basis (so that naming collisions are avoided not only 
within the sheet, but within the project). We may also introduce more 
sorting methods, those are cheap to implement.
 
Note: this is all in a plugin, and is not part of the official cschem 
specification. I consider this an optional feature; some users may want to 
have it differently. They can implement their idea in an user script. They 
can even disable the renumber plugin and implement an user script with the 
same actions to replace it!
 
 
Best regards,
 
Igor2
 
 

Reply subtree:
5778 [pcb-rnd] sch-rnd: new: auto-number unnamed syms for compilation and renumber plugin from rn...@igor2.repo.hu
  5779 Re: [pcb-rnd] sch-rnd: new: auto-number unnamed syms for compilation from rn...@igor2.repo.hu