Page 1 of 2
Leader from selected text
Posted: Sun Nov 28, 2021 10:37 am
by dmitpon
Hi
I wrote a little script. It creates a leader from the selected text. Maybe it will be useful to someone.

- animation.gif (118.16 KiB) Viewed 70330 times
Re: Leader from selected text
Posted: Sun Nov 28, 2021 11:46 am
by CVH
Hi,
Nice contribution. Perfect tool for the job.
Kind regards,
CVH
Re: Leader from selected text
Posted: Sun Nov 28, 2021 11:54 am
by Husky
Nice idea! I could imagine it as a very helpful tool in QCAD. You're open for propositions?

Re: Leader from selected text
Posted: Sun Nov 28, 2021 12:04 pm
by dmitpon
Yes, Husky, I'm open for propositions. But my English is so far from perfect. Make allowances for this.
Re: Leader from selected text
Posted: Sun Nov 28, 2021 9:21 pm
by John Hyslop
Hi dmitpon
Thanks, this will come in very useful.
Cheers
John
Re: Leader from selected text
Posted: Mon Nov 29, 2021 2:35 am
by ryancousins
dmitpon,
Thank you for your contribution. This is very cool. I tried putting the LeaderFromText folder in scripts/misc/examples/DrawExamples but QCAD isn't seeing it. I will have to keep playing around with that.
Re: Leader from selected text
Posted: Mon Nov 29, 2021 4:47 am
by dmitpon
Hi ryancousins,
In my windows 10, the script is located in
"C:\Users\dmitpon\AppData\Local\QCAD\QCAD\scripts\Misc\LeaderFromText"
Since release 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
and addend /scripts/Misc/LeaderFromText or /scripts/misc/LeaderFromText
Unfortunately, I can’t tell you exactly because I don’t use macOS. I can test in Linux Ubuntu within a week.
Re: Leader from selected text
Posted: Mon Nov 29, 2021 5:56 am
by CVH
All,
With the
basePath handled it doesn't really matter in what subfolder of
scripts that you store it.
That may even be a
scripts folder under your local data location path.
See 3.26.2 (2021/04/15):
https://www.ribbonsoft.com/en/documentation/changelog
Although, QCAD uses a fairly logical Script - Folder relationship to keep an overview.
The folder with the script file and related is always named the same way as the script.
Where it pops up in the QCAD GUI is handled by:
Code: Select all
action.setWidgetNames(["DimensionMenu", "DimensionToolBar", "DimensionToolsPanel", "DimensionMatrixPanel"]);
The used path itself has no influence on that.
The group order and order in a menu/toolbar/... is governed by two other settings.
Here
160000/102 or after other 160000's up to 101 would simply mean 'way down' ... 'as last'.
There
100000 is about the highest group order that I have encountered so far. (
ExMinimal.js/ExMinimal2.js)
So far that I know of, the Misc folder is with capital 'M'.
Regards,
CVH
Re: Leader from selected text
Posted: Mon Nov 29, 2021 6:31 am
by Husky
ryancousins wrote: ↑Mon Nov 29, 2021 2:35 am
I tried putting the LeaderFromText folder in
scripts/misc/examples/DrawExamples but QCAD isn't seeing it. I will have to keep playing around with that.
I assume you're looking for the tool in the wrong place.
BTW: Your path should work but less deep in the path hierarchy like ...\qcad-xxx\scripts\Misc works too.
After installing the script check your Dimension tool collection for the new tool ...

Re: Leader from selected text
Posted: Mon Nov 29, 2021 7:50 am
by Husky
dmitpon wrote: ↑Sun Nov 28, 2021 12:04 pm
Yes, Husky, I'm open for propositions. But my English is so far from perfect. Make allowances for this.
Great! No worry about your english skills - that will work just fine. If not you can ask me any time via PM.
Right now the script uses the following user input.
Select text,
launch T2L script,
select the created leader,
manipulate the arrow position.

- T2L original.gif (275.1 KiB) Viewed 70208 times
I thought if you could change the order for each step it would be more efficient for the workflow. I'm not a coder - no idea what is possible and what not but I assume most of what is needed is already in your script ...
Based on the already in QCAD existing leader I would appreciate this workflow:
Launch the T2L tool,
place the Arrow tip to the right position, leader line of the arrow is a Line from 2 point (rubber line),
select the text,
based on this information the tool will built the leader.
Something like this:

- T2L proposition.gif (251.43 KiB) Viewed 70208 times
What do you think about this?
Re: Leader from selected text
Posted: Mon Nov 29, 2021 8:26 am
by CVH
Husky wrote: ↑Mon Nov 29, 2021 7:50 am
I thought if you could change the order for each step
Sounds feasible, with states.
The script setup would look more like the original Leader script:
https://github.com/qcad/qcad/blob/maste ... /Leader.js
Choosing text entities in the second state.
Regards,
CVH
Re: Leader from selected text
Posted: Mon Nov 29, 2021 8:28 am
by andrew
dmitpon: thank you for sharing this script. Can this be included in future QCAD packages under the GPLv3 license with exceptions as outlined at:
https://github.com/qcad/qcad/blob/master/LICENSE.txt
Re: Leader from selected text
Posted: Mon Nov 29, 2021 9:00 am
by dmitpon
Hello, Andrew! I agree to include this script in the next QCAD release under the GPLv3 license with exceptions. My real name is Dmitry Ponomarev.
Re: Leader from selected text
Posted: Mon Nov 29, 2021 9:12 am
by andrew
Excellent, thanks!
Re: Leader from selected text
Posted: Mon Nov 29, 2021 9:21 am
by dmitpon
Hello, Husky
You're right. This tool needs to improve usability. It should reduce the number of clicks and mouse movements I will think about how to implement this in the next version
I'll think about your propositions.
It looks like it's time for me to create an account on GitHub