User Requested Custom Hatches

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.

Post Reply
lezav
Newbie Member
Posts: 3
Joined: Fri Sep 23, 2022 9:16 am

User Requested Custom Hatches

Post by lezav » Fri Sep 23, 2022 10:25 am

Hi John,
Thanks for this great tool. I have been trying to make a pattern for sloped terrain parts of my garden,
by editing a PAT file in Notepad. The results are not great.
The garden is rectangular and the two sloped terrain parts (one sloped at 45 degrees the other sloped at 25degrees)
are also rectangular. There are no curves involved.

The pattern consists of several vertical lines of different heights. For example a slope of 30degrees would
consist of one full height line followed by two lines that are one half the height and so forth.
Looking something like this. The short lines represent the slope angle. So if V=1 and H=0.5 the length of the short line is 50%.
| | | | |
| | |

Question : could you create a 'terrain' pattern or advise which existing one could be modified for this to work?
For example I would need four hatch patterns for slopes of 80%, 65%, 50% and 25% called slope80, slope45 etc

Thanks
Marc

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

Re: User Requested Custom Hatches

Post by CVH » Fri Sep 23, 2022 6:55 pm

Marc,

Yes, John and myself, we can make a pattern of anything that is in a square or a rectangle shape, a so said 'tile'.
This tile is then repeated orthogonally, up/down & left right.
For custom hatches John mostly uses a script by my hand called Tile2Hatch.

What you hatch with it doesn't matter, that is the boundary of the area to hatch.
The hatching angle and the scale are properties you can set.
But if the different types must match then you need to think about a definition size and use them at a fixed scale factor.
To align hatches one can play with the hatch origin.

There Hatching is rather similar as linetypes, only line-segments can be used.
Curved line art must be approximated by line-segments.

Please send me a drawing with an example each of what you need, and indicate the repetitive nature with a box.
That can by PM our in this topic: https://qcad.org/rsforum/viewtopic.php?f=30&t=6733
This topic is a about a tool to create hatch patterns based on fixed seeds.

Regards,
CVH
Last edited by CVH on Sat Oct 15, 2022 6:25 am, edited 1 time in total.

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

Re: Free Stand Alone Basic Hatch Pattern Tool *Full Version*

Post by John Hyslop » Sat Sep 24, 2022 12:42 am

Hi CVH

Thanks for replying to this and yes Mark
a drawing showing what you want would be a good start. Also PM is fine for me too but others may be interested in this pattern so please upload an example here or on my other topic as CVH suggested above if that is a more suited place..

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

lezav
Newbie Member
Posts: 3
Joined: Fri Sep 23, 2022 9:16 am

Re: Free Stand Alone Basic Hatch Pattern Tool *Full Version*

Post by lezav » Mon Oct 10, 2022 11:25 am

