1 (edited by acolomb 2023-05-15 22:54:23)

Topic: New tool to generate terminal strip diagrams - text only

There is already a "terminal block generator" plugin for QElectroTech, but it didn't quite fit my needs.  I needed a simpler approach which just references the positions where the terminal elements are defined.  And I use the same terminal strips label (e.g. -X10:4) possibly several times, because each strip has at least two connection points that may not belong on the same folio.  The existing plugin would generate repeated terminal strips for this case.  Also the handling with closing the project to find the generated elements, etc. seems cumbersome.

Hereby I introduce my little open source project "HTML Table Generator From QElectroTech Terminal Elements", or qet_terminal_tables for short.

It works by reading the SQLite database exported from the QET project, then outputting HTML code to a separate file for each block of terminals.  The elements must be labeled with a colon separating the block name from the terminal number (which should be an integer).  The HTML code can then be copied into the Source tab of an HTML-styled text field in the original QET project.  This can be placed next to a drawing of the terminal strip as desired, which ideally has a 20 pixel grid.  Styling is rather limited because of the HTML subset supported by Qt, but a CSS file can be referenced to customize the appearance.

The Python code and docs can be found on GitHub at https://github.com/acolomb/qet_terminal_tables together with a sample project.  Attached is a screenshot.

I tried to keep the code clean and maintainable, but it's not yet properly packaged with versioned releases.  Help with building a proper Python package is very welcome, as are other suggestions and contributions.

Have fun with it and tell me your experiences :-)

Post's attachments

1_terminal_strip_diagram.png, 88.91 kb, 1050 x 719
1_terminal_strip_diagram.png 88.91 kb, 114 downloads since 2023-05-15 

Re: New tool to generate terminal strip diagrams - text only

Hi André you are welcome.

Thanks a lot for your work. nomicons/wink
I haven't tried your code yet, but I'm doing a little comparison with the two-terminal plugin, see image:

https://download.qelectrotech.org/qet/forum_img_2/new-terminal_vs_plugin.png

BTW, Teminal plugin tips:
https://qelectrotech.org/forum/viewtopi … 073#p17073

Regards,
Laurent

Post's attachments

Attachment icon test-terminal-table.qet 309.11 kb, 114 downloads since 2023-05-16 

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: New tool to generate terminal strip diagrams - text only

FYI, Joshua work to integrate terminal generator in QET, see this topic and vidéos:
https://qelectrotech.org/forum/viewtopi … 788#p17788

Video when I try it first time:

Joshua explain it:


Part of the code is in version 0.100.0 dev but the progress of the code is done on the branch terminal_strip
https://git.tuxfamily.org/qet/qet.git/l … inal_strip

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: New tool to generate terminal strip diagrams - text only

That looks pretty cool indeed, thanks for pointing it out. I'm eager to try it out in the next released version.

Until then, I need a stable solution though, based on software that I can point a customer to - no development version which is a moving target and things might just stop working at some point because they were generated with an intermediate development snapshot. Sorry I can't get much more involved with QET development, but rather just consume the stable version releases as they come. What a great software by the way, thanks to all the people making this a reality as FOSS!

Publishing my own little addition as FOSS is my way to give back to the community for being able to use a completely free CAE drawing software.

Re: New tool to generate terminal strip diagrams - text only

Compared to the existing plugin, as I tried to explain, my tool simply collapses all terminals with the same label into one row, whereas qet_tb_generator will duplicate the terminals (see repeated numbers in your screenshot).

And it doesn't insert "missing" terminals in between (number gaps), which we often have when leaving some spare room for connecting later additions.

What both tools cannot do is guess how many more spare / unused terminals there are beyond the highest number found.  That's why I went for drawing the block manually and only generating the labels.  This issue is similar to the "fill in the gaps" feature above, but cannot be solved as easily.

As a final point, we often use terminals with e.g. 4 connection points to distribute the same potential (usually GND, 24 V).  The existing plugin AFAIK only generates one terminal "slot" per reference, you can't tell it that the elements -X10:1a and -X10:1b are actually on the same terminal.  We just put this info into the elements' extra text field, separate from the label.  The terminal strip diagram then just lists the refs in no particular order, but where it's defined in the schematic, you always see which connection point was used (a, b, c, or d).

I hope the future QET-integrated version will address these points (multiple mentions of same terminal; spare terminals in between; spare terminals at the end; more than two connection points). Then it will be suitable for my use-case.

Re: New tool to generate terminal strip diagrams - text only

