Page 1 of 1

Text-aligned leader

Posted: Wed Dec 08, 2021 7:49 pm
by dmitpon
Hi

I've a new script written. Text-aligned leader. I'll be glad if it is useful to someone.
text-aligned-leader.gif
text-aligned-leader.gif (90.29 KiB) Viewed 71921 times
TextAlignedLeader.zip
(4.69 KiB) Downloaded 1635 times



Thanks to CVH for his helpful advice.

Re: Text-aligned leader

Posted: Wed Dec 08, 2021 9:22 pm
by Husky
dmitpon wrote:
Wed Dec 08, 2021 7:49 pm
I'll be glad if it is useful to someone.
If it works I'm sure it'll be very useful for many user - so far I can't get it to work in QCAD 3.27.0.0.

Tested:
1. Select Text -> T2L -> behaves like previous version - nothing has changed. :(
2. T2L -> Warning: "Select one text Object", Ok, select Text - nothing happens. :(
3. Searched for tool in Dim Bar - nope, doesn't exist anymore like the previous version ...

May I ask you how 1 can make it work like your video gif?

Re: Text-aligned leader

Posted: Thu Dec 09, 2021 4:21 am
by dmitpon
Hi,
Husky

This is not a new version LeaderFromText (T2L), it is a different tool Text-aligned leader (2T).

Try this: type "2T" -> Click on first vertex position -> Click on text

or this: in command promt type "tal" -> Click on first vertex position -> Click on text

Code: Select all

action.setDefaultShortcut(new QKeySequence("2,T"));
action.setDefaultCommands(["TextAlignedLeader", "tal"]);
The tool has been placed in the following menus and toolbars

Code: Select all

action.setWidgetNames(["DimensionMenu", "DimensionToolBar", "DimensionToolsPanel", "DimensionMatrixPanel"]);
PS
I checked the attached files they match with mine in \scripts \Misc\TextAlignedLeader

Re: Text-aligned leader

Posted: Thu Dec 09, 2021 8:34 am
by Husky
Hi dmitpon,
dmitpon wrote:
Thu Dec 09, 2021 4:21 am
This is not a new version LeaderFromText (T2L), it is a different tool Text-aligned leader (2T).
Ok, what I learned now is that there is a tool In Menu called "Leader from Selected Text" (T2L) but that tool is not in the Tool Bar ...
... and a tool In the Tool Bar called "Text-aligned Ieader (2T) which does't exist in the Menu, correct?

And the tool in the Menu requires a prior selection - but isn't selection sensitive - what means if I missed that a warning pops up with the message "Select one text object!" (weird - I'm used to "Select a text object"). It doesn't tells me that I have to do it before I launch the tool what means clicking ok, selecting the text leads to nothing ...

What I personal don't understand is this "Term juggle". It is for me very confusing and I assume I'm not alone.
Example: The original QCAD Leader tool is asking for the "Arrow position". Your tool is asking for the same position but as "First vertex position". I'm sure every user understands "Arrow" regarding to the used tool but not every user knows what "Vertex" means. Why not use the same terms?
Yes - I've a hunch why this and the use of the "third-person" in the warning is in your script ... :wink:

Howsoever - this is only my opinion and there is no need to pay too much attentions to it. I think you are already on the right track. Thanks for working on this!

Re: Text-aligned leader

Posted: Thu Dec 09, 2021 9:14 am
by dmitpon
I understand about the terms. Then I'll fix it

I did not understand the script works on your system or does not work?
Are icons appearing in menus and toolbars?
2021-12-09_13-07-30.png
2021-12-09_13-07-30.png (253.86 KiB) Viewed 71847 times
2021-12-09_13-03-17.png
2021-12-09_13-03-17.png (263.9 KiB) Viewed 71847 times
2021-12-09_13-02-27.png
2021-12-09_13-02-27.png (226.12 KiB) Viewed 71847 times
2021-12-09_13-01-47.png
2021-12-09_13-01-47.png (242.66 KiB) Viewed 71847 times

Re: Text-aligned leader

Posted: Thu Dec 09, 2021 10:54 am
by Husky
This is what I get out of your script:

Husky-2021.12.09-11.png
Husky-2021.12.09-11.png (7.18 KiB) Viewed 71836 times

Husky-2021.12.09-12.png
Husky-2021.12.09-12.png (22.66 KiB) Viewed 71836 times
Husky-2021.12.09-09.png
Husky-2021.12.09-09.png (43.32 KiB) Viewed 71836 times
Husky-2021.12.09-08.png
Husky-2021.12.09-08.png (56.52 KiB) Viewed 71836 times
Ok, I played around with a fresh QCAD installation. The thing is: T2L is already part of the last QCAD release. Located below misc - not existent in any other menu.

If I put your script below misc the result is what you see in my screenshots and I'm sure you are not less confused by the result!

Re: Text-aligned leader

Posted: Thu Dec 09, 2021 10:56 am
by dmitpon
Small script correction
TextAlignedLeader.zip
(4.69 KiB) Downloaded 1677 times
Changelog:
  • Command line message "First vertex position:" changed to "Arrow position:"

Re: Text-aligned leader

Posted: Thu Dec 09, 2021 11:05 am
by dmitpon
OK! The icons have been found. Does the script work like in an animated gif?

Re: Text-aligned leader

Posted: Thu Dec 09, 2021 12:32 pm
by CVH
@ dmitpon
Refer to viewtopic.php?f=107&t=8925&start=15#p35554

Only users that have both the scripts sets installed custom will see both buttons like you intended.
The script sets under 'scripts' supersede those that come with a QCAD release.

It requires a round trip to get everything right.
It gets even weirder when we rename or move a script around in the script structure.
And then I refer to 2D Centroids. :wink: :lol: :lol:

Regards,
CVH

PS: Andrew has just adopted 2T as a replacement for T2L ... under "MiscDrawMenu"

Re: Text-aligned leader

Posted: Thu Dec 09, 2021 2:02 pm
by dmitpon
Thank you CVH for your clarification