Document auto-numbering: three systems, sixteen part types, and freezing

sources/autoNum/ is ~5,085 lines, and the only wiki pages mentioning it
were 7-to-9-line XML reference stubs describing where it is stored.

Covers what a scheme actually is -- an ordered list of parts -- and all
sixteen part types: seven counters (with the per-folio variants and wrap's
modulus), seven context parts that take their value from the element's
position or folio, and string/alpha. Documents that format overrides the
type's natural zero-padding, and that alpha increments like a spreadsheet
column name.

The behaviours that surprise people and were written down nowhere:

- a scheme supplies sequences, a formula places them, and a %sequ_N whose
  index the scheme does not define prints itself verbatim with no warning
- a new conductor joining an existing potential inherits its number; only
  a genuinely new potential draws a fresh one, and a potential whose
  conductors disagree opens the potential selector
- folio variables in a conductor formula resolve per conductor, not per
  potential
- freezing exists at three scopes (project, folio, item), which is why a
  project can hold labels that no longer match their formula
- a scheme with an empty title or formula is silently dropped on save

Also notes that terminal numbering is a separate feature honouring
auto_num_locked. EN/FR/DE.
ispyisail
2026-09-11 22:00:29 +12:00
parent 02de705a9c
commit 53e9b9b4e9
5 changed files with 725 additions and 0 deletions
+2
@@ -24,6 +24,8 @@
**[Terminal strips](terminal_strips)** — strips, levels, bridges
**[Auto-numbering](autonumbering)** — schemes, sequences, freezing
**[Elements XML](elements_XML)**
* [attribute](elements_definition_attribute)
* [uuid](elements_child_uuid)
+242
@@ -0,0 +1,242 @@
# Automatische Nummerierung
QElectroTech kann Elemente, Leiter und Folios für Sie nummerieren. Es gibt
**drei voneinander unabhängige Nummerierungssysteme**, dazu die
Klemmennummerierung, die etwas ganz anderes ist und anders arbeitet.
| System | Nummeriert | Eingestellt in |
|---|---|---|
| Element | Elementbeschriftungen (`K1`, `Q55`) | Projekteigenschaften → Elementnummerierung |
| Leiter | Leitertexte (Drahtnummern) | Projekteigenschaften → Leiternummerierung |
| Folio | das `%autonum` des Foliofelds | Projekteigenschaften → Folionummerierung |
| Klemme | Klemmenleisten-Nummerierung | eigener Dialog — siehe §8 |
Jedes Projekt kann **mehrere benannte Schemata** je System enthalten, und jedes
Folio wählt, welches es benutzt. So kann ein Projekt die Leistungsverdrahtung
anders nummerieren als die Steuerung.
Quellen: `sources/autoNum/``numerotationcontext.cpp`,
`numerotationcontextcommands.cpp`, `assignvariables.cpp` sowie `ui/` für die
Editoren; `sources/conductorautonumerotation.cpp` für Leiter.
---
## 1. Ein Schema ist eine geordnete Liste von Teilen
Ein Nummerierungsschema (im Code ein *Nummerierungskontext*) ist eine Liste von
**Teilen**, hintereinandergesetzt. `K` plus ein Einerzähler ergibt `K1`, `K2`,
`K3`. Folionummer plus `-` plus Zähler ergibt `3-1`, `3-2`.
Jedes Teil hat einen Typ; es gibt sechzehn davon.
### Zählerteile
Sie enthalten eine Zahl und zählen weiter. Sieben Typen:
| Typ | Auffüllung | Anmerkungen |
|---|---|---|
| `unit` | keine | einfacher Zähler: 1, 2, 3 |
| `ten` | auf 2 Stellen | 01, 02 … 10, 11 |
| `hundred` | auf 3 Stellen | 001, 002 … 010 … 100 |
| `unitfolio` | keine | wie `unit`, beginnt je Folio neu |
| `tenfolio` | auf 2 Stellen | wie `ten`, je Folio |
| `hundredfolio` | auf 3 Stellen | wie `hundred`, je Folio |
| `wrap` | keine | springt alle *modulus* Werte zurück auf 0 |
Die `folio`-Varianten sind nützlich, wenn die Nummerierung je Seite neu beginnen
soll statt durch das ganze Projekt zu laufen.
### Kontextteile
Diese beziehen ihren Wert aus dem Ort des Elements, nicht aus einem Zähler:
| Typ | Wird zu |
|---|---|
| `idfolio` | der Folio-Index (`%id`) |
| `folio` | das Foliofeld (`%F`) |
| `plant` | die Anlage des Folios (`%M`) |
| `locmach` | Ort / Maschine des Folios (`%LM`) |
| `elementline` | der Zeilenbuchstabe des Elements (`%l`) |
| `elementcolumn` | die Spaltennummer des Elements (`%c`) |
| `elementprefix` | das Präfix des Elements |
### Textteile
| Typ | Wird zu |
|---|---|
| `string` | fester Text, den Sie eingeben — das `K` in `K1` |
| `alpha` | ein Buchstabe, der a, b … z, aa, ab … weiterzählt |
`alpha` zählt wie ein Tabellen-Spaltenname: zur Basis 26, mit Übertrag von
rechts nach links bei `z`, und mit einem neuen führenden Buchstaben, wenn die
ganze Zeichenkette überläuft. Die Groß-/Kleinschreibung jeder Stelle bleibt
erhalten: Ein Schema ab `A` läuft `A`, `B``Z`, `aA` — der vorangestellte
Buchstabe ist stets klein.
---
## 2. Was man einem Teil sagen kann
Neben seinem Typ trägt ein Zählerteil vier Einstellungen:
| Einstellung | Bedeutung |
|---|---|
| **Wert** | der aktuelle Wert — den das nächste Nummerierte bekommt |
| **Schrittweite** | normalerweise 1 |
| **Startwert** | worauf das Teil zurückgesetzt wird |
| **Modulus** | nur für `wrap`: alle N Werte zurück auf 0 |
| **Format** | Nullen-Auffüllmaske im Tabellenstil: `00` auf zwei Stellen, `000` auf drei |
**Das Format hat Vorrang vor der natürlichen Auffüllung des Typs.** `ten` füllt
von sich aus auf zwei Stellen; mit dem Format `0000` sind es vier. Ein leeres
Format behält die typeigene Breite — genau das tun auch alle Schemata, die vor
Einführung dieses Feldes geschrieben wurden; alte Projekte bleiben also
unberührt.
---
## 3. Vom Schema zur Beschriftung
Ein Schema erzeugt die Beschriftung nicht allein. Es liefert **Sequenzen**, und
eine **Formel** bestimmt, wohin sie kommen.
Die Formel ist gewöhnlicher Beschriftungstext mit `%sequ_1`, `%seqt_1`,
`%seqhf_2` und Verwandten darin — die vollständige Liste steht unter
**[Variablen und Formeln](variables)**. Das Suffix `_1`, `_2` wählt, welches
Teil dieser Familie benutzt wird, in der Reihenfolge ihrer Definition.
Ein Schema mit einem `string`-Teil (`K`) und einem `unit`-Teil ergibt mit der
Formel `K%sequ_1` also `K1`, `K2`, `K3`. Ändert man die Formel zu `%f-K%sequ_1`,
entsteht auf Folio 3 `3-K1`, ohne das Schema anzurühren.
Eine Sequenzvariable, deren Index das Schema nicht definiert, bleibt
**wörtlich im Text stehen**. Eine Beschriftung `%sequ_2` heißt, dass das Schema
nur ein Einerteil hat — keine fehlgeschlagene Nummerierung, und nichts warnt
Sie.
---
## 4. Wann nummeriert wird
**Elemente** werden beim Platzieren nummeriert, sofern für das Folio ein
Elementschema gewählt und neue Elemente nicht eingefroren sind.
**Leiter** sind verwickelter, denn eine Drahtnummer gehört zu einem *Potential*
— allen elektrisch verbundenen Leitern — und nicht zu einem einzelnen Leiter:
- Zieht man einen Leiter an ein **bestehendes Potential**, übernimmt er dessen
Nummer, statt eine neue zu ziehen.
- **Widersprechen** sich die Leiter dieses Potentials — unterschiedliche Texte
oder Formeln —, kann QET nicht raten und öffnet die **Potentialauswahl**,
damit Sie entscheiden.
- Nur ein wirklich **neues** Potential zieht eine frische Nummer aus dem Schema.
Deshalb bewirkt das Hinzufügen eines Drahtes mal gar nichts und stellt mal eine
Frage.
> Verwandte Feinheit: In einer Leiterformel lösen Foliovariablen **je Leiter**
> auf, nicht je Potential. Ein Potential über zwei Folios bekommt also keine
> einheitliche Folionummer — jeder Leiter löst gegen das Folio auf, auf dem er
> gezeichnet ist.
---
## 5. Einfrieren
Einfrieren verhindert, dass sich Nummern mit der Zeichnung ändern. Es gibt drei
Ebenen, die leicht zu verwechseln sind:
| Geltung | Wirkung |
|---|---|
| **Projekt** — neue Elemente / Leiter einfrieren | neu platzierte Objekte entstehen mit eingefrorener Beschriftung |
| **Folio**`freezeNewElement`, `freezeNewConductor` | dasselbe, je Folio |
| **Objekt** — Beschriftung einfrieren | dieses eine Element oder dieser Leiter behält seinen Text |
Eine eingefrorene Beschriftung wird nicht mehr neu berechnet. Fügt man davor ein
Folio ein, bleibt ein eingefrorenes `3-K1` bei `3-K1`, während die nicht
eingefrorenen Nachbarn zu `4-K1` werden. Genau dafür ist die Funktion da — eine
herausgegebene Zeichnung soll sich nicht selbst umnummerieren — aber ebendarum
kann ein Projekt Nummern enthalten, die ihrer eigenen Formel widersprechen.
---
## 6. Automatische Folionummerierung
Die Folionummerierung fällt aus dem Rahmen: Sie speist eine einzige Variable,
`%autonum`, die nur im **Foliofeld** Bedeutung hat. Setzen Sie das Foliofeld auf
`%autonum` (statt auf die Vorgabe `%id/%total`), dann entscheidet das
Folioschema, was erscheint.
Zu beachten: `%f`, `%l`, `%c` und `%{…}` bewirken im Foliofeld **nichts** — es
kennt nur `%autonum`, `%id` und `%total`. Siehe
**[Variablen und Formeln](variables)** §6.
---
## 7. Speicherung
Die Schemata liegen in den Vorgabeeigenschaften des Projekts:
```xml
<conductors_autonums current_autonum="steuerung" freeze_new_conductors="false"
auto_break_conductors="false">
<conductor_autonum title="steuerung" formula="%sequ_1">
<part type="unit" value="1" increase="1"/>
</conductor_autonum>
</conductors_autonums>
<folio_autonums>
<folio_autonum title="seiten"> ... </folio_autonum>
</folio_autonums>
<element_autonums current_autonum="standard" freeze_new_elements="false">
<element_autonum title="standard" formula="%sequ_1"> ... </element_autonum>
</element_autonums>
```
Jedes `<part>` trägt `type`, `value` und `increase`. Drei weitere Attribute
werden **nur geschrieben, wenn sie zutreffen**: `initialvalue` für die drei
`…folio`-Zählertypen, `modulus` für `wrap`, und `format` nur dann, wenn
tatsächlich eine Auffüllmaske gesetzt wurde. Ein fehlendes Attribut bedeutet
also „nicht anwendbar“ oder „Vorgabe“, nicht „null“.
`current_autonum` nennt das benutzte Schema. Ein Schema mit leerem Titel oder
leerer Formel wird **gar nicht geschrieben** — ein halb eingerichtetes Schema
verschwindet daher beim Speichern stillschweigend.
Je Folio trägt `<diagram>` die Attribute `freezeNewElement` und
`freezeNewConductor`.
---
## 8. Die Klemmennummerierung ist eine andere Funktion
Die Klemmen einer Klemmenleiste zu nummerieren gehört **nicht** zu diesem
System. Sie hat einen eigenen Dialog und beachtet einen Schalter je Element: Ein
Element, dessen Informationen `auto_num_locked = "true"` tragen, wird
übersprungen statt umnummeriert.
Dieser Schalter wird mit der exakten Zeichenkette `"true"` verglichen — siehe
**[Elemente verknüpfen](element_linking)** §6. Die Klemmenleisten selbst
behandelt **[Klemmenleisten](terminal_strips)**.
---
## 9. Was überrascht
- **Eine undefinierte Sequenzvariable druckt sich selbst.** `%sequ_2` auf einer
Zeichnung heißt, das Schema definiert ein Einerteil, nicht zwei.
- **Ein Schema ohne Titel oder ohne Formel wird beim Speichern verworfen.** Beim
erneuten Öffnen ist es weg, ohne Meldung.
- **Einfrieren wird je Objekt gemerkt**, ein Projekt kann also absichtlich
Beschriftungen enthalten, die nicht mehr zu ihrer Formel passen.
- **Ein neuer Leiter bekommt meist keine neue Nummer** — er erbt die des
Potentials. Wer eine frische erwartet hat, prüfe, ob der Draht elektrisch mit
etwas bereits Nummeriertem verbunden ist.
- **Das Format schlägt die Typ-Auffüllung**: `ten` mit dem Format `0` liefert
trotz seines Namens ungefüllte Zahlen.
---
Siehe auch: **[Variablen und Formeln](variables)** ·
**[Elemente verknüpfen](element_linking)** ·
**[Klemmenleisten](terminal_strips)** ·
[Project XML](project_XML)
+243
@@ -0,0 +1,243 @@
# Numérotation automatique
QElectroTech peut numéroter pour vous les éléments, les conducteurs et les
folios. Il existe **trois systèmes de numérotation indépendants**, plus la
numérotation des bornes, qui est tout autre chose et fonctionne différemment.
| Système | Numérote | Réglé dans |
|---|---|---|
| Élément | les étiquettes d'éléments (`K1`, `Q55`) | Propriétés du projet → numérotation des éléments |
| Conducteur | les textes de conducteurs (numéros de fils) | Propriétés du projet → numérotation des conducteurs |
| Folio | le `%autonum` du champ folio | Propriétés du projet → numérotation des folios |
| Borne | numérotation des borniers | son propre dialogue — voir §8 |
Chaque projet peut contenir **plusieurs schémas nommés** par système, et chaque
folio choisit celui qu'il utilise. C'est ainsi qu'un même projet peut numéroter
la puissance d'une façon et la commande d'une autre.
Sources : `sources/autoNum/``numerotationcontext.cpp`,
`numerotationcontextcommands.cpp`, `assignvariables.cpp`, et `ui/` pour les
éditeurs ; `sources/conductorautonumerotation.cpp` pour les conducteurs.
---
## 1. Un schéma est une liste ordonnée de parties
Un schéma de numérotation (un *contexte de numérotation* dans le code) est une
liste de **parties** mises bout à bout. `K` + un compteur d'unités donne `K1`,
`K2`, `K3`. Numéro de folio + `-` + un compteur donne `3-1`, `3-2`.
Chaque partie a un type, et il en existe seize.
### Parties compteur
Elles contiennent un nombre et avancent. Sept types :
| Type | Remplissage | Remarques |
|---|---|---|
| `unit` | aucun | compteur simple : 1, 2, 3 |
| `ten` | sur 2 chiffres | 01, 02 … 10, 11 |
| `hundred` | sur 3 chiffres | 001, 002 … 010 … 100 |
| `unitfolio` | aucun | comme `unit`, mais repart à chaque folio |
| `tenfolio` | sur 2 chiffres | comme `ten`, par folio |
| `hundredfolio` | sur 3 chiffres | comme `hundred`, par folio |
| `wrap` | aucun | revient à 0 tous les *modulus* valeurs |
Les variantes `folio` sont les plus utiles quand la numérotation doit
recommencer à chaque page plutôt que courir sur tout le projet.
### Parties de contexte
Elles tirent leur valeur de l'endroit où se trouve l'élément, non d'un
compteur :
| Type | Devient |
|---|---|
| `idfolio` | l'indice du folio (`%id`) |
| `folio` | le champ folio (`%F`) |
| `plant` | l'installation du folio (`%M`) |
| `locmach` | la localisation / machine du folio (`%LM`) |
| `elementline` | la lettre de ligne de l'élément (`%l`) |
| `elementcolumn` | le numéro de colonne de l'élément (`%c`) |
| `elementprefix` | le préfixe de l'élément |
### Parties texte
| Type | Devient |
|---|---|
| `string` | un texte fixe que vous saisissez — le `K` de `K1` |
| `alpha` | une lettre qui avance a, b … z, aa, ab … |
`alpha` s'incrémente comme un nom de colonne de tableur : en base 26, avec
retenue de droite à gauche sur `z`, et ajout d'une nouvelle lettre en tête
lorsque toute la chaîne déborde. La casse de chaque position est conservée :
un schéma partant de `A` donne `A`, `B``Z`, `aA` — la lettre ajoutée est
toujours minuscule.
---
## 2. Ce qu'on peut dire à une partie
Outre son type, une partie compteur porte quatre réglages :
| Réglage | Signification |
|---|---|
| **Valeur** | la valeur courante — celle qu'obtiendra le prochain numéroté |
| **Incrément** | le pas, normalement 1 |
| **Valeur initiale** | la valeur à laquelle la partie se réinitialise |
| **Modulus** | pour `wrap` uniquement : revenir à 0 toutes les N valeurs |
| **Format** | masque de remplissage par zéros, à la façon d'un tableur : `00` sur deux chiffres, `000` sur trois |
**Le format l'emporte sur le remplissage naturel du type.** `ten` remplit sur
deux chiffres tout seul ; lui donner un format `0000` le porte à quatre. Un
format vide conserve la largeur propre au type, ce que font aussi tous les
schémas écrits avant l'existence de ce champ : les anciens projets ne sont donc
pas affectés.
---
## 3. Du schéma à l'étiquette
Un schéma ne produit pas l'étiquette à lui seul. Il fournit des **séquences**,
et une **formule** décide où elles vont.
La formule est du texte d'étiquette ordinaire contenant `%sequ_1`, `%seqt_1`,
`%seqhf_2` et consorts — voir **[Variables et formules](variables)** pour la
liste complète. Le suffixe `_1`, `_2` désigne laquelle des parties de cette
famille utiliser, dans l'ordre où elles sont définies.
Un schéma avec une partie `string` (`K`) et une partie `unit`, avec la formule
`K%sequ_1`, produit donc `K1`, `K2`, `K3`. Changer la formule en `%f-K%sequ_1`
produit `3-K1` sur le folio 3, sans toucher au schéma.
Une variable de séquence dont l'indice n'est pas défini par le schéma est
**laissée telle quelle dans le texte**. Une étiquette affichant `%sequ_2`
signifie que le schéma n'a qu'une seule partie unité — ce n'est pas un échec de
numérotation, et rien ne vous avertit.
---
## 4. Quand la numérotation s'exécute
Les **éléments** sont numérotés à la pose, si le folio a un schéma d'éléments
sélectionné et que les nouveaux éléments ne sont pas gelés.
Les **conducteurs** sont plus subtils, car un numéro de fil appartient à un
*potentiel* — l'ensemble des conducteurs électriquement reliés — et non à un
conducteur :
- Tracer un conducteur sur un **potentiel existant** lui fait hériter du numéro
de ce potentiel plutôt que d'en prendre un nouveau.
- Si les conducteurs déjà présents dans ce potentiel **divergent** — textes ou
formules différents — QET ne peut pas deviner et ouvre le **sélecteur de
potentiel** pour que vous choisissiez la numérotation à retenir.
- Seul un potentiel réellement **nouveau** tire un numéro neuf du schéma.
C'est pourquoi ajouter un fil ne renumérote parfois rien, et pose parfois une
question.
> Subtilité connexe : dans une formule de conducteur, les variables de folio se
> résolvent **par conducteur**, non par potentiel. Un potentiel s'étendant sur
> deux folios n'obtient donc pas un numéro de folio unique : chaque conducteur
> se résout d'après le folio sur lequel il est tracé.
---
## 5. Le gel
Le gel empêche les numéros de changer quand le schéma change. Il existe à trois
niveaux, faciles à confondre :
| Portée | Effet |
|---|---|
| **Projet** — geler les nouveaux éléments / conducteurs | les objets nouvellement posés sont créés avec leur étiquette gelée |
| **Folio**`freezeNewElement`, `freezeNewConductor` | idem, par folio |
| **Objet** — geler l'étiquette | cet élément ou conducteur conserve son texte actuel |
Une étiquette gelée n'est plus recalculée. Insérez un folio avant elle, et un
`3-K1` gelé reste `3-K1` tandis que ses voisins non gelés deviennent `4-K1`.
C'est tout l'intérêt de la fonction — un plan diffusé ne doit pas se
renuméroter — mais c'est aussi pourquoi un projet peut finir avec des numéros
qui contredisent leur propre formule.
---
## 6. Numérotation automatique des folios
La numérotation des folios est à part : elle alimente une seule variable,
`%autonum`, qui n'a de sens que dans le **champ folio**. Mettez le champ folio
à `%autonum` (au lieu du `%id/%total` par défaut) et le schéma de folios décide
de ce qui s'affiche.
Conséquence à noter : `%f`, `%l`, `%c` et `%{…}` ne font **rien** dans le champ
folio — il ne comprend que `%autonum`, `%id` et `%total`. Voir
**[Variables et formules](variables)** §6.
---
## 7. Stockage
Les schémas vivent dans les propriétés par défaut du projet :
```xml
<conductors_autonums current_autonum="commande" freeze_new_conductors="false"
auto_break_conductors="false">
<conductor_autonum title="commande" 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="defaut" freeze_new_elements="false">
<element_autonum title="defaut" formula="%sequ_1"> ... </element_autonum>
</element_autonums>
```
Chaque `<part>` porte `type`, `value` et `increase`. Trois autres attributs ne
sont écrits **que lorsqu'ils s'appliquent** : `initialvalue` pour les trois
types compteur `…folio`, `modulus` pour `wrap`, et `format` seulement si un
masque de remplissage a effectivement été défini. Un attribut absent signifie
donc « sans objet » ou « valeur par défaut », non « zéro ».
`current_autonum` nomme le schéma en usage. Un schéma dont le titre ou la
formule est vide n'est **pas écrit du tout** — un schéma à moitié configuré
disparaît donc silencieusement à l'enregistrement.
Par folio, `<diagram>` porte `freezeNewElement` et `freezeNewConductor`.
---
## 8. La numérotation des bornes est une autre fonction
Numéroter les bornes d'un bornier ne fait **pas** partie de ce système. Elle a
son propre dialogue et respecte un indicateur par élément : un élément dont les
informations portent `auto_num_locked = "true"` est ignoré au lieu d'être
renuméroté.
Cet indicateur est comparé à la chaîne exacte `"true"` — voir
**[Lier des éléments](element_linking)** §6. Les borniers eux-mêmes sont traités
dans **[Borniers](terminal_strips)**.
---
## 9. Ce qui surprend
- **Une variable de séquence non définie s'affiche elle-même.** `%sequ_2` sur un
plan signifie que le schéma définit une partie unité, pas deux.
- **Un schéma sans titre ou sans formule est supprimé à l'enregistrement.** Il
aura disparu à la réouverture, sans message.
- **Le gel est mémorisé par objet** : un projet peut donc contenir, à dessein,
des étiquettes qui ne correspondent plus à leur formule.
- **Un nouveau conducteur n'obtient généralement pas un nouveau numéro** — il
hérite de celui du potentiel. Si vous en attendiez un neuf, vérifiez si le fil
est électriquement relié à quelque chose de déjà numéroté.
- **Le format l'emporte sur le remplissage du type** : `ten` avec un format `0`
produit des nombres non remplis, malgré son nom.
---
Voir aussi : **[Variables et formules](variables)** ·
**[Lier des éléments](element_linking)** ·
**[Borniers](terminal_strips)** ·
[Project XML](project_XML)
+237
@@ -0,0 +1,237 @@
# 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`, `B``Z`, `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](variables)** 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 |
| **Folio**`freezeNewElement`, `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](variables)** §6.
---
## 7. How it is stored
Schemes live in the project's default properties:
```xml
<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](element_linking)** §6. Terminal strips themselves are
covered in **[Terminal strips](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](variables)** ·
**[Linking elements](element_linking)** ·
**[Terminal strips](terminal_strips)** ·
[Project XML](project_XML)
+1
@@ -61,6 +61,7 @@ Beginnen Sie mit der deutschen Version dieses Wikis:
| Project database | ✅ | ✅ | ✅ |
| Variables & formulas | ✅ | ✅ | ✅ |
| Terminal strips | ✅ | ✅ | ✅ |
| Auto-numbering | ✅ | ✅ | ✅ |
**Legend:** ✅ Translated | 📋 Planned | ❌ Not yet started