Leader from selected text

This forum is for 'Work-in-Progress' QCAD user developed script Add Ons and Plug-ins.

Please use this forum to request/submit your script Add-Ons & Plug-in idea's.

Moderators: andrew, Husky, J-J

dmitpon
Junior Member
Posts: 21
Joined: Sun Mar 14, 2021 10:15 am

Leader from selected text

Post by dmitpon » Sun Nov 28, 2021 10:37 am

Hi
I wrote a little script. It creates a leader from the selected text. Maybe it will be useful to someone.
animation.gif
animation.gif (118.16 KiB) Viewed 27441 times
LeaderFromText.zip
(3.87 KiB) Downloaded 936 times

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

Re: Leader from selected text

Post by CVH » Sun Nov 28, 2021 11:46 am

Hi,

Nice contribution. Perfect tool for the job.

Kind regards,
CVH

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Leader from selected text

Post by Husky » Sun Nov 28, 2021 11:54 am

Nice idea! I could imagine it as a very helpful tool in QCAD. You're open for propositions? :shock:
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

dmitpon
Junior Member
Posts: 21
Joined: Sun Mar 14, 2021 10:15 am

Re: Leader from selected text

Post by dmitpon » 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.

John Hyslop
Premier Member
Posts: 472
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re: Leader from selected text

Post by John Hyslop » Sun Nov 28, 2021 9:21 pm

Hi dmitpon

Thanks, this will come in very useful. :D

Cheers

John
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

User avatar
ryancousins
Premier Member
Posts: 367
Joined: Thu Mar 19, 2020 3:47 am
Location: Michigan, USA

Re: Leader from selected text

Post by ryancousins » Mon Nov 29, 2021 2:35 am

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.

dmitpon
Junior Member
Posts: 21
Joined: Sun Mar 14, 2021 10:15 am

Re: Leader from selected text

Post by dmitpon » Mon Nov 29, 2021 4:47 am

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.

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

Re: Leader from selected text

Post by CVH » Mon Nov 29, 2021 5:56 am

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
Last edited by CVH on Mon Nov 29, 2021 6:36 am, edited 1 time in total.

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Leader from selected text

Post by Husky » Mon Nov 29, 2021 6:31 am

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. :shock:

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 ... :wink:
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Leader from selected text

Post by Husky » Mon Nov 29, 2021 7:50 am

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
T2L original.gif (275.1 KiB) Viewed 27319 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 ... :oops:

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
T2L proposition.gif (251.43 KiB) Viewed 27319 times

What do you think about this?
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

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

Re: Leader from selected text

Post by CVH » Mon Nov 29, 2021 8:26 am

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
Last edited by CVH on Mon Nov 29, 2021 9:37 am, edited 1 time in total.

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: Leader from selected text

Post by andrew » Mon Nov 29, 2021 8:28 am

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

dmitpon
Junior Member
Posts: 21
Joined: Sun Mar 14, 2021 10:15 am

Re: Leader from selected text

Post by dmitpon » Mon Nov 29, 2021 9:00 am

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.

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: Leader from selected text

Post by andrew » Mon Nov 29, 2021 9:12 am

Excellent, thanks!

dmitpon
Junior Member
Posts: 21
Joined: Sun Mar 14, 2021 10:15 am

Re: Leader from selected text

Post by dmitpon » Mon Nov 29, 2021 9:21 am

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

Post Reply

Return to “QCAD 'Script Add-On & Plug-in challenge' - Work in Progress”