Re: freepascal-code to take a QET- Element and scale the content by a fact

Hi Plc-user,

it only takes me ~3 seconds to compile it and push it to the repository.

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

Re: freepascal-code to take a QET- Element and scale the content by a fact

plc-user wrote:

Today I uploaded a new version of "QET_ElementScaler" to github: https://github.com/plc-user/QET_ElementScaler

This version is completely rewritten in C++, where I (like QET) use pugixml for handling the contents of the element files.

I made a few additions/changes that makes working with the software easier: The XML description line no longer needs to be removed afterwards!

As before, x and y scaling factors can be specified, input is via STDIN (-i) or a file (-f FILEINAME) and output is, as before, to a new file or to STDOUT (-o).

In addition, I have added the possibility to remove "terminals" from the element. This can be useful when terminals can be omitted from overloaded front views.

Furthermore, there is now the possibility to flip polygons and lines horizontally and/or vertically. This can be useful during the development of complex front views, as long as these functions are not yet available in the QET element editor.

Special care should be taken with the option "--OverwriteOriginal", because here the original file will be overwritten WITHOUT further request!

The scaled values of the new element are written into the new file with a maximum of 2 decimal places. In my view, this is completely sufficient for the display of schematic symbols and front views (thumbnails). In some elements present in the QET collection I have seen values with up to six decimal places, which in my opinion is excessive.
To "fix" such elements, QET_ElementScaler can of course be used! With the call:

QET_ElementScaler -f FILENAME

the values are rounded to max. 2 decimal places and any font sizes with decimal places are rounded to whole numbers.

I wish all users of the software a lot of fun and success with it and would like to see bugs reported (e.g. here or at github). Of course, I also have an "open ear" for suggestions for improvement!

Best regards
plc-user

It's not possible to integreted it directly on QET like it's C++?

Re: freepascal-code to take a QET- Element and scale the content by a fact

scorpio810 wrote:

Hi Plc-user,

it only takes me ~3 seconds to compile it and push it to the repository.

Thank you very much !

Re: freepascal-code to take a QET- Element and scale the content by a fact

galexis wrote:

It's not possible to integreted it directly on QET like it's C++?

There are several new topics for me at once:
For the beginnings in Pascal I only needed to add a little XML to the Pascal knowledge. The change to C++ was then already bigger. But then to integrate that into an existing, grown QT project, that's quite another matter...
For the moment I have put together a small (and from my point of view) usable package. There is no question that in the foreseeable future it will make sense to integrate scaling and mirroring directly into QET's Element-Editor!

Re: freepascal-code to take a QET- Element and scale the content by a fact

Ok, compile and work fine on Apple Silicon chip.
https://download.qelectrotech.org/qet/forum_img_2/QET_ElementScaler_Apple_silicon.jpeg

laurent@mini-de-laurent ~ % cd QET_ElementScaler 
laurent@mini-de-laurent QET_ElementScaler % ./QET_ElementScaler  --FlipVertical -f ../.qet/elements/p.elmt 
laurent@mini-de-laurent QET_ElementScaler % 

Post's attachments

Attachment icon QET_ElementScaler_Apple-Silicon.zip 118.7 kb, 61 downloads since 2023-06-06 

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

Re: freepascal-code to take a QET- Element and scale the content by a fact

plc-user wrote:
galexis wrote:

It's not possible to integreted it directly on QET like it's C++?

There are several new topics for me at once:
For the beginnings in Pascal I only needed to add a little XML to the Pascal knowledge. The change to C++ was then already bigger. But then to integrate that into an existing, grown QT project, that's quite another matter...
For the moment I have put together a small (and from my point of view) usable package. There is no question that in the foreseeable future it will make sense to integrate scaling and mirroring directly into QET's Element-Editor!


Bravo plc-user! QET becomes more and more appealing by the day - many thanks for your great work!


Hamish