From b4d37b94bc1f1ed6641693bfc8e53ef97dd99d66 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Fri, 2 Oct 2026 07:23:17 +1300 Subject: [PATCH] mcp_server, scripting: folio wire defaults, set_conductor_default (pending #1214) --- mcp_server.md | 19 +++++++++++++++++++ scripting.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/mcp_server.md b/mcp_server.md index b1ee439..989311a 100644 --- a/mcp_server.md +++ b/mcp_server.md @@ -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 diff --git a/scripting.md b/scripting.md index 88ddc1d..868c9e4 100644 --- a/scripting.md +++ b/scripting.md @@ -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