Line Break Symbol script

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

User avatar
petevick
Premier Member
Posts: 392
Joined: Tue May 19, 2020 9:34 am
Location: North Norfolk coast UK

Line Break Symbol script

Post by petevick » Fri Mar 05, 2021 10:15 am

!! UPDATE, PLEASE CLICK THE LINK !! viewtopic.php?f=30&p=32527#p32527

This is a modified script of the ExLineDove.js script created by Matthias Melcher.

LineBreakSymbol creates a line break from 2 picked points, it can be scaled and rotated depending on where the second point is picked.
BreakSymbolsmall.bmp
BreakSymbolsmall.bmp (39.2 KiB) Viewed 10887 times
To install it, make a new folder called Draw (if you don't have that folder) in the scripts/Misc folder, then extract the LineBreakSymbol folder in the zip file into the new Draw folder. Restart Qcad and you'll find a "Line Break Symbol" menu item under the Misc/Draw menu, and a toolbar button on the Misc Draw toolbar and the Misc Draw section of the Tool Matrix panel. The shortcut is S2, commands are either breaksymbol or brksym.

After picking the first point the 'symbol' will appear, you'll see you can rotate and scale about that point, pick a second point to fix. It creates 3 lines. I'd like to make it one polyline eventually, plus I'd like the removal of the line between the two points to be automatic, I've been using the 'Break out Segment' command to do it thus far.
Attachments
LineBreakSymbol.zip
(10.82 KiB) Downloaded 455 times
Last edited by petevick on Tue Mar 16, 2021 8:08 pm, edited 3 times in total.
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6

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

Re: Line Break Symbol script

Post by CVH » Fri Mar 05, 2021 10:46 am

Nice work Pete. 8)
And that for someone who just recently said that he had no knowledge of it :wink:
:P :P :P
TOP

Regards,
CVH

PS: As Polyline it is already functional here ... 8)
Last edited by CVH on Fri Mar 05, 2021 11:19 am, edited 1 time in total.

User avatar
petevick
Premier Member
Posts: 392
Joined: Tue May 19, 2020 9:34 am
Location: North Norfolk coast UK

Re: Line Break Symbol script

Post by petevick » Fri Mar 05, 2021 11:03 am

CVH wrote:
Fri Mar 05, 2021 10:46 am
Nice work Pete. 8)
And that for someone who just recently said that he had no knowledge of it: wink:
:P :P :P
TOP
Thanks CVH, but to be fair all the work was done in the ExLineDove.js script, I just changed a few things here and there :wink:

Pete
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6

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

Re: Line Break Symbol script

Post by John Hyslop » Fri Mar 05, 2021 11:45 pm

Great Pete
I'll definitely use this especially to jog large radii..
Thanks
John Hyslop
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

Panchdara
Premier Member
Posts: 185
Joined: Wed Nov 25, 2015 4:15 pm

Re: Line Break Symbol script

Post by Panchdara » Sat Mar 06, 2021 1:58 am

Pete, I like that. What would complete it would be to have a 3rd point (specifying height) as well as finally converting the lines to a polyline.

I'm trying to follow your code but I'm unfamiliar with the ECMAScript interface. As an ex-programmer (15yrs back) this is definitely new territory. I admire your ability to have done this.

Best
Windows 10

User avatar
petevick
Premier Member
Posts: 392
Joined: Tue May 19, 2020 9:34 am
Location: North Norfolk coast UK

Re: Line Break Symbol script

Post by petevick » Sat Mar 06, 2021 7:22 am

Panchdara wrote:
Sat Mar 06, 2021 1:58 am
Pete, I like that. What would complete it would be to have a 3rd point (specifying height) as well as finally converting the lines to a polyline.

I'm trying to follow your code but I'm unfamiliar with the ECMAScript interface. As an ex-programmer (15yrs back) this is definitely new territory. I admire your ability to have done this.

Best
I knew someone would ask for a 3rd point :lol: It's a fair request, might be doable.

