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

plc-user wrote:

Hello S.DEFFAUX!

Who do you want to punish with such work?  nomicons/wink
Checking all existing QET-Elements if they show a
front-view and then scale them by hand...

In the Lazarus-/freepascal-Wiki I found the beginning
of the now existing freepascal-code to take a QET-
Element and scale the content by a factor.

You find the sources and pre-compiled versions for
Debian unstable and ReactOS at
https://github.com/plc-user/QET_ElementScaler

The code compiles/runs with Lazarus 2.0.10 and
FreePascal 3.2.0 on Debian/GNU Linux (unstable) and
ReactOS (0.4.15-dev-1196) (didn't try, but should run
on win7 or 10, too)

In combination with a small shell-script the program
edited all front-views of "my" elements (about 800)
in 1.5 seconds.


But still the main-Question is: What scaling-faktor
do we want to use for front-views of our elements.
In my opinion 100 mm -> 200 px is a good value!
That means that ${someone} has to check, if the already
existing parts use the same scaling-factor. As I wrote
in a previous message: The three examples had three
different factors and I guess there are even more in the
QET-collection ...


Best regards
  plc-user

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

I hadn't really tested this little utility yet, but recently I had to get back to drawing at work for a new electrical project ...
and this great tool has made it much easier to work with thumbnails not always at the right scale factor.

https://download.tuxfamily.org/qet/forum_img_2/QET_ElementScaler.png

Very easy to use:
example

laurent@debian:~/.qet$ ./QET_ElementScaler elements/nx300320190520.elmt 10
laurent@debian:~/.qet$ ./QET_ElementScaler elements/nx300320190520.elmt 0.5
laurent@debian:~/.qet$ ./QET_ElementScaler elements/nx300320190520.elmt 5


laurent@debian:~/.qet/elements$ ls -al | grep nx
-rw-r--r-- 1 laurent laurent   691553  1 juin   2021 nx300320190520.elmt
-rw-r--r-- 1 laurent laurent   673021  9 mai   21:21 nx300320190520.SCALED.elmt

Just reload collection by right click, drag and drop new scaled.elmt.

Great tool, thanks plc-user.

BTW, I added description and link to plc-user Github for download this nice tool on QET download main page.

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

scorpio810 wrote:

Great tool, thanks plc-user.

You're welcome, Laurent!

4 (edited by plc-user 2022-08-14 18:08:49)

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

EDITED
Just created a new version of QET_ElementScaler:
With the newly added optional parameter "-o" or "--stdout" it is now possible to write the scaled element-data to stdout instead of writing a renamed file.

The new option "-i" or "--stdin" allows QET_ElementScaler to be used with re-direction and/or pipes on the commandline:
The input-data is read from stdin and the output will be written to stdout.

Examples to write to stdout:
QET_ElementScaler -o InputElement.elmt 1.4 > NewScaledElement.elmt
QET_ElementScaler -o InputElement.elmt 1.4 | OtherSoftwareBinary

Examples to use re-direction and/or pipes:
QET_ElementScaler -i  1.4 < InputElement.elmt > NewScaledElement.elmt
cat  InputElement.elmt | QET_ElementScaler -i 1.4 | OtherSoftwareBinary

Have a look and give it a try:
https://github.com/plc-user/QET_ElementScaler