Thanks to both of you for your help. Autocad apparently has a slope hatch tool, but because of copyright warnings I did not copy their example.
Below in the attached JPG I did the best I could to show you my example of three slopes on a plan view.
The slope outline is a rectangle. There does not appear to be a universal standard for showing a slope of a terrain. I managed to find the following:
the hatch pattern consists of multiple vertical lines of different lengths, typically one full length line and one line (or two lines) that is (are)proportional to the slope angle. Perhaps this could be done with an existing pattern like 'grid' pattern? I tried but failed. :(



Image
slope hatch.jpg
slope hatch.jpg (37.36 KiB) Viewed 11868 times

lezav
Newbie Member
Posts: 3
Joined: Fri Sep 23, 2022 9:16 am

Re: Free Stand Alone Basic Hatch Pattern Tool *Full Version*

Post by lezav » Mon Oct 10, 2022 11:50 am

I also found this link in French ( hopefully your browser can translate if needed). 'Talus' in French means slope of a terrain.
https://forums.abvent.com/t/representat ... talus/2013

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

Re: User Requested Custom Hatches

Post by CVH » Mon Oct 10, 2022 5:16 pm

Marc,

This is not really something for a hatch pattern.
The first thing is that the full length line has to be defined as XLine or as a Line-segment with a certain length.
The next problem is that after a line segment ends the gap must also be defined by a certain length.
But here the gap must be endless otherwise the segment is repeated.

Not saying that it is impossible but you need something configurable to match all your needs.
John can do that with BHT.
The painter-sets 'Riverbank' of Flexpainter are something similar but that is not a hatch.
The tool only draw lines like you can do for yourself, the advantage is that the base of 'Riverbanks' can be curved ... :wink:
See Misc .. Script examples .. Mathematics or simply type 'FP'.

Based on an existing pattern like 'grid' pattern? No, I think not.

It is fairly simple, I will draw them upwards at 90 degree, you can angle the hatch itself by your needs:
- First line ... starting at (0,0), repeating every XA, no vertical shift and endless.
90,0,0,0,XA,1 (Omitting a gap will define it as an XLine)
- Second line ... starting at (XA/2,0), repeating every XA, no vertical shift, YA long and a gap of extreme proportions.
90,XA/2,0,0,XA,YA,-10000
You only need to fill in the values for XA, half of XA and YA.

'Slope B' is fairly similar, it repeats every 3/2 times XA, shorter lines are YB long:
90,0,0,0,XA*3/2,1
90,XA/2,0,0,XA*3/2,YB,-10000
90,XA,0,0,XA*3/2,YB,-10000

# EDIT # dx & dy were mixed up :oops: Corrected

Regards,
CVH
Last edited by CVH on Sat Oct 15, 2022 6:25 am, edited 3 times in total.

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

Re: Free Stand Alone Basic Hatch Pattern Tool *Full Version*

Post by John Hyslop » Tue Oct 11, 2022 11:07 am

Hi Guys

I'm interstate atm and don't have a pc, I also have a couple of PM's to answer I'll do this when I get back..
If I'm going to add a pattern to BHT I might need a bit more info, if someone has already PM'd that I'll look when I get back too..

Cheers All.. 😁
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

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

Re: Free Stand Alone Basic Hatch Pattern Tool *Full Version*

Post by Husky » Tue Oct 11, 2022 8:30 pm

John Hyslop wrote:
Tue Oct 11, 2022 11:07 am
I'm interstate atm and don't have a pc, I also have a couple of PM's to answer I'll do this when I get back..
Ahhh, that is the reason why nobody answered the door when I knocked on it two days ago ... :lol: :lol: :lol:
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..."

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

Re: Free Stand Alone Basic Hatch Pattern Tool *Full Version*

Post by John Hyslop » Wed Oct 12, 2022 6:05 am

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

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

Re: Free Stand Alone Basic Hatch Pattern Tool *Full Version*

Post by John Hyslop » Thu Oct 13, 2022 2:26 am

Hi Marc

I've tried to keep this as simple and straight forward as possible so a novice user can follow what's happening.
.
I'm not sure what drawing units you use so I've gone with 10 for the X spaces,this can be scaled to suit your needs and I figured it would be the easiest to work with.. Scale of 0.1 = 1 and Scale of 10 = 100 and so on..
.
1st and most important thing to understand is Hatch Pattern origins when applied always use the datum X0 Y0 on your drawing, this can be changed to suit your needs by left clicking on the Hatch Pattern and changing its Origin properties.
.
I've Attached a Sample DXF for you to look over, hopefully it makes sense :-)
.
I also added a couple of angled rectangles for your reference.. I think with it being a visual representation of a slope ligning the pattern up by eye would suffice... of course you can always calculate this with trigonometry but it would probably be an overkill :)
.
.
OHHH I Almost forgot you can use the keyboard shortcut IO to find the bottom left coordinates of your rectangle...
.
.
Zip File Attached with DXF / Notes / Screenshots & Hatch Patterns

Cheers
John Hyslop
Slope Hatch.zip
(152 KiB) Downloaded 255 times
Screenshot of Slope Hatches.png
Screenshot of Slope Hatches.png (70.06 KiB) Viewed 11793 times
HatchLocation.png
HatchLocation.png (75.24 KiB) Viewed 11793 times
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

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

Re: User Requested Custom Hatches

Post by CVH » Thu Oct 13, 2022 6:47 am

John,

At the moment 'pen down' is 10000 units.
I think you forgot to mention that 'Modified to Suit Slope' means to modify the 'pen down' value.

Marc,

The smaller segments do repeats every 'pen down' minus 'pen up'.
(minus because 'pen up' is a negative value per definition).
But with a gap this extreme I/we suspect that such would only occur outside your boundary :wink: ,
unless the hatched area would exceed 10000 units in that direction. :roll:

With these patterns there are no copyright involved. :lol:
Maybe you could share how ACAD does it.
A file with a hatched area is fine, Tile2hatch can extract orphaned patterns.

Regards,
CVH
Last edited by CVH on Sat Oct 15, 2022 6:26 am, edited 1 time in total.

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

Re: Free Stand Alone Basic Hatch Pattern Tool *Full Version*

Post by John Hyslop » Thu Oct 13, 2022 7:01 am

CVH wrote:
Thu Oct 13, 2022 6:47 am
John,

At the moment 'pen down' is 10000 units.
I think you forgot to mention that 'Modified to Suit Slope' means to modify the 'pen down' value.
Nope it's intentional the slope is adjusted by the amount you move the hatch pattern..I'm trying my very best to keep this
as simple as possible.. thank you...

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

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

Re: Free Stand Alone Basic Hatch Pattern Tool *Full Version*

Post by John Hyslop » Thu Oct 13, 2022 7:13 am

Hi Husky

Is it possible to cut and paste this topic from:-
https://qcad.org/rsforum/viewtopic.php? ... =30#p38536
to new topic "User Requested Custom Hatches"
As I feel this one is just getting messy and not inline with this Topic.. "Free Stand Alone Basic Hatch Tool"

Thanks in advance if you can.. :wink:

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

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

Re: User Requested Custom Hatches

Post by CVH » Thu Oct 13, 2022 7:16 am

John Hyslop wrote:
Thu Oct 13, 2022 7:01 am
Nope it's intentional the slope is adjusted by the amount you move the hatch pattern
I see, meaning the user has to adapt origin to position.
It is a pity that origin isn't moved when moving entities.

Regards,
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”