Repository navigation
Improve terminal_strip #1423
Replies: 11 comments 7 replies
|
I would say this is part of the discussion in #1267 and #1158 and others regarding differenet kinds of schematic (views), how to represent them internally and whether to have linked element views. I saw your change regarding functional (diode & Co) terminals: that's good but complex terminals are still not covered. E.g. a terminal element with two anti parallel diodes (available from Wago or Phoenix) where one potential is connected to e.g. connection points:
|
That has to be covered by the cable manager which also has to provide for more complex cables. See e.g. figure 83 in IEC 61082-1 |
|
I needed it for my work, and qet_tb_generator couldn’t be used because sorting by label is too time-consuming, so I took Joshua’s work and improved it for my project. And so push it for all QET guys. |
|
I haven’t heard from Joshua (the lead developer) for several months now; he’s set about building a terminal block manager – a highly complex task – on his own and without the help of AI, as is the case today, just as it was when he first started working on it. Rather than leaving the code faulty and abandoned, I decided to improve it, as I needed it. |
|
Rather than keeping the code to myself, I thought I’d share it with all our users – is that a problem for anyone here...!? |
You use it?, me not! |
|
Short answer: with what is in master today, I can’t draw them properly. At the moment a terminal has one type (fuse, diode, LED, ground, anti-parallel diodes…) and the strip plan draws one small symbol for it. That works for a simple diode or a fuse with LED. It says nothing about the inside of the terminal, so it is a stop-gap, not a solution for your two examples. From the product pages (I only have the titles, not the internal diagrams): 2002-2214/1000-490: double-deck, 2 diodes 1N4007, anode on top. EPLAN has main and auxiliary terminals, which lets one housing be represented by several terminals, and a multi-level terminal is defined by a level and a sort code. Its tech tip on variable terminals builds a sensor (initiator) terminal exactly this way: a base terminal plus supplementary terminals, combined into one multi-level terminal. For QET I would not add more types to the list. I would rather describe the terminal itself: connection points (id, position: deck, top/bottom), Open question: where does this description live? In the element definition, or in part data attached to the terminal? That seems to be part of the discussion about views and linked element views in #1267 and #1158, so I would rather not invent something in the strip code before that is decided. EPLAN, présentation des bornes : https://eplan.help/en-us/infoportal/content/Plattform/2.9/Content/htm/terminalgui_k_start.htm |
|
https://qelectrotech.org/forum/viewtopic.php?pid=23489#p23489 |
|
https://qelectrotech.org/forum/viewtopic.php?pid=23508#p23508 |




Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Terminal strip: natural sort fix, and why the strip plan cannot host real terminals
Bug: the “Position automatique” button (SortTerminalStripCommand::sort()) sorted terminal labels as plain strings. A label such as XAUZ1:10 does not start with a digit, so the old ^\d+ regex never matched and the code fell back to string comparison. The result was XAUZ1:1, :10, :13 … :19, :2, :20. The int/string mix was also not a strict weak ordering, which std::sort requires.
First attempt: QCollator with setNumericMode(true). It did not work: with a Qt build without ICU (tested with Qt 6.4), numeric mode is ignored, even with the default locale.
Fix: a new QETUtils::naturalLessThan(), a hand-written natural comparison. Digit runs are compared by value, the comparison is case insensitive, and 1 comes before 01 on a tie. I tested the logic with Qt 6.4: it gives :1, :2, :3 … :9, :10, :11 and 1AUZ1 < 01AUZ1 < 2AUZ1 < 10AUZ1, with a consistent ordering.
Used in: SortTerminalStripCommand, FreeTerminalModel and TerminalStripTreeDockWidget (strip names and free terminals).
The strip plan is not an element. TerminalStripItem derives from QetGraphicsItem and its content is painted directly with QPainter by TerminalStripDrawer::paint(). The drawer only receives abstract interfaces (strip, physical terminal, real terminal, bridge) and draws rectangles and text.
As far as I can tell, conductors attach to Terminal objects, which belong to an Element and come from the PartTerminals of its definition. The strip plan has no element definition, so it has no Terminal objects for a conductor to attach to. Drawing a “terminal” in the plan only adds pixels.
Adding terminals to the plan would mean either:
turning TerminalStripItem into an element-like item that creates and owns real Terminal objects, one or two per physical terminal, positioned from the layout and kept in sync when the strip changes (reorder, group, bridge); or
generating a static element from the strip, as the external tool qet_tb_generator does. That gives real terminals but a frozen symbol: no live xrefs, and positions do not follow the strip.
Draw a symbol per terminal type (fuse, disconnect, diode, ground, LED), adapted to the cell width. A fuse with LED shows both.
Real connection terminals at the top and bottom of each terminal rectangle in the plan.
Cable and wire display as in the qet_tb_generator tutorial. Columns: HOSE (cable name, e.g. 9W2, shared by several terminals) and CONDUCTOR (wire mark). A single connection at the top, and at the bottom a cable drawn with its input wires, its name, its output wires and the shield (SH) as a dotted ellipse.
Cable data (wire colour or wire number) can be exported from a spreadsheet, so the cable and wire columns can be filled from existing cable lists instead of being typed by hand.
The plan must stay live: xrefs and positions follow the strip.
All reactions