Basic Pattern Maker [ Windows & Linux ]

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.

ELLE_Sonny
Newbie Member
Posts: 3
Joined: Tue Nov 04, 2025 1:41 pm

Re: Basic Pattern Maker [ Windows & Linux ]

Post by ELLE_Sonny » Thu Nov 06, 2025 8:43 am

Hello
Thank you for your feedback.
So, for my first exports, I didn't modify the basic files at all. I used the (bmplc) files from the folder I opened and saved them directly as .PAT files.
When I saw that I had this error, I tried to create one myself. And then I got a vertical line, but strangely not the ones at the edges.
When I preview before exporting, I get a correct display of what I want, and what a chevron pattern looks like.

I'm going to do some more testing today.
Thanks again :)
Attachments
Capture d'écran 2025-11-06 083825.jpg
Capture d'écran 2025-11-06 083825.jpg (855.37 KiB) Viewed 279 times
chevrontest.pat
(1.05 KiB) Downloaded 7 times
chevron03.pat
(1.31 KiB) Downloaded 6 times
chevron02.pat
(1008 Bytes) Downloaded 10 times
chevron01.pat
(1008 Bytes) Downloaded 9 times

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

Re: Basic Pattern Maker [ Windows & Linux ]

Post by CVH » Thu Nov 06, 2025 11:20 am

Looking at chevron01.pat - chevron03.pat there is something wrong with how these patterns are coded

e.g. chevron02.pat:

Code: Select all

90,2,0,0,4,0,0
90,0,0,0,4,0,0
Both patterned lines are oriented vertical upwards.
The first its pattern starts at (2.0, 0.0), for the second that is (0.0, 0.0).
The patterned lines start positions are repeated every {±0.0 units along the line, ±4.0 units perpendicular to the line}.
So far, so good.

About the pattern of each line, the sixth value and those that follow:
Literally: A dot followed by yet another dot at zero distance apart and that repeated endlessly every zero units along the line.
Essentially this would mean an endless amount of dots on the same position what is a major flaw.

Using QCAD under Windows these are represented by vertical endless lines every 2 units in X.
:arrow: The crosshairs we see in the screenshot do not appear to be QCAD native. :wink:

The complete pattern length to repeat is the sum of the absolute of values #6 - #17 for a maximum of 12 dashes.
These pattern definitions are probably converted by QCAD to XLines because the complete pattern length is zero.
No defined pattern reverts to a not patterned line.


A vertical line every 2 units in X should be coded without dashes as:

Code: Select all

90,0,0,0,2
Or as 2 entries but that doubles the work load:

Code: Select all

90,0,0,0,4
90,2,0,0,4
A dot is a zero for no length, a dash is a positive value and a space is a negative value.
For repeating dots along the patterned line a zero dash must be followed by the space between them.
e.g. A horizontal line every 2 units in Y with 4 dots per unit along the line:

Code: Select all

0,0,0,0,2,0,-0.25
e.g. A horizontal line every 4 units in Y with a dot every 4 units along the line:

Code: Select all

0,0,0,0,4,0,-4

For 'chervron my try', probably chevrontest.pat, it seems to render 1 line alternating every 4 intended.

Code: Select all

90,2,0,0,4,0,0
90,0,0,0,4,0,0
270,0,4,0,4,0,0 ; ==2
0,0,0,0,4,0,-4  ; Horizontal dotted lines
270,4,4,0,4,0,0 ; ==3
0,4,0,0,4,0,-4  ; Horizontal dotted lines ==4
Or 2 stacked out of 4, my guess is on those that are defined as downwards.
Probably where QCAD renders 3 stacked lines of all 4 XLines, 2 down and 2 upwards. :wink:
The dots are also 2 stacked dots each.
Such a pattern definition together with the 10 slanted definitions may slow down the rendering.

For this pattern I can't replicate the missing link in the top left corner. :shock:


Why not simple e_geek while it can be (over-)complicated ... :!:
This pattern can be broadly simplified to 3 definition lines and there is room to spare for a higher accuracy:

Code: Select all