BTW, I can't get anything on the flathub, strange same patch work in my kvm qemu Debian where I build my flatpak devel...,maybe you could try AppImage to your customer?
https://download.qelectrotech.org/qet/builds/AppImage/

wget https://download.qelectrotech.org/qet/builds/AppImage/0.90/QElectroTech_0.9-r7759-x86_64.AppImage
chmod +x QElectroTech_0.9-r7759-x86_64.AppImage

Just click now on file and QET 0.9 start.

Is portable version, you can have a lot of version on your machine.. 0.9, 0.100.0, etc!

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: New tool to generate terminal strip diagrams - text only

Publishing my own little addition as FOSS is my way to give back to the community for being able to use a completely free CAE drawing software.

Thanks for compliments , you are welcome and thanks for your contribution.
BTW I can't create python package with your code.

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: New tool to generate terminal strip diagrams - text only

Well I needed to install idle-python3.11 otherwise "python3 -m qet_terminal_tables" command didn't work...

git clone https://github.com/acolomb/qet_terminal_tables.git
python3.11 -m qet_terminal_tables /home/laurent/Documents/LAURENT/schemas/2022-7-23_Vibrafloor.sqlite -s qet_terminal_tables/samples/styles-template.css 
[07:50:13] laurent@debian:~$ python3 -m qet_terminal_tables --help
usage: qet_terminal_tables [-h] [-s [FILE]] [-w] [dbfile]

positional arguments:
  dbfile                read database from the given FILE

options:
  -h, --help            show this help message and exit
  -s [FILE], --styles [FILE]
                        include CSS stylesheet (default "styles.css")
  -w, --wrap            output a complete HTML document with framing

I attached project(old)+database and html export.
HTML tables output:
https://download.qelectrotech.org/qet/s … _XANA.html
https://download.qelectrotech.org/qet/s … _XATU.html
https://download.qelectrotech.org/qet/s … ls_XF.html
https://download.qelectrotech.org/qet/s … ls_XH.html
https://download.qelectrotech.org/qet/s … ls_XI.html

Post's attachments

Attachment icon vibrafloor_terminal_table.zip 1.12 mb, 85 downloads since 2023-05-17 

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

9 (edited by acolomb 2023-05-17 08:41:59)

Re: New tool to generate terminal strip diagrams - text only

scorpio810 wrote:

BTW I can't create python package with your code.

As you've shown now, it's quite easy to use.  If we ever need to distribute it in some other way, I'll look into creating a proper runnable Python package.

Happy it worked for your project, are the results correct?  I see there are mentions of a terminal block "XI", but there is no diagram for it.  Is that a connector on some device?  Of course the results there are wrong because the label "XI:24E2" is interpreted by SQLite as having the number

24e2 = 24.0 * 10^2 = 2400.0

Thus it generates these 2400 rows for that block.  You'd need to fix up the naming there to use only integers after the colon.  The other blocks seem fine, just that your existing diagrams actually do have duplicates, e.g. XANA:2.  What does it physically look like, are there two terminal strips next to each other, or is it actually just two connections to one strip?

Thanks for the AppImage pointer, that's actually what I'm using right now.  Just that flatpak notifies me about upgrades automatically and I prefer using it (over e.g. snap) for most software.  Hope you can resolve the build issues.  Wouldn't you just need to adjust the patch in the upstream QET repository, instead of the flathub repo?  Haven't looked closely, but that's where I would have started to look.

Re: New tool to generate terminal strip diagrams - text only

Happy it worked for your project, are the results correct?  I see there are mentions of a terminal block "XI", but there is no diagram for it.  Is that a connector on some device?  Of course the results there are wrong because the label "XI:24E2" is interpreted by SQLite as having the number

24e2 = 24.0 * 10^2 = 2400.0

It 's a old draft, when I draw this project we did not yet know which 2-wire or 3-wire capacitive sensors would be, and whether we would go through a terminal block or wire the multipair directly to the telefast input plates....
See my post here: https://qelectrotech.org/forum/viewtopi … 050#p17050


Now I understand why terminal block "XI" is so long, oho. ;-)

In my project attached you could see terminal block generated by qet_tb_generator plugin that I slightly reworked each terminal block manually because sometimes it was not the rendering that I wanted or the logic of the terminals did not correspond to what I wanted...

For flathub I drop it annoys me, I hope someone else can package it..

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: New tool to generate terminal strip diagrams - text only

XANA:2.  What does it physically look like, are there two terminal strips next to each other, or is it actually just two connections to one strip?

Because it'is 40 X 0,324 mm² wires I prefer to put each conductor strand in a separate terminal which is bridged for current analog sensors we use:

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."