mcp_server, scripting: folio wire defaults, set_conductor_default (pending #1214)

ispyisail
2026-10-02 07:23:17 +13:00
parent c3e203557b
commit b4d37b94bc
2 changed files with 47 additions and 0 deletions
+19
@@ -388,6 +388,25 @@ Across the shipped examples: 3190 conductors, not one with a cable value.
take `"conductor": "{uuid}"` (as `qet_conductors` reports it) in place of
`element` + `terminal`, which works where two conductors meet at a
terminal, as long as one of the conductor's two terminals carries only it.
- **A folio's wire defaults: `set_conductor_default`.**
> **Status: pending.** This item describes
> [PR #1214](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/1214),
> not yet merged. It does not work until that lands.
Sets one of the defaults in *Propriétés du folio* (*Folio properties*).
`onetextperfolio` is the option *activer l'option un texte par potentiel*:
`"true"` draws one wire number per potential on that folio instead of one
per wire. Any `set_conductor` property is accepted too, as the starting
value for wires drawn later on that folio.
```json
{"op": "set_conductor_default", "folio": 0, "property": "onetextperfolio", "value": "true"}
```
`"folio": -1` sets the project's defaults instead. Folios added
afterwards copy them; existing folios keep their own, so set each one.
Like the dialogs, this has no undo.
- **A terminal can be given by its uuid**
([PR #1126](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/1126)):
`terminal`, `from_terminal` and `to_terminal` also take the
+28
@@ -197,6 +197,34 @@ qet.addConductor(0, coil, a2, lamp, qet.terminalIndex(0, lamp, "{77aa…}"));
symbol file's terminals. Every terminal of an opened project has one (see
[the project database](project_database), section 4).
### A folio's wire defaults
> **Status: pending.** This section describes
> [PR #1214](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/1214),
> not yet merged. Nothing here works until that lands.
```js
qet.setConductorDefault(folioIndex, property, value) // -> false if refused
qet.conductorDefault(folioIndex, property) // -> "" if unknown
```
The defaults in *Propriétés du folio* (*Folio properties*): what wires drawn
later on the folio start from, and the folio-wide option
*activer l'option un texte par potentiel*, named `onetextperfolio`
(`"true"` / `"false"`). The other property names are the ones
`setConductorProperty()` takes. A `folioIndex` of `-1` means the project's
defaults, which each folio added later copies.
```js
for (var i = 0; i < qet.folioCount(); i++)
qet.setConductorDefault(i, "onetextperfolio", "true"); // one number per potential
qet.setConductorDefault(-1, "onetextperfolio", "true"); // and on folios added later
```
Changing `onetextperfolio` shows or hides the wire numbers at once, so an
export later in the same script draws them right. There is no undo for
these, the same as in the dialogs.
### Navigate and message
```js