90,0,0,0,2
45,0,0,.7071067811865475,.7071067811865475,2.828427,-2.82842724949238
315,2,2,-.7071067811865475,.7071067811865475,2.828427,-2.82842724949238
Just add the repeated (singular) dots where you want them to occur, ideally on a horizontal definition as described above.

BTW: It doesn't serve anything to create the same pattern in a different scale ... A hatch can be created at any uniform scale.
Not all hatch patterns with slanted lines can easily be scaled non-uniform.
For this reason BPM is limited to certain strict ratios by developer choice.

Regards,
CVH

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

Re: Basic Pattern Maker [ Windows & Linux ]

Post by petevick » Thu Nov 06, 2025 5:55 pm

ELLE_Sonny wrote:
Thu Nov 06, 2025 8:43 am
Hello
Thank you for your feedback.
So, for my first exports, I didn't modify the basic files at all. I used the (bmplc) files from the folder I opened and saved them directly as .PAT files.
When I saw that I had this error, I tried to create one myself. And then I got a vertical line, but strangely not the ones at the edges.
When I preview before exporting, I get a correct display of what I want, and what a chevron pattern looks like.

I'm going to do some more testing today.
Thanks again :)
I've tried your .pat files in Qcad running in Linux, they all display correctly, including the preview. I'm wondering if it's a software/hardware graphical glitch.
Pete Vickerstaff
Linux Mint 21.3 Cinnamon, Qcad Pro 3.31.1

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

Re: Basic Pattern Maker [ Windows & Linux ]

Post by CVH » Thu Nov 06, 2025 6:03 pm

petevick wrote:
Thu Nov 06, 2025 5:55 pm
I've tried your .pat files in Qcad running in Linux
Yes they do Pete, under Windows too ... In the above I assume they are not used under QCAD.

Then QCAD is hardened for the double dot in the line pattern.
The sum of all the dashes is zero long and it renders no pattern, aka an endless line. :wink:

Regards,
CVH

ELLE_Sonny
Newbie Member
Posts: 3
Joined: Tue Nov 04, 2025 1:41 pm

Re: Basic Pattern Maker [ Windows & Linux ]

Post by ELLE_Sonny » Fri Nov 07, 2025 9:38 am

Thank you for all this information. I did indeed think that it could be transferred to any CAD software. Sorry if I misunderstood. Thank you again for your help.

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

Re: Basic Pattern Maker [ Windows & Linux ]

Post by CVH » Fri Nov 07, 2025 12:01 pm

ELLE_Sonny wrote:
Fri Nov 07, 2025 9:38 am
I did indeed think that it could be transferred to any CAD software. Sorry if I misunderstood.
It can ... It should ... I am not aware if this is specified. :wink:
All because the content of a *.pat file is based on the universal DXF standard.

Then:

Code: Select all

90,2,0,0,4,0,0
Is not entirely correct according the standard.

Code: Select all

Orientation of patterned lines = 90 degrees
Start of pattern on the line = (2.0, 0.0)
Offset to start for all next copies = +/-(0.0, 4.0)
Pattern: dash1 (zero=dot), dash2 (zero=dot), ... dash12
The pattern part itself is identical to a line type definition in a *.lin file excluding the prefix A = A-type alignment.
For hatch patterns, the internal alignment is fixed and not corrected automatically as with normal line-art.

Analog to no pattern definition at all for continuous lines, the pattern for an endless line should be <None>, <Empty> or left open.

Code: Select all

90,2,0,0,4
Digging deeper:
  • 'For a pattern there must be at least two dash specifications.
    The first dash length value is 0 or greater (a dot or pen-down segment).
    The second dash length value should be less than 0 (a pen-up segment)
    .'
This doesn't specifies that 2 is mandatory but in the case of any, the sum of dash lengths in absolute must at least be non-zero.

QCAD is (mostly) hardened against possible dubious situations or actions are taken in the case they occur or are reported.
No pattern = Empty dash list OR Zero total length to repeat, it would take forever to repeat nothing over some finite length.
QCAD even allows the first dash to be a 'pen-up segment' or two successive 'pen-up/down segments' and so on.

Regards,
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”