Topic: Mirror or Flip
I need to reverse an element.
I can rotate it 180 degrees but then it needs to be 'flipped'
Or if I can simply 'Mirror' that might do it.
You are not logged in. Please login or register.
QElectroTech → Elements → Mirror or Flip
I need to reverse an element.
I can rotate it 180 degrees but then it needs to be 'flipped'
Or if I can simply 'Mirror' that might do it.
we have no tools for that.
Is there any pretense of adding this very useful tool to the program even in a paid version?
We know but not easy to add this feature :
I found this: https://gerrysweeney.com/horizontal-and … phicsview/
Bump!
I found this post regarding mirroring of QGraphicsItems: https://stackoverflow.com/questions/106 … left-right
Apparently you can simply apply
item->setTransform(QTransform::fromScale(-1, 1))
I could not try it out myself, as compiling QET on windows is quite a hassle.
Even if it wouldn't be perfect (as I expect letters and numbers to be mirrored as well) it would be very useful.
Hi Jens and thanks for the tip, I'll see with Joshua if we can add it easily.
I just tried quickly yesterday on elementpicturefactory text and it work.
--- sources/factory/elementpicturefactory.cpp
+++ sources/factory/elementpicturefactory.cpp
@@ -517,7 +517,7 @@ void ElementPictureFactory::parseText(const QDomElement &dom, QPainter &painter,
text_document.setDefaultFont(font_);
text_document.setPlainText(dom.attribute("text"));
- painter.setTransform(QTransform(), false);
+ painter.setTransform(QTransform::fromScale(-1, 1));
painter.translate(dom.attribute("x").toDouble(), dom.attribute("y").toDouble());
painter.rotate(dom.attribute("rotation", "0").toDouble());
Even if it wouldn't be perfect (as I expect letters and numbers to be mirrored as well) it would be very useful.
Maybe painter.setTransform(QTransform(), false); for texts.
For compile QET on Windows see these:
https://qelectrotech.org/forum/viewtopic.php?id=1432
https://qelectrotech.org/wiki_new/doc/qt_pour_windows
https://qelectrotech.org/wiki_new/winstatic/winstatic
In my opinion it wasn't very hard to implement a mirror- or flip-function for QET_ElementScaler!
You need a loop to walk through the x- and y-values of a polygon to get the min- and max-values.
In a second step you loop through the x-and y-values again and calculate the new x- and y-values.
These vertical and horizontal flip-functions are implemented in the new version of QET_ElementScaler!
I do not know the internals of how polygons are saved in QET internally, but I guess it should be possible to implement this with manageable effort for someone who knows the internals...
In QET_ElementScaler it is implemented this way:
double dMin = 9.99e99;
double dMax = -9.99e99;
// first FOR-Loop for x-values:
for (loop through x-values) {
dMin = min(actValue, dMin);
dMax = max(actValue, dMax);
}
// second FOR-Loop for x-values:
for (loop through x-values) {
newValue = (dMin + dMax) - actValue)
}
It may not be the most elegant way to flip or mirror elements but it works.
I have tried this flipping / mirroring on several elements and could not find any malfunctions!
But you may try for yourself!
Create a "scaled" QET-Element and copy-paste the flipped polygon to your Element.
you may call it like this:
QET_ElementScaler --FlipPolyHorizontal -f YourElementFile.elmt
or
QET_ElementScaler --FlipPolyVertical -f YourElementFile.elmt
This results in a new element-file where ALL lines and polygons are flipped.
See post here: https://qelectrotech.org/forum/viewtopi … 808#p16808
laurent@debian:/media/backup6/download/QET_ElementScaler$ ./compile.sh
Messages de l'assembleur:
Erreur fatale: ne peut créer obj/inc/pugixml/pugixml.o: Aucun fichier ou dossier de ce type
Messages de l'assembleur:
Erreur fatale: ne peut créer obj/main.o: Aucun fichier ou dossier de ce type
/usr/bin/ld : ne peut pas trouver obj/inc/pugixml/pugixml.o : Aucun fichier ou dossier de ce type
/usr/bin/ld : ne peut pas trouver obj/main.o : Aucun fichier ou dossier de ce type
collect2: error: ld returned 1 exit status
laurent@debian:/media/backup6/download/QET_ElementScaler$ g++ -Wall -O2 std=c++17 -c inc/pugixml/pugixml.cpp -o obj/inc/pugixml/pugixml.o
Messages de l'assembleur:
Erreur fatale: ne peut créer obj/inc/pugixml/pugixml.o: Aucun fichier ou dossier de ce type
Edit:
laurent@debian:/media/backup6/download/QET_ElementScaler$ export LC_ALL=C
laurent@debian:/media/backup6/download/QET_ElementScaler$ ./compile.sh
Assembler messages:
Fatal error: can't create obj/inc/pugixml/pugixml.o: No such file or directory
Assembler messages:
Fatal error: can't create obj/main.o: No such file or directory
/usr/bin/ld: cannot find obj/inc/pugixml/pugixml.o: No such file or directory
/usr/bin/ld: cannot find obj/main.o: No such file or directory
collect2: error: ld returned 1 exit status
laurent@debian:/media/backup6/download/QET_ElementScaler$ g++ -Wall -O2 std=c++17 -c inc/pugixml/pugixml.cpp -o obj/inc/pugixml/pugixml.o
Assembler messages:
Fatal error: can't create obj/inc/pugixml/pugixml.o: No such file or directory
the sub-directories need to exist before compiling...
will add creation of sub-dirs in the shell-scripts later!
EDIT: DONE!
laurent@debian:/media/backup6/download/QET_ElementScaler$ mkdir -p obj/inc/pugixml
laurent@debian:/media/backup6/download/QET_ElementScaler$ g++ -Wall -O2 std=c++17 -c inc/pugixml/pugixml.cpp -o obj/inc/pugixml/pugixml.o
g++: warning: std=c++17: linker input file unused because linking not done
g++: error: std=c++17: linker input file not found: No such file or directory
laurent@debian:/media/backup6/download/QET_ElementScaler$ ./compile.sh
g++: warning: std=c++17: linker input file unused because linking not done
g++: error: std=c++17: linker input file not found: No such file or directory
g++: warning: std=c++17: linker input file unused because linking not done
g++: error: std=c++17: linker input file not found: No such file or directory
Fixed! ;-)
laurent@debian:/media/backup6/download/QET_ElementScaler$ mkdir -p obj/inc/pugixml
laurent@debian:/media/backup6/download/QET_ElementScaler$ ./compile.sh
#!/bin/sh
# compile QET_ElementScaler
g++ -c inc/pugixml/pugixml.cpp -o obj/inc/pugixml/pugixml.o
g++ -c main.cpp -o obj/main.o
g++ -o QET_ElementScaler obj/inc/pugixml/pugixml.o obj/main.o -s
the "-" at the "std=c++17" - option was missing...
just fixed!
Great
laurent@debian:/media/backup6/download$ git clone https://github.com/plc-user/QET_ElementScaler.git
Cloning into 'QET_ElementScaler'...
remote: Enumerating objects: 107, done.
remote: Counting objects: 100% (107/107), done.
remote: Compressing objects: 100% (101/101), done.
remote: Total 107 (delta 53), reused 20 (delta 4), pack-reused 0
Receiving objects: 100% (107/107), 116.45 KiB | 2.48 MiB/s, done.
Resolving deltas: 100% (53/53), done.
laurent@debian:/media/backup6/download$ ^C
laurent@debian:/media/backup6/download$ cd /media/backup6/download/QET_ElementScaler
laurent@debian:/media/backup6/download/QET_ElementScaler$ ./compile.sh
laurent@debian:/media/backup6/download/QET_ElementScaler$
Now the challenge is to make a binary for macOS user, when I have a little time.
just uploaded new source-code:
- positions for terminals are always rounded without decimals
- when removing all terminals, the "link_type" is set to "thumbnail"
sorry, I don't have any access to mac's ...
upload of new binaries for Linux and ReactOS will follow soon.
Compile work on mac's, but mirror flip on this element isn't perfect yet.
sorry, I don't have any access to mac's ...
Like me also , but I use this KVM for QET OSX packaging on my Debian SID setup, after if users want to send me a mac pro workstation (cost of purchase ~ 24 000 to 45 000 €) why not. But I prefer running Debian..
BTW when you have not money or hardware for you try other workarounds or hacks for run and compile for this OSX, like me whit my Threadripper workstation 3960X.
I have a OSX VM with I send 24 threads CPU and 24G off RAM (my setup: 3960X 24 cores 48 Threads +64G RAM
linux debian 6.0.0-vanilla #1 SMP PREEMPT_DYNAMIC Tue Oct 4 15:13:44 CEST 2022 x86_64 GNU/Linux
), just not time to try GPU passtrough hacks with my old RX 550 (hum lexa model not Baffin shit.!!!..) no GPU acceleration is available yet, for faster and better 2D rendering and debug on OSX.
https://www.reddit.com/r/VFIO/comments/ … x_550_gpu/
Compil and build bundle only takes me a few minutes like others OS packaging..
see https://qelectrotech.org/forum/viewtopi … 576#p16576
laurents-iMac-Pro:QET_ElementScaler laurent$ git status
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
QET_ElementScaler
Untitled2.dxf
moteur_hydr_1.SCALED.elmt
moteur_hydr_1.elmt
nouvel_element.SCALED.elmt
nouvel_element.elmt
obj/
nothing added to commit but untracked files present (use "git add" to track)
macOS X86_64 binary
Compile work on mac's, but mirror flip on this element isn't perfect yet.
The lines and polygons are flipped one-by-one!
That's why I say
useful during creation of elements
in the help of QET_ElementScaler and the README on github.
If we can limit ourselves (at least for now) to applying flipping and mirroring to individual polygons, I can definitely imagine this variant in QET as well!
In the context menu (right-click) there is also the possibility to add or remove points only for polygons.
Maybe this is a way to quickly integrate "flipping"? It seems to be needed every now and then, otherwise this thread would not exist...
Just uploaded new binaries for Linux, ReactOS (win32) and macOS to github-repository:
https://github.com/plc-user/QET_Element … g/0.4beta2
maybe someone with a mac can test the new binary for mac and tell me, if it works?
as said before: I don't have any access to mac's ...
Thanks in advance!
Not a binary...
Thank you for trying, Laurent!
I didn't think of comparing "my" file with the one you uploaded here on Sunday and have done so now. You can see the compare-result from DoubleCommander in the attached screenshot: Our binaries are amazingly identical! Amazing, because we definitely compiled on different machines and at different times. Compared a second time with "cmp" on my Debian-Box and it also says that the files are identical.
The message in your case I could imagine that the file looks like it has a file extension because of the added part after the underscore and therefore mac doesn't recognize it as an executable file? Maybe the file will be recognized when you rename it?
Does mac have an "executable-bit" for files? (chmod 744 ....)?
You forgot to make it executable and rename it without point.
Rename it to QET_ElementScaler_x86_64-apple-darwin21-6-0-0
But it 's strange I don't use if I'm remember chmod to make it executable... saw my previous capture.
After chmod +x is work
OK, will use a filename without points next time!
Edit: When compiling something the result is automatically set to be executable.
But do I have any control over the file permissions when I upload something to github? Or is it the user who sets the permissions him/herself after downloading the binary? As far as I know it's the second, isn't it?
Same here: when I upload like AppImage file I revert executable flag on files before upload on server.
chmod -x your file.
https://qelectrotech.org/wiki_new/doc/p … n#appimage
QElectroTech → Elements → Mirror or Flip
Powered by PunBB, supported by Informer Technologies, Inc.
Generated in 0.034 seconds (43% PHP - 57% DB) with 12 queries