Clone
1
autonumbering
ispyisail edited this page 2026-09-11 22:00:29 +12:00

Auto-numbering

QElectroTech can number elements, conductors and folios for you. There are three independent numbering systems, plus terminal numbering, which is a fourth thing entirely and works differently.

System Numbers Set in
Element element labels (K1, Q55) Project properties → element auto-numbering
Conductor conductor texts (wire numbers) Project properties → conductor auto-numbering
Folio the folio field's %autonum Project properties → folio auto-numbering
Terminal terminal strip numbering its own dialog — see §8

Each project can hold several named schemes per system, and each folio chooses which scheme it uses. That is how one project can number power wiring one way and control wiring another.

Source: sources/autoNum/numerotationcontext.cpp, numerotationcontextcommands.cpp, assignvariables.cpp, and ui/ for the editors; sources/conductorautonumerotation.cpp for conductors.


1. A scheme is an ordered list of parts

A numbering scheme (a numerotation context in the code) is a list of parts joined together in order. K + a unit counter gives K1, K2, K3. Folio number + - + a counter gives 3-1, 3-2.

Each part has a type, and sixteen types exist:

Counter parts

These hold a number and advance. Seven types:

Type Padding Notes
unit none plain counter: 1, 2, 3
ten to 2 digits 01, 02 … 10, 11
hundred to 3 digits 001, 002 … 010 … 100
unitfolio none as unit, but restarts on each folio
tenfolio to 2 digits as ten, per folio
hundredfolio to 3 digits as hundred, per folio
wrap none wraps back to 0 every modulus values

The folio variants are the useful ones for drawings where numbering should restart per page rather than run through the whole project.

Context parts

These take their value from where the element is, not from a counter:

Type Becomes
idfolio the folio index (%id)
folio the folio field (%F)
plant the folio's installation (%M)
locmach the folio's location/machine (%LM)
elementline the element's row letter (%l)
elementcolumn the element's column number (%c)
elementprefix the element's prefix

Text parts

Type Becomes
string fixed text you type — the K in K1
alpha a letter that advances a, b … z, aa, ab …

alpha increments like a spreadsheet column name: base-26, carrying right-to-left on z, and prepending a new leading letter when the whole string overflows. It preserves the case of each position, so a scheme starting at A runs A, BZ, aA — the prepended letter is always lowercase.


2. What each part can be told

Beyond its type, a counter part carries four settings:

Setting Meaning
Value the current value — what the next thing numbered will get
Increase the step, normally 1
Initial value what the part resets to
Modulus for wrap only: wrap back to 0 every N values
Format zero-padding mask, spreadsheet style: 00 pads to two digits, 000 to three

Format overrides the type's natural padding. ten pads to two digits on its own; giving it a format of 0000 makes it four. An empty format keeps the type's own width, which is also what every scheme written before the format field existed does — so old projects are unaffected.


3. From a scheme to a label

A scheme does not produce the label by itself. It supplies sequences, and a formula decides where they go.

The formula is ordinary label text with %sequ_1, %seqt_1, %seqhf_2 and friends in it — see Variables & formulas for the full list. The _1, _2 suffix picks which of the scheme's parts of that family to use, in the order they are defined.

So a scheme with one string part (K) and one unit part, with formula K%sequ_1, produces K1, K2, K3. Changing the formula to %f-K%sequ_1 produces 3-K1 on folio 3, without touching the scheme.

A sequence variable whose index the scheme does not define is left in the text verbatim. A label reading %sequ_2 means the scheme has only one unit part — it is not a numbering failure, and nothing warns you.


4. When numbering runs

Elements are numbered when placed, if the folio has an element scheme selected and new elements are not frozen.

Conductors are more involved, because a wire number belongs to a potential — every conductor electrically joined together — not to one conductor:

  • Drawing a conductor onto an existing potential makes it inherit that potential's number rather than taking a new one.
  • If the conductors already in that potential disagree — different texts or different formulas — QET cannot guess, and opens the potential selector so you choose which numbering the joined potential should take.
  • Only a genuinely new potential draws a fresh number from the scheme.

That is why adding one wire sometimes renumbers nothing, and sometimes asks a question.

A related subtlety worth knowing: folio variables in a conductor formula resolve per conductor, not per potential. A potential spanning two folios therefore does not get one folio number for the whole potential — each conductor resolves against the folio it is drawn on.


5. Freezing

Freezing stops numbers changing when the drawing does. There are three levels, and they are easy to confuse:

Scope What it does
Project — freeze new elements / new conductors newly placed items are created with their label frozen
FoliofreezeNewElement, freezeNewConductor the same, per folio
Item — freeze label this one element or conductor keeps its current text

A frozen label is no longer recomputed. Insert a folio ahead of it, and a frozen 3-K1 stays 3-K1 while its unfrozen neighbours become 4-K1. That is the point of the feature — an issued drawing should not renumber itself — but it is also why a project can end up with numbers that disagree with their own formula.


6. Folio auto-numbering

Folio numbering is the odd one out: it feeds a single variable, %autonum, which is only meaningful in the folio field. Set the folio field to %autonum (instead of the default %id/%total) and the folio scheme decides what appears.

Note the consequence: %f, %l, %c and %{…} do nothing in the folio field — it understands only %autonum, %id and %total. See Variables & formulas §6.


7. How it is stored

Schemes live in the project's default properties:

<conductors_autonums current_autonum="control" freeze_new_conductors="false"
                     auto_break_conductors="false">
    <conductor_autonum title="control" formula="%sequ_1">
        <part type="unit" value="1" increase="1"/>
    </conductor_autonum>
</conductors_autonums>
<folio_autonums>
    <folio_autonum title="pages"> ... </folio_autonum>
</folio_autonums>
<element_autonums current_autonum="default" freeze_new_elements="false">
    <element_autonum title="default" formula="%sequ_1"> ... </element_autonum>
</element_autonums>

Each <part> carries type, value and increase. Three more attributes are written only when they apply: initialvalue for the three …folio counter types, modulus for wrap, and format only when a padding mask was actually set. An absent attribute therefore means "not applicable" or "default", not zero.

current_autonum names the scheme in use. A scheme with an empty title or an empty formula is not written at all — so a half-configured scheme silently disappears on save.

Per folio, <diagram> carries freezeNewElement and freezeNewConductor.


8. Terminal numbering is a different feature

Numbering the terminals of a terminal strip is not part of this system. It has its own dialog, and it respects a per-element flag: an element whose information carries auto_num_locked = "true" is skipped rather than renumbered.

That flag is compared against the exact string "true" — see Linking elements §6. Terminal strips themselves are covered in Terminal strips.


9. Things that catch people out

  • An undefined sequence variable prints itself. %sequ_2 on a drawing means the scheme defines one unit part, not two.
  • A scheme with no title or no formula is dropped on save. It will be gone when you reopen, with no message.
  • Freezing is remembered per item, so a project can contain labels that no longer match their formula, on purpose.
  • A new conductor usually does not get a new number — it inherits the potential's. If you expected a fresh number, check whether the wire is electrically joined to something already numbered.
  • Format overrides type padding, so ten with format 0 produces unpadded numbers despite its name.

See also: Variables & formulas · Linking elements · Terminal strips · Project XML