It's not not my script ! I modified a few lines of the ExLineDove.js script created by Matthias Melcher. I'm still struggling with ECMAScript. My last programming was fairly extensive with AutoLISP and Visual Lisp some 40 years ago !!, all learnt with 3" thick reference books, no google or internet then (geez, that makes me feel old :cry: ) and that's what's frustrating about this scripting lark, I have all the resources in the world, and I'm still struggling to grasp it. :roll:
John Hyslop wrote:
Fri Mar 05, 2021 11:45 pm
Great Pete
I'll definitely use this especially to jog large radii..
Thanks
John Hyslop
Thanks John, glad it's going to be useful to you
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6

User avatar
petevick
Premier Member
Posts: 392
Joined: Tue May 19, 2020 9:34 am
Location: North Norfolk coast UK

Re: Line Break Symbol script

Post by petevick » Thu Mar 11, 2021 6:41 pm

This update would not have been possible without the incredible amount of effort put in by CVH in sorting out the coding.

PolyLineBreakSymbol replaces LineBreakSymbol, it is a significant update consisting of the following;
  • the break symbol is now drawn as a polyline
  • user options added to the Options toolbar
    • option to remove the segment between the symbol
    • option to set the peak height of the symbol
    • option for either Inclined or Vertical first and last segments
Installation
To install the PolyLineBreakSymbol tool first create a new folder called Draw in the scripts>Misc folder (if you don't already have that folder) and then extract the PolyLineBreakSymbol folder in the zip file into the new Draw folder. Restart Qcad and you'll find a Polyline Break Symbol menu item under the Misc>Draw menu, and a toolbar button on the Misc Draw toolbar and the Misc Draw section of the Tool Matrix panel.
tbbutton.png
tbbutton.png (1.14 KiB) Viewed 10749 times
The shortcut is S3, commands are either pbreaksymbol or pbrksym.

User Options toolbar
optionstb.png
optionstb.png (7.06 KiB) Viewed 10749 times
The first option is Remove Segment. If checked, the chosen entity segment between the break symbol will be removed if unchecked, the segment is not removed. The default is checked.
The second option is Peak Height. This indicates the height to the peak of the symbol from the chosen entity. The minimum value is 1 and the maximum value is 9. The default value is 3. This changes the look of the symbol considerably from one extreme to the other.
The last option is Inclined and Vertical. If Inclined is selected the symbol will have inclined first and last segments thus...
incsym.png
incsym.png (1.19 KiB) Viewed 10749 times
If Vertical is selected the symbol will have vertical first and last segments thus...
vertsym.png
vertsym.png (1.09 KiB) Viewed 10749 times
The default is Inclined.

How to use
In the Pro version of Qcad you will be first asked to choose either a line, arc, circle, ellipse, spline or polyline to break up. In the CE version, you are asked to choose either a line, arc, circle or ellipse. You must choose one of those entities to proceed, selecting some other entity will result in an error message being displayed on the command line.
You are then prompted to pick the first break point. The break symbol will then appear. You will note that at this point you can scale the symbol along the path of the chosen entity by moving the crosshairs, also the break symbol has inherited the properties of the chosen entity, layer/line width etc. You will then be prompted to pick a second point. This will fix the final size of the symbol, and, if the Remove Segment option is checked, the segment between the symbol will be removed.

Note that after the first point is picked you can change any of the user options and the symbol will be updated to reflect your changes.

You can now insert another break symbol or click the right mouse button to end.
Attachments
PolyLineBreakSymbol.zip
(8.19 KiB) Downloaded 438 times
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6

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

Re: Line Break Symbol script

Post by Husky » Thu Mar 11, 2021 7:16 pm

petevick wrote:
Thu Mar 11, 2021 6:41 pm

Installation
To install the PolyLineBreakSymbol tool first create a new folder called Draw in the scripts>Misc folder (if you don't already have that folder) and then extract the PolyLineBreakSymbol folder in the zip file into the new Draw folder. Restart Qcad and you'll find a Polyline Break Symbol menu item under the Misc>Draw menu, and a toolbar button on the Misc Draw toolbar and the Misc Draw section of the Tool Matrix panel.
Will that overwrite the already existing entry in 3.26.0.1?
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
petevick
Premier Member
Posts: 392
Joined: Tue May 19, 2020 9:34 am
Location: North Norfolk coast UK

Re: Line Break Symbol script

Post by petevick » Thu Mar 11, 2021 7:16 pm

additional word document of the above if you want a formatted hard copy.
Attachments
readme.doc
(29 KiB) Downloaded 421 times
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6

User avatar
petevick
Premier Member
Posts: 392
Joined: Tue May 19, 2020 9:34 am
Location: North Norfolk coast UK

Re: Line Break Symbol script

Post by petevick » Thu Mar 11, 2021 7:20 pm

Husky wrote:
Thu Mar 11, 2021 7:16 pm
Will that overwrite the already existing entry in 3.26.0.1?
No, the new tool is a different name PolylineBreakSymbol and new folder name. Just delete the original LineBreakSymbol folder :wink:

I should have mentioned that really shouldn't I :oops: :oops:
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6

Panchdara
Premier Member
Posts: 185
Joined: Wed Nov 25, 2015 4:15 pm

Re: Line Break Symbol script

Post by Panchdara » Thu Mar 11, 2021 7:27 pm

Poly.png
Poly.png (303.68 KiB) Viewed 10736 times


BRILLIANT!!!! Not what I had thought, but fantastic! A gazzillion thumb ups.

I don't understand the "peak height"..... would be nice to have that 3rd pint that specifies the height - don't get me wrong, this is brilliant. Ltta effort went into this. Oh, and one further request - have a frequency, ie number of cycles. (I know, it's not Christmas yet :P )
Last edited by Panchdara on Thu Mar 11, 2021 8:19 pm, edited 3 times in total.
Windows 10

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

Re: Line Break Symbol script

Post by Husky » Thu Mar 11, 2021 7:28 pm

petevick wrote:
Thu Mar 11, 2021 7:20 pm
Just delete the original LineBreakSymbol folder :wink:
Well .... I'm sure you already realized that that isn't possible. :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
petevick
Premier Member
Posts: 392
Joined: Tue May 19, 2020 9:34 am
Location: North Norfolk coast UK

Re: Line Break Symbol script

Post by petevick » Thu Mar 11, 2021 7:57 pm

Husky wrote:
Thu Mar 11, 2021 7:28 pm
petevick wrote:
Thu Mar 11, 2021 7:20 pm
Just delete the original LineBreakSymbol folder :wink:
Well .... I'm sure you already realized that that isn't possible. :wink:
It is possible if you installed LineBreakSymbol from the zip file, but not if you are using Qcad version 3.26.1 as it is part of the Qcad install. I assume the next Qcad update will have the PolylineBreakSymbol tool as it's already in the repositry. :wink:
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6

User avatar
petevick
Premier Member
Posts: 392
Joined: Tue May 19, 2020 9:34 am
Location: North Norfolk coast UK

Re: Line Break Symbol script

Post by petevick » Thu Mar 11, 2021 8:32 pm

Panchdara wrote:
Thu Mar 11, 2021 7:27 pm
BRILLIANT!!!! Not what I had thought, but fantastic! A gazzillion thumb ups.
I take it you like it then :lol:
I don't understand the "peak height"..... would be nice to have that 3rd pint that specifies the height
It's just a linear unit, a means of keeping control of crazy user input :lol: It has to be a controlled value, anything else would take lots of code to verify all kinds of parameters.
Oh, and one further request - have a frequency, ie number of cycles. (I know, it's not Christmas yet :P )
Jeez, it's only been uploaded a few minutes :P I have no idea what you mean by "number of cycles" so no, you can't have it......unless yo explain yourself :wink:
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6

Panchdara
Premier Member
Posts: 185
Joined: Wed Nov 25, 2015 4:15 pm

Re: Line Break Symbol script

Post by Panchdara » Thu Mar 11, 2021 8:53 pm

Pete, thank you. What I mean by "cycle" is frequency, this lovely feature only has 1Hz, 1 cycle.

This is a 3 cycle Sawtooth.
multicycle.png
multicycle.png (320.13 KiB) Viewed 10727 times
2 cycle Triangular -
Triangular.png
Triangular.png (228.57 KiB) Viewed 10727 times
Nevertheless, it's looking great!
Windows 10

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”