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

Re: Line Break Symbol script

Post by petevick » Thu Mar 11, 2021 9:00 pm

That looks like a new tool is required.....possibly :roll:
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 » Fri Mar 12, 2021 8:17 am

petevick wrote:
Thu Mar 11, 2021 9:00 pm
That looks like a new tool is required.....possibly :roll:
I guess I'm probably making more of a wishlist on this. I made those multiple cycles just by copying. I was thinking the amplitude of the zig-zag could be a 3rd point, rather than from a typed number (and that point could snap?) also the angles be equal (congruent as shown on left) and the center is the break (height 3) and the built-in is far right.

I think you and CVH have done a superlative job nevertheless. A gazzion +1 thumbups. And several more for Andrew too! :D
Attachments
Angles.png
Angles.png (807 KiB) Viewed 6391 times
Windows 10

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

Re: Line Break Symbol script

Post by CVH » Fri Mar 12, 2021 9:01 am

@Panchdara,

Pete worked it out as a SEED:

Code: Select all

     // Define SEED:
    var points = new Array(
        new RVector( 0, 0),
        new RVector( segvi, this.breakHeight),
        new RVector( 3-segvi, this.breakHeight * -1),
        new RVector( 3, 0)
    );
3 units long and later scaled to the distance between Point1 and point2.

If you are willing to do the math to replace the SEED ...
... then let it know. :P

Another pick point for height is also possible ... point3 8)
That would result in a scaled value what is related to unscaled this.breakHeight
1-2-3 hertz too, 3-6-9 units long.
segvi is 0 or 1 depending starting orthogonal or slanted.

With those you have all the input variables you need to construct the math.
Pete already has the code to include longer seeds.

Any different this.breakHeight would alter the angles ... e_geek
Fixed angles need another approach with trig math.
Fixed angles define this.breakHeight.

Here my input ends.
Discuss it further with Pete ... :wink:
CVH

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 12, 2021 9:09 am

Panchdara wrote:
Fri Mar 12, 2021 8:17 am
petevick wrote:
Thu Mar 11, 2021 9:00 pm
That looks like a new tool is required.....possibly :roll:
I guess I'm probably making more of a wishlist on this. I made those multiple cycles just by copying. I was thinking the amplitude of the zig-zag could be a 3rd point, rather than from a typed number (and that point could snap?) also the angles be equal (congruent as shown on left) and the center is the break (height 3) and the built-in is far right.

I think you and CVH have done a superlative job nevertheless. A gazzion +1 thumbups. And several more for Andrew too! :D
That is definitely another tool. I'll send you a pm Panchdara rather than clutter up here with off topic chatter :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 » Tue Mar 16, 2021 8:06 pm

This update consists of the following;
  • option to inherit the properties of the chosen entity added
  • Peak Height renamed to Peak Ratio
  • Peak Ratio is now selected via a drop down list and displays the ratio of peak height to break symbol width
  • the Inclined and Vertical radio buttons are now toolbar buttons.
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 6347 times
The shortcut is S3, commands are either pbreaksymbol or pbrksym.

User Options toolbar
optionstb.png
optionstb.png (6.98 KiB) Viewed 6347 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 Inherit. If checked the break symbol inherits all the properties (layer, line colour etc) of the chosen entity. The default is checked.
The third option is Peak Ratio. This is the ratio of the peak height to the break symbol width. The minimum ratio is 1:3 and the maximum ratio is 3:1. This changes the look of the symbol considerably from one extreme to the other. The default ratio is 1:1.
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 6347 times
If Vertical is selected the symbol will have vertical first and last segments thus...
vertsym.png
vertsym.png (1.09 KiB) Viewed 6347 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. 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.

I've also attached a MS Word document of the above should you want a hard copy.
readme.doc
(61.5 KiB) Downloaded 373 times
Attachments
PolyLineBreakSymbol v1.zip
(13.71 KiB) Downloaded 389 times
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”