“Move / Copy” dialog improvement

Please use this forum to post feedback and suggestions related to QCAD.

Moderator: andrew

CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Re: “Move / Copy” dialog improvement

Post by CVH » Sat Jul 17, 2021 11:19 am

zroo3d wrote:
Sat Jul 17, 2021 10:38 am
True. What I meant is add it here:
It is a question of OR by dialog widget OR by Options Bar widget.
Rather counter active to include that choise on any of the two ... :wink:
That is why it is included under Application Preferences.
zroo3d wrote:
Sat Jul 17, 2021 10:38 am
I don`t know what do you mean.
Customized the Move/Copy script.
CVH wrote:
Sat May 15, 2021 3:10 am
I said: '.. have/had ..'
Knowing a little about scripting ... I made 'Move' persistent and I use MV without dialog.
Now MV is always 'Move' unless I choose to 'Copy' or 'Copy multiple'.
When interested then PM me ... :wink:

Regards,
CVH

foresterr
Newbie Member
Posts: 4
Joined: Mon Jan 23, 2023 7:11 pm

Re: “Move / Copy” dialog improvement

Post by foresterr » Mon Jan 23, 2023 7:41 pm

Bit of a necro here, but I did not find anything newer on the subject. I also was a tad miffed when forgetting whether Move/Copy had copy selected or not when using it last, especially as I don't use the dialog, so it's pretty easy to miss. In addition, another annoyance was having to click in the input box for number of copies.

I created 3 custom scripts that add 3 new commands (in the Modify menu, toolbox and available from the command line): Move (commands "mv0", "m0"), Copy 1 (commands "mv1", "m1"), and Copy N (commands "mvn", "mn"). The scripts just run the Move/Copy command and preset the options in the way you'd expect; Copy N in addition asks for number of copies to be inputted on the command line (if you input 0, it disables copy mode); should probably also react to inputting new value in the usual place, but I haven't figured this out yet (EDIT: now it works as it should). Standard Move/Copy is left alone, as it has to be, because those scripts piggyback off it as much as I could make them. Key sequences are not implemented because they would be totally redundant - see CVH's reply to this post.

If anyone finds the idea useful, the scripts can be found at https://github.com/foresterr/qcad_custom_scripts (sorry if posting links is frowned upon, especially from a new account... I promise I'm not a spam bot :) ). If you are not familiar with adding custom QCAD scripts, basic instructions are in the readme file.
Last edited by foresterr on Mon Jan 23, 2023 11:23 pm, edited 1 time in total.

CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Re: “Move / Copy” dialog improvement

Post by CVH » Mon Jan 23, 2023 9:22 pm

foresterr wrote:
Mon Jan 23, 2023 7:41 pm
I also was a tad miffed when forgetting whether Move/Copy had copy selected or not when using it last, especially as I don't use the dialog, so it's pretty easy to miss.
It should not be so certain that you miss it.
Most tools under QCAD will list their options in the Option Toolbar, some use a dialog and some a dialog or the toolbar.
So you should always keep an eye on that rather important toolbar. :wink:
foresterr wrote:
Mon Jan 23, 2023 7:41 pm
another annoyance was having to click in the input box for number of copies.
See: https://www.ribbonsoft.com/archives/sho ... uts_en.pdf
Ctrl+Space sets the focus on the Option Toolbar, the first value field will get the focus.
Even better, after MV you can start typing the amount of copies right away. :wink:
To start typing in the Command Line we need to click there or hit Space too, right?
foresterr wrote:
Mon Jan 23, 2023 7:41 pm
should probably also react to inputting new value in the usual place, but I haven't figured this out yet.
TranslateWithCopy is based on Translate and that is based on Transform.
At the end of Transform.js we find functions that react on slot changes.
See: https://github.com/qcad/qcad/blob/maste ... ansform.js
Not sure if you want to override those ...

BTW: Key sequence "mc" conflicts with Order Connected :!:

Useful? Maybe. Finished? No, and please also provide details on how to implement them.
... 7 minutes ago you added dark mode icons ...

Regards,
CVH

foresterr
Newbie Member
Posts: 4
Joined: Mon Jan 23, 2023 7:11 pm

Re: “Move / Copy” dialog improvement

Post by foresterr » Mon Jan 23, 2023 10:29 pm

Thanks for taking a look, I appreciate it!
CVH wrote:
Mon Jan 23, 2023 9:22 pm
It should not be so certain that you miss it.
I meant it in the sense that the checkbox and number of copies input box are maybe 10 by 20 pixels together and I forget to always peek at that corner of the screen... I never said I'm miffed at QCAD and not myself :P
CVH wrote:
Mon Jan 23, 2023 9:22 pm
Even better, after MV you can start typing the amount of copies right away. :wink:
Neat, if I knew that I might not have bothered (at least I learned something :wink: ) - in that case just typing m,v,0 is equivalent to Move, and m,v,1 is equivalent to Copy. Looks like it's universal behavior for any command that has input fields in the toolbar. Is that feature documented anywhere?
CVH wrote:
Mon Jan 23, 2023 9:22 pm
To start typing in the Command Line we need to click there or hit Space too, right?
Certainly, but there is an inverse problem - after you type "mv" or "move" in the command line, you need to press Ctrl+Space to change the number of copies, then somehow go back to command line (Esc, then Space seems the fastest way).
CVH wrote:
Mon Jan 23, 2023 9:22 pm
TranslateWithCopy is based on Translate and that is based on Transform.
At the end of Transform.js we find functions that react on slot changes.
See: https://github.com/qcad/qcad/blob/maste ... ansform.js
Not sure if you want to override those ...
Thanks for the hint, I figured this out - I did override the function you pointed out, and all I do there is to change the state and call the original function from Transform.
CVH wrote:
Mon Jan 23, 2023 9:22 pm
BTW: Key sequence "mc" conflicts with Order Connected :!:
D'oh. Fixed. I changed the key sequence to "m,n" which seems to be free (EDIT: I actually removed key sequences altogether after realizing how redundant they are). I also added a version to make exactly one copy, with command "mv1" - I think it's nice that it has the same result as key sequences "m,v,1" (and likewise for "m,v,0"). I'm not sure if there's anything else left to do.
CVH wrote:
Mon Jan 23, 2023 9:22 pm
Useful? Maybe.
In light of what you mentioned in your reply, maybe only for people who really hate to leave the command line, or absolutely must have those options directly in the menu/toolbox :D
CVH wrote:
Mon Jan 23, 2023 9:22 pm
please also provide details on how to implement them.
Not sure what you mean by "implement" - how to add the scripts to your installation? That should be in the readme already, I also updated it to mention that QCAD should be restarted to notice the new scripts.
CVH wrote:
Mon Jan 23, 2023 9:22 pm
... 7 minutes ago you added dark mode icons ...
In my defense, I haven't even known it was possible when I first thought to be finished :oops:

EDIT: I updated my first post to reflect the current state. Once again thanks for taking a look and sharing your knowledge.

CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Re: “Move / Copy” dialog improvement

Post by CVH » Tue Jan 24, 2023 9:56 am

foresterr wrote:
Mon Jan 23, 2023 10:29 pm
Looks like it's universal behavior for any command that has input fields in the toolbar. Is that feature documented anywhere?
Indeed and yes, as a reply of Andrew somewhere on the forum.
foresterr wrote:
Mon Jan 23, 2023 10:29 pm
Certainly, but there is an inverse problem - after you type "mv" or "move" in the command line, you need to press Ctrl+Space to change the number of copies, then somehow go back to command line (Esc, then Space seems the fastest way).
Odd, why not just type MV or activate it from the Modify menu, toolbar or toolpanel or from the matrix ...
... I see no reason to enter 'mv' in the Command Line.
Shortcut key sequences are typed without a specific focus.
And afterwards there is no reason to 'always' go back to the Command Line.
But yes, terminating a tool and setting the focus on the Command Line is possible with Esc and then Space.
foresterr wrote:
Mon Jan 23, 2023 10:29 pm
EDIT: I actually removed key sequences altogether after realizing how redundant they are
Here we differ in opinion, I hardly use the Command Line ... Except for entering coordinates.
I don't see me entering 'lineorthogonaltangent' in the Command Line, I prefer a simple click on the icon or just typing LN.
Entering 'ln' in the Command Line will start 'Line from 2 Points' :lol:
Ok I know, it is one of the few exceptions where the Shortcut key sequence is not a command. :wink:
foresterr wrote:
Mon Jan 23, 2023 10:29 pm
I'm not sure if there's anything else left to do.
mv2, mv3, ... :lol: Sorry, just joking.
foresterr wrote:
Mon Jan 23, 2023 10:29 pm
Not sure what you mean by "implement"
Well, just to keep the standardized folder layout:
TranslateNoCopy >> .../scripts/Modify/Translate/TranslateNoCopy/*.*
TranslateOneCopy >> .../scripts/Modify/Translate/TranslateOneCopy/*.*
TranslateWithCopy >> .../scripts/Modify/Translate/TranslateWithCopy/*.*
Where ... is the installation path or the user custom path.
Then you could also detach the initialization scripts: TranslateNoCopyInit.js and so on.


In the end I got used to my solution:
No dialog by preference.
TranslateNoCopy = MV because I made the Copy flag persistent off.
TranslateOneCopy = DP MV
Translate with multiple copies = MV set the Copy flag and adjust copies. Rarely used.
On top: MV and then ENTER will display the dialog by tweaking the QCAD.ini/config:

Code: Select all

[Transform]
EnterShowsDialog=true
See: Default implementation enterEvent for EAction

All aside RT or RC + PS ... and many other routes :wink:

Regards,
CVH

foresterr
Newbie Member
Posts: 4
Joined: Mon Jan 23, 2023 7:11 pm

Re: “Move / Copy” dialog improvement

Post by foresterr » Tue Jan 24, 2023 12:10 pm

CVH wrote:
Tue Jan 24, 2023 9:56 am
Odd, why not just type MV or activate it from the Modify menu, toolbar or toolpanel or from the matrix ...
I just like to know I'm in command entry mode... sometimes. Maybe it's a habit from other tools (VSCode comes to mind) which don't have a concept of global key sequences, and you need to bring up command palette before entering any commands?
CVH wrote:
Tue Jan 24, 2023 9:56 am
Here we differ in opinion, I hardly use the Command Line ... Except for entering coordinates.
Don't get me wrong, key sequences are awesome. I just meant I see no point to add any to my scripts, seeing how existing key sequences "m,v,0", "m,v,1", "m,v,..." already do the exact same thing (OK, the number technically isn't a part of the key sequence, but that hardly matters from UX perspective)
CVH wrote:
Tue Jan 24, 2023 9:56 am
mv2, mv3, ... :lol: Sorry, just joking.
Laugh all you want :wink: but I actually started thinking if it's possible to implement a catch-all command in a custom script (there is a nice implementation of something similar in Line2P where for example "u", "un", "und" an "undo" all match the same command). But I don't see a way to do it when calling the custom command, not when already inside of it.
CVH wrote:
Tue Jan 24, 2023 9:56 am
Well, just to keep the standardized folder layout
Hmm, I'll consider this - at the moment I kind of like keeping all my custom scripts (there aren't too many yet) at the top level in a separate subfolder.

On this subject, is there a setting somewhere to tell QCAD where to look for scripts, other than under "scripts" in installation directory? Generally, I always like to keep my customizations out of the install dir, and point to them in config, or if there is no option for that, symlink to them. For QCAD I'm using symlinks at the moment, but maybe there is no need.

CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Re: “Move / Copy” dialog improvement

Post by CVH » Tue Jan 24, 2023 12:24 pm

foresterr wrote:
Tue Jan 24, 2023 12:10 pm
On this subject, is there a setting somewhere to tell QCAD where to look for scripts, other than under "scripts" in installation directory? Generally, I always like to keep my customizations out of the install dir, and point to them in config, or if there is no option for that, symlink to them. For QCAD I'm using symlinks at the moment, but maybe there is no need.
See: https://www.ribbonsoft.com/en/documentation/changelog
3.26.2 (2021/04/15)
  • Add local data location to search path for resources files (patterns, linetypes, fonts, postprocessors, etc.)
    Windows: C:/Users/[Username]/AppData/Local/QCAD/QCAD
    macOS: ~/Library/Application Support/QCAD/QCAD
    Linux: ~/.local/share/QCAD/QCAD
Scripts too and these will even supersede standard scripts or compiled ones ... If the structure and the naming match.

Regards,
CVH

Post Reply

Return to “QCAD Suggestions and Feedback”