26 (edited by plc-user 2023-12-01 19:31:20)

Re: QET-Element to SVG

Hello Erik,

as Joshua also explained in this Post (https://qelectrotech.org/forum/viewtopi … 180#p19180) (see above):

In QET we have the CheckBox "closed" for a Polygon. Then the Start- and End-Points of are connected.
In SVG there is no such attribute: There is "Polyline" for "open" and "Polygon" for "closed".

The Element you mentioned has some "open" polygons so that's why a "Polyline" must be used for SVG.

Can you explain, why you think "Polyline" may be wrong or "not good"?

EDIT:
If you think the "kink" in the dashed line is not properly recognizable, then I must refer you to the creator of this element: The drawing is not correct!

These kinks in the dashed lines represent a kind of "notch" for the actuation, which (since I have been working in electrical engineering) is shown with a solid line. Only the notch, not the rest of the mechanical connection of the switching elements! In the attachment you find a screenshot from "Eaton Schaltungsbuch 2023" PDF-Page 485 (https://www.eaton.com/de/de-de/support/ … sbuch.html)

Have we found a volunteer here who wants to fix this error in the elements, Erik?  nomicons/wink

Post's attachments

Bildschirmfoto_Betätigung_Raste_durchgezogene_Linie.png, 43.66 kb, 411 x 444
Bildschirmfoto_Betätigung_Raste_durchgezogene_Linie.png 43.66 kb, 32 downloads since 2023-12-01 

Re: QET-Element to SVG

Line-Endings for SVG-Output are implemented now!  nomicons/smile
Additionally: Line-widths and the dotted and dashed lines were slightly "adjusted".

On https://github.com/plc-user/QET_ElementScaler you find a new pre-release.

In the attachment you see an example: SVG on the left; QET-Element-Editor on the right.
The blue rects in the background show the positions of x-values of the lines and the distances "length1" and "length2" of the Line-Endings.
For me the lines left/right look very similar!

We get closer to a first "non-beta" release.
The next great step will be texts with line-breaks. More on this: later.

Best regards
  plc-user

Post's attachments

Attachment icon Bildschirmfoto_Linien_mit_Enden.png 70.68 kb, 14 downloads since 2023-12-03 

Re: QET-Element to SVG

Hallo plc-user,

WoW... \o/ very good job, thank you again..

Cheers,
Laurent

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

Re: QET-Element to SVG

Salut Laurent !

Je suis heureux d'apprendre que tu es de retour et que tu es sur la voie de la guérison !

Une première version est désormais disponible sur https://github.com/plc-user/QET_ElementScaler, qui tient compte des sauts de ligne pour les éléments "text". De mon point de vue, c'est déjà bien utilisable !

Mais ce qui n'est définitivement pas possible, c'est que le format SVG ne le supporte pas : Le formatage de texte à l'aide d'espaces !

Sans compter qu'il n'est pas de bon ton de formater un texte avec des espaces, plusieurs espaces sont supprimés par le visualiseur SVG (comme en HTML) !

Merci de tester la nouvelle version et de donner votre avis sur les résultats : Je ne peux pas vérifier seul tous les éléments QET (plus de 8000) individuellement ! Seule votre participation permettra d'améliorer le programme !

Cordialement,
  plc-user


"Das war Französisch" ... vom Online-Übersetzer


Hallo zusammen!

Auf https://github.com/plc-user/QET_ElementScaler gibt es nun eine erste Version, die bei "text"-Elementen die Zeilenunbrüche beachtet. Aus meiner Sicht ist das schon gut brauchbar!

Was aber definitiv nicht geht, weil das SVG-Format das nicht unterstützt: Formatieren von Text mit Hilfe von Leerzeichen!
Mal ganz davon abgesehen, dass es kein guter Stil ist, Text mit Leerzeichen zu formatieren, werden mehrere Leerzeichen (wie bei HTML auch) vom SVG-Betrachter unterdrückt!

Bitte testet die neue Version und gebt Rückmeldung zu den Ergebnissen: Ich kann nicht allein alle QET-Elemente (mehr als 8000) einzeln überprüfen! Nur durch eure Mitwirkung kann das Programm besser werden!

Gruß
  plc-user



und nun noch auf Englisch:

Hello everybody!

There is a first version on https://github.com/plc-user/QET_ElementScaler that recognises line breaks for "text" elements. From my point of view, this is already very useful!

But what definitely doesn't work because the SVG format doesn't support it: Formatting text using spaces!
Quite apart from the fact that it is not good style to format text with spaces, multiple spaces (as with HTML) are suppressed by the SVG viewer!

Please test the new version and give feedback on the results: I cannot check all QET elements (more than 8000) individually! The software can only improve with your cooperation!

Best regards
  plc-user

Re: QET-Element to SVG

Hallo Plc-user

I tried to compile it on OSX arm64.. on my mac Mini M2...
What could I have forgotten?


laurent@mac-mini-de-laurent ~ % cd QET_ElementScaler 
laurent@mac-mini-de-laurent QET_ElementScaler % git pull
remote: Enumerating objects: 131, done.
remote: Counting objects: 100% (131/131), done.
remote: Compressing objects: 100% (74/74), done.
remote: Total 131 (delta 83), reused 102 (delta 57), pack-reused 0
Receiving objects: 100% (131/131), 54.95 KiB | 2.50 MiB/s, done.
Resolving deltas: 100% (83/83), completed with 8 local objects.
From https://github.com/plc-user/QET_ElementScaler
   5505d2a..e849cd7  master     -> origin/master
 * [new tag]         0.5.0beta5 -> 0.5.0beta5
 * [new tag]         0.5.0beta1 -> 0.5.0beta1
 * [new tag]         0.5.0beta2 -> 0.5.0beta2
 * [new tag]         0.5.0beta3 -> 0.5.0beta3
 * [new tag]         0.5.0beta4 -> 0.5.0beta4
Updating 5505d2a..e849cd7
Fast-forward
 LICENSE                    |    2 +-
 QET_ElementScaler.cbp      |    4 +
 README.md                  |   34 +-
 compile.cmd                |   24 +-
 compile.sh                 |   39 +-
 inc/elements.cpp           | 1591 ++++++++++++++++++++++++++++++++++++++++
 inc/elements.h             |  694 ++++++++++++++++++
 inc/helpers.cpp            |  177 +++++
 inc/helpers.h              |   98 +++
 inc/pugixml/pugiconfig.hpp |    6 +-
 inc/pugixml/pugixml.cpp    | 1744 +++++++++++++++++++++++---------------------
 inc/pugixml/pugixml.hpp    |   28 +-
 main.cpp                   |  982 +++----------------------
 main.h                     |  810 ++++++++++++--------
 scale.cmd                  |    2 +-
 scale.sh                   |    2 +-
 toSVG.cmd                  |   38 +
 toSVG.sh                   |   24 +
 18 files changed, 4208 insertions(+), 2091 deletions(-)
 create mode 100644 inc/elements.cpp
 create mode 100644 inc/elements.h
 create mode 100644 inc/helpers.cpp
 create mode 100644 inc/helpers.h
 create mode 100644 toSVG.cmd
 create mode 100755 toSVG.sh
laurent@mac-mini-de-laurent QET_ElementScaler % git stash                      
No local changes to save
laurent@mac-mini-de-laurent QET_ElementScaler % ./compile.sh 



--------------------------------------------------------------------------------
inc/helpers.cpp:91:23: error: implicit instantiation of undefined template 'std::basic_stringstream<char>'
    std::stringstream ss;
                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iosfwd:134:32: note: template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_stringstream;
                               ^
1 error generated.
inc/elements.cpp:289:23: error: implicit instantiation of undefined template 'std::basic_stringstream<char>'
    std::stringstream ss(font);
                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iosfwd:134:32: note: template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_stringstream;
                               ^
inc/elements.cpp:412:23: error: implicit instantiation of undefined template 'std::basic_stringstream<char>'
    std::stringstream ss(font);
                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iosfwd:134:32: note: template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_stringstream;
                               ^
2 errors generated.
In file included from main.cpp:52:
./main.h:247:23: error: implicit instantiation of undefined template 'std::basic_stringstream<char>'
    std::stringstream ss;
                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iosfwd:134:32: note: template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_stringstream;
                               ^
1 error generated.
clang: error: no such file or directory: 'obj/inc/helpers.o'
clang: error: no such file or directory: 'obj/inc/elements.o'
clang: error: no such file or directory: 'obj/main.o'
--------------------------------------------------------------------------------



laurent@mac-mini-de-laurent QET_ElementScaler % 

Best regards,
Laurent

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

31 (edited by plc-user 2023-12-04 14:48:17)

Re: QET-Element to SVG

Salut Laurent!

I don't get this error on my Debian Unstable.
Maybe there's something missing in helpers.cpp?

Try to add
"#include <string>" or
"#include <sstream>"
at line 30 in helpers.cpp

Re: QET-Element to SVG

Hallo plc-user

fixed for me, yeahh

Edit :
I just saw your answer now:

there is my patch/workaround... uhuhu
Isn't perfect, but that compile fine..

laurent@mac-mini-de-laurent QET_ElementScaler % git diff
diff --git a/inc/elements.h b/inc/elements.h
index 0e4b024..129d4e9 100644
--- a/inc/elements.h
+++ b/inc/elements.h
@@ -31,7 +31,8 @@
#include <cmath>        // sqrt, ...
#include <vector>       // für Polygone
#include <tuple>        // einzelne Punkte des Polygons
-
+#include <sstream>
+#include <vector>
#include "pugixml/pugixml.hpp"
 
#define _DEBUG_ 0
diff --git a/inc/helpers.h b/inc/helpers.h
index 42c7a35..a07ecc4 100644
--- a/inc/helpers.h
+++ b/inc/helpers.h
@@ -28,7 +28,8 @@
 
#include <iostream>     // for IO-Operations
#include <cstdint>      // int8_t, ...
-
+#include <sstream>
+#include <vector>
#define _DEBUG_ 0
 
 
diff --git a/main.h b/main.h
index f7215ad..3cf44aa 100644
--- a/main.h
+++ b/main.h
@@ -33,6 +33,8 @@
#include <getopt.h>     // for Commandline-Parameters
#include <filesystem>   // for exe-filename
#include <regex>        // for "double"-Check
+#include <sstream>
+#include <vector>
 
#define _DEBUG_ 0

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

Re: QET-Element to SVG

Salut Laurent!

Thank you for your feedback!

I'll put the missing includes to the sources!

As already said:
I do not get any errors on Debian, ReactOS or Win10 ... strange.

Re: QET-Element to SVG

Hallo Plc-user!


I asked Remi Collet, a Red Hat developer who I have met every day for 15 years on the IRC QET channel, if he had 5 minutes to try on his new AMPERE arm64 machine, and compile your code, it compile it very well on Fedora Aarch64, so I looked for what I might be missing, maybe a library or something missing in the headers in my OSX Sonoma toochain.

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

Re: QET-Element to SVG

plc-user wrote:

Salut Laurent!

Thank you for your feedback!

As already said:
I do not get any errors on Debian, ReactOS or Win10 ... strange.

I just tried on OSX ... no luck, uhuhu
I think is to be so easy to compile it under my Debian Unstable.. nomicons/wink

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

Re: QET-Element to SVG

MacOS apple SiliconQET-Element to SVG binary compiled from scratch, not authentified and not notarized by Apple severs.

Sleep time...for me!

Post's attachments

Attachment icon QET_ElementScaler.zip 158.79 kb, 29 downloads since 2023-12-04 

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

Re: QET-Element to SVG

Hallo Plc-user,

I used your scripts
The collection is here:
https://download.qelectrotech.org/qet/elements/

Best regards,
Laurent

https://download.qelectrotech.org/qet/elements/10_electric/20_manufacturers_articles/endress_hauser/sonde-pression-ceraphant-ptp33b.svg

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

Re: QET-Element to SVG

Hmm error
https://download.qelectrotech.org/qet/e … _fmu90.svg

Edit: now element-contrib repository:
https://download.qelectrotech.org/qet/elements_contrib/

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

Re: QET-Element to SVG

Salut Laurent !

Thank you for testing that function!

You found an element that contains text with characters that have to be converted to a HTML-Entity. In this case: "&"
That's one thing that is not covered, yet.

I'm working on it!

40 (edited by plc-user 2023-12-16 19:49:57)

Re: QET-Element to SVG

First version with translating html-entities is available as Source on github.
It's the first "brute-force"-version that's far from perfect.  nomicons/wink
If someone knows if I can use the pugi-internal function "text_output_escaped" for this, please let me know!

In this context I corrected an error with text-size of "dynamic_text".

Re: QET-Element to SVG

plc-user wrote:

First version with translating html-entities is available as Source on github.
It's the first "brute-force"-version that's far from perfect.  nomicons/wink
If someone knows if I can use the pugi-internal function "text_output_escaped" for this, please let me know!

In this context I corrected an error with text-size of "dynamic_text".

Hallo Plc-user,

I make a git pull on your Source Github, re compile Sources, clean my element directory, run toSVG.sh script, after use rsync  for sync my directory to remote.

Good work, thanks a lot.

Best regards,
Laurent


https://download.qelectrotech.org/qet/elements_contrib/60_energy/41__manufacturers_articles/imi-ta/tafusioncdn40tamc100fse%20-%20Copie.svg

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

Re: QET-Element to SVG

A "big hammer" isn't always the best tool:  nomicons/wink
I re-worked the sources of entity-converter to be a bit "milder".
Now letters with accents and unicode should (!) work again.

Re: QET-Element to SVG

I refreshed online collection after rebuilding new source with your patch change.
While wandering around the collections I just came across a new bug...

Dynamic text isn't saw here, but also  not saw in QET tree element panel thumbnail, or general element viewer..here ... So since 0.8 version I' m tried..
No one noticed it, not even us. nomicons/smiley-green

https://download.qelectrotech.org/qet/e … 10-2ro.svg
https://download.qelectrotech.org/qet/elements/10_electric/20_manufacturers_articles/sick/009_safety_modules/ue410-2ro.svg
https://download.qelectrotech.org/qet/forum_img_2/dynamic-text_viewer_bug.png

https://download.qelectrotech.org/qet/forum_img_2/dynamic-text_viewer_bug2.png

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

44 (edited by plc-user 2023-12-18 14:11:41)

Re: QET-Element to SVG

Texts are there but with font-size=0  nomicons/sad

The tags for font-size in "input" and "dynamic_text" are different: Fixed that in source-code of QET_ElementScaler.

[Edit]:
Just as a question:
Do we have the option of using the element editor with command line parameters?
"Open" in the old file format and "Save to a file" in the current file format would be sufficient.

Re: QET-Element to SVG

The tags for font-size in "input" and "dynamic_text" are different: Fixed that in source-code of QET_ElementScaler.

Nice, fixed also in remote collections here.

Do we have the option of using the element editor with command line parameters?
"Open" in the old file format and "Save to a file" in the current file format would be sufficient.

Not yet.

qelectrotech command lines are very limited, Usage : qelectrotech [options] [file]...

See https://github.com/qelectrotech/qelectr … qetapp.cpp
https://github.com/qelectrotech/qelectr … .cpp#L2425

qelectrotech file.elmt //open element editor
qelectrotech file.qet //open diagram editor
qelectrotech file.titleblock //open  titleblock editor

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

Re: QET-Element to SVG

Salut Laurent !

I searched the elements-directory and found 4089 Elements with "input", which was the old element-part of actual "dynamic_text".

As explained above: Then I opened all of them in Element-Editor and saved them again in the actual file-format.
Some of the files represent References, which caused errors when trying to save: see screenshot in attachment.
I also attached these files in a *.tar.gz.

I  might create a PullRequest at GitHub to update the QET-Elements which could be saved without errors.
Do you think I should, Laurent? Would be a bigger change ... nomicons/wink

Best regards
  plc-user

Post's attachments

Bildschirmfoto_References-Error.png, 17.15 kb, 399 x 203
Bildschirmfoto_References-Error.png 17.15 kb, 26 downloads since 2023-12-19 

Attachment icon qelectrotech-elements_WITH_ERRORS.tar.gz 6.71 kb, 28 downloads since 2023-12-19 

Re: QET-Element to SVG

Hallo Plc-user,

these elements serve as folio reports and allow you to link two different components, as these components are of the folio report type it is mandatory that there is a one terminal, this is why you have the warning widget.

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

Re: QET-Element to SVG

These elements tampered with as folio reports are very useful and some people use them a lot...

It's based of me's workaround like this vidéo:

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

Re: QET-Element to SVG

scorpio810 wrote:

these elements serve as folio reports and allow you to link two different components, (...).

Don't get me wrong: I want to keep these elements!
All I want is to get rid of those "input" inside the elements and replace them with "dynamic_text" to have elements that were created using the current version of element-editor!

In the attachment you find a *.tar.gz with updated elements.
Would someone who uses them regularly please test if they work as expected?

If so, I'll create a PullRequest with all 4089 updated Elements.

Post's attachments

Attachment icon qelectrotech-elements_REWORKED_REFERENCES.tar.gz 11.65 kb, 27 downloads since 2023-12-19 

Re: QET-Element to SVG

If I remember well, for these special elements ..., you need to hacks these with an text editor, not by element editor also you can bypass warning box you saw.

Post's attachments

Attachment icon untitled.qet 19.03 kb, 29 downloads since 2023-12-19 

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