Hatch pattern tool  SOLVED

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Hatch pattern tool  SOLVED

Post by Mathew »

Here's a tool I made to draw hatch patterns inside annotation markup. The tool draws hatches within or around rectangles, ovals, polylines, polygons and lines. All other annotations it treats as rectangles around their boundaries.

Often for markup I need to show hatch patterns, and it's laborious to mark them up with individual lines. Also, sometimes the default solid fills are sometimes not optimal to highlight areas in pdfs. This tool uses the same format as the hatch patterns that come with AutoCAD, so any of the thousands of hatch patterns for that program can be used.

The tool adds a Pencil annotation to the drawing with the hatch pattern, and subject is "Hatch " followed by the name of the pattern. The attached pdf file has a listing of all the included hatch patterns.

To install:
  1. Extract the attached javascript and hatch patterns file from the zip file and save both in the Javascripts folder either in the application folder, or in C:\Users\[USERNAME]\AppData\Roaming\Tracker Software\PDFXEditor\3.0\Javascripts )
  2. Restart PDF-XChange and it should create a Hatch button in the add-on toolbar, and a "Hatch" option in the Comments menu (in the classic UI)
To use:
First select annotation(s) to draw the hatch patterns around, then click the hatch button. (It won't do anything if you haven't selected an annotation).
You'll get a dialog:
image.png
Hatch Parameters
These are properties of the hatch that need to be re-drawn to change (ie you can't adjust them after the hatch is drawn, you'll just need to delete the hatch and draw it again).
Hatch Pattern: Select the hatch pattern to use.
Rotation: You can rotate the angle that the hatch is drawn.
Scale: This is a scale factor on the defined hatch. Watch out: If the scale is too small, the hatch will be so dense that it may appear solid. It also will be many millions of lines and may take a long time to draw. If it is too large, the hatch may not even be drawn inside your shape (ie, the shape may fit inside an empty area of the pattern). I've shared a tool below to scale up/down the hatch patterns themselves viewtopic.php?p=173230#p173230
Island Detection: This is how the tool decides whether it is inside or outside your shape. My implementation is not very sophisticated, so it's easily tripped up by shapes that have inside angles - see limitations below. There are three options:
  • None: This draws between the outermost detected intersections of the hatch line and your selected annotation(s).
    image(1).png
    image(1).png (46.59 KiB) Viewed 19813 times
  • Outer: If the hatch line crosses the annotation(s) more than twice, it only draws between the outer two intersections.
    image(2).png
    image(2).png (35.99 KiB) Viewed 19813 times
  • Alternate: It alternates between intersections.
    image(3).png
    image(3).png (40.12 KiB) Viewed 19813 times
Origin Offset: All the hatch patterns have an origin point at (0,0) on the pdf page - so regardless of the place on the page the hatch is drawn, all hatches will line up. But sometimes it makes more sense to move the hatch origin so that it lines up better with the shape that's being hatched. You can enter an offset x,y value or the buttons on the right cycle between corner points and the center point of the selected annotations - it highlights the currently selected corner with a green dot. Adding and moving this green dot adds "undo" steps, so if you don't want this, edit the file, on line 49, change to

Code: Select all

const SHOW_CORNER_POINTS = false;
image(7).png
image(7).png (4.15 KiB) Viewed 19657 times
Hatch Properties
These are properties that can be changed if you select the hatch in PDF-XChange within the Properties toolbar. Because the hatch is just a Pencil annotation, you can also change border style, fill color, opacity, etc. from the Properties toolbar.
Color: There are some colors listed to draw the hatch - it also grabs the color of the selected items. For colors other than the basic ones, it just lists the RGB values.
Line width: Same as "border width" in the properties toolbar.

Preview
Selecting "OK" just draws the hatch.
"Preview" draws the hatch, and then asks if you want to keep it or change it.

Tool Settings
There are some settings that can be changed by editing lines 47-50 of the script.

Code: Select all

const HATCH_FILE_NAMES = ["HatchPatterns.pat"]; // names of hatch pattern files to load - will be loaded to menu in order
const ALWAYS_LOAD_PATTERNS = false;	// if false the hatch patterns only load the first time the tool is used after application restart
const SHOW_CORNER_POINTS = true; // set to false to not add an annotation while picking corner points for origin
const MAX_SAVED_COLORS = 8; // maximum number of custom colors to save in the color dropdown
Most important is HATCH_FILE_NAMES which is comma separated file names for hatch patterns to load. See post below about IEC patterns for an example viewtopic.php?p=173203#p173203

Limitations:
  • Undo: There's a bug in PDF-XChange so if you add an annotation through javascript, it doesn't show up in the undo list. I'll report that separately. Just select and manually delete the hatch pattern if you don't want it.
  • Fixed v2.0: I tried to make it load a text file with hatch patterns so I could use the AutoCAD .pat files directly, but I was stymied by the security settings.
  • Pencil annotations are treated as rectangles. I didn't have the patience or ability to figure out how to interpret intersections with curving lines.
  • Island detection is quite rudimentary. If someone else wants to come up with a better approach, please do! This script doesn't actually figure out if it is inside or outside a shape: It just finds intersections with each hatch line. So you can get some strange results with shapes that have inside corners. The "alternate" island detection seems to work best in most cases, so I generally just keep it on that. Depending on the hatch line angle, the None method will draw outside a shape's boundaries:
    image(4).png
    image(4).png (25.58 KiB) Viewed 19813 times
    Similarly, the Outer method may skip interior parts of a shape:
    image(5).png
    image(5).png (22.29 KiB) Viewed 19813 times
    For this shape, only the Alternate method works:
    image(6).png
    image(6).png (23.1 KiB) Viewed 19813 times
  • Respond to this thread if you see other problems that I may be able to fix.
Hatch Patterns.pdf
(107.14 KiB) Downloaded 206 times
hatch tool v2.0.1.zip
Extract the zip and save both files in the Javascripts folder either in the application folder, or in C:\Users\[USERNAME]\AppData\Roaming\Tracker Software\PDFXEditor\3.0\Javascripts
(22.6 KiB) Downloaded 22 times
BTW: If using a complex hatch pattern (such as GRAVEL or DOTS) over a large area, it can significantly increase the size of a pdf.
Last edited by Mathew on Fri Feb 02, 2024 6:42 pm, edited 10 times in total.
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8371
Joined: Wed Jan 03, 2018 6:52 pm

Re: Hatch pattern tool

Post by TrackerSupp-Daniel »

Hello, Mathew

Thank you very much for the time and effort you have put into this, it looks like a tool which will be very helpful to a number of users!

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
David.P
User
Posts: 1501
Joined: Thu Feb 28, 2008 8:16 pm

Re: Hatch pattern tool

Post by David.P »

Mathew wrote: Tue May 30, 2023 6:06 pm Here's a tool I made to draw hatch patterns inside annotation markup.
What did I just read!?
🤯🤯🤯🤯🤯
Amazing!
David.P
PDF-XChange Pro
ennessbee
User
Posts: 3
Joined: Thu Sep 01, 2022 9:53 pm

Re: Hatch pattern tool

Post by ennessbee »

Woah! Amazing! thank you! :D
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Hatch pattern tool

Post by Tracker Supp-Stefan »

Hello Mathew and all.

WoW! That is indeed a great tool you've done there! Appreciate it a lot!

Kind regards,
Stefan
BB64
User
Posts: 3
Joined: Wed May 31, 2023 1:15 pm

Re: Hatch pattern tool

Post by BB64 »

Incredible tool thanks a lot
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6813
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Hatch pattern tool

Post by Paul - Tracker Supp »

Hi, BB64

yes indeed. I feel obliged to pipe in with my praise as well. What a fantastic job! And best yet, you just gave it to everybody!

That to my mind is stupendously gracious of you.

Kind regards,
Paul - Tracker Supp

PS - If you are ever bored with time on your hands I have some other ideas in mind that our devs are too busy to take on... ;) When/if that day comes email me at paul@tracker-software.com
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
mCHSNUg5Pz8cPap
User
Posts: 116
Joined: Wed Aug 04, 2021 6:36 pm

Re: Hatch pattern tool

Post by mCHSNUg5Pz8cPap »

Wow, this is amazing!

One thing to note is that I installed the tool in the application folder (it did not exist so I had to create it), used it once, and couldn't get it to work again. After messing around with it for a while I got it working again by unchecking the box labeled "Enable global object security policy" in Preferences->JavaScript.

Another thing I wondered about is whether it is possible to put the hatch button in the default Comment menu or another custom menu. I looked at the code, but not being a developer, I couldn't figure out how to modify it to make this possible.

Thanks again!
Features I really want:
1. Fully customizable toolbars: https://forum.tracker-software.com/viewtopic.php?p=167585
2. Sanitize documents w/o being forced into save as dialog (Acrobat has this!): https://forum.tracker-software.com/viewtopic.php?p=156130
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Re: Hatch pattern tool

Post by Mathew »

mCHSNUg5Pz8cPap wrote: Fri Jun 02, 2023 11:46 pm One thing to note is that I installed the tool in the application folder (it did not exist so I had to create it), used it once, and couldn't get it to work again. After messing around with it for a while I got it working again by unchecking the box labeled "Enable global object security policy" in Preferences->JavaScript.

Another thing I wondered about is whether it is possible to put the hatch button in the default Comment menu or another custom menu. I looked at the code, but not being a developer, I couldn't figure out how to modify it to make this possible.
I'll look at the issue when installed in the Javascripts application folder to see if there's a way to deal with that security issue. I've always put it in C:\Users\MY USER NAME\AppData\Roaming\Tracker Software\PDFXEditor\3.0\Javascripts so hadn't tested that.

If you are using the Ribbon UI I don't know how to add to any of the ribbon menus - as far as I know we can only add to the "Add-on Tools" ribbon. In the Classic Toolbars you can change the menu it shows up in: In a text editor change line 22. To get it into the Comments menu line 22 should read:

Code: Select all

cParent: "Comments",
Last edited by Mathew on Wed Jun 07, 2023 12:38 am, edited 1 time in total.
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8371
Joined: Wed Jan 03, 2018 6:52 pm

Re: Hatch pattern tool

Post by TrackerSupp-Daniel »

Hello, Mathew
Mathew wrote: Mon Jun 05, 2023 4:48 pm To change the menu it shows up in, in a text editor change line 22. To get it into the Comments menu line 22 should read:

Code: Select all

cParent: "Comments",
I didn't even know this was a possibility. Kudos to you for finding that!

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Re: Hatch pattern tool

Post by Mathew »

I made some changes to fix the privilege issue noted above, also added the option to move the base point for the hatch. I'll also update the original post above. Let me know if you see problems.
hatch tool v1.1.zip
(16.98 KiB) Downloaded 145 times
  • draw hatch to center of lines on squares and circles to be consistent with polygons and lines (it already did this for polygons but the .rect property of squares includes the border width, so it was drawing to the outside of the border.)
  • clean up some leftover debug code
  • option to move the hatch origin
  • fixed access to global variable that was preventing the script from running
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8371
Joined: Wed Jan 03, 2018 6:52 pm

Hatch pattern tool

Post by TrackerSupp-Daniel »

:)
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Re: Hatch pattern tool

Post by Mathew »

I had to change it again to make it work with v10 of PXE. I can't figure a way around security for access to global variables, so settings between sessions will reset. When I figure it out I'll update.

Changes:
  • Added buttons to pick corners and center point of selected annotations for hatch origin
  • Fixed an issue with custom colors
  • Moved access to global variable optional by separate file, but I can't figure out how to do this right now, so settings are not saved.
hatch tool v1.2.zip
(18.91 KiB) Downloaded 127 times
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Hatch pattern tool

Post by Tracker Supp-Stefan »

Hello Mathew,

Many thanks for the updated tool!
And I've asked our devs for your issue with the global variables that you reported in the separate topic. We will get back to you on the global variables in that other topic.

Kind regards,
Stefan
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Re: Hatch pattern tool

Post by Mathew »

OK, I think I've got a handle on the global variables, and they seem to be saving in this revision. Hopefully I've got the bugs squashed. Let me know any problems and I'll try to fix.

Lots of help from Roman at Tracker Software for this.
hatch tool v1.3.zip
Unzip and put into the Javascripts folder
(18.98 KiB) Downloaded 144 times

If you are still having trouble running this, you may need to edit the GlobData file that may have been messed up by my previous versions. It is a text file that can be edited in notepad (or other text editor):
C:\Users\[YOUR USER NAME]\AppData\Roaming\Tracker Software\PDFXEditor\3.0\Javascripts\GlobData
Quit PDF XChange before editing the file. Find the line that reads
/hatchValues <<
And if there's a line after it beginning with /D delete that line and save.

Or, easier, you could delete the GlobData file (you'll lose any saved global variable values, but PDF XChange will recreate it).
Last edited by Mathew on Tue Jul 04, 2023 9:05 pm, edited 3 times in total.
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8371
Joined: Wed Jan 03, 2018 6:52 pm

Hatch pattern tool

Post by TrackerSupp-Daniel »

:)
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
Roman - Tracker Supp
Site Admin
Posts: 302
Joined: Sun Nov 21, 2004 3:19 pm

Re: Hatch pattern tool

Post by Roman - Tracker Supp »

Hi Mathew,
It is really impressive that you keep sharing such a useful and high quality work.
Maybe it makes sense to publish your code in a public source version control service (such as https://github.com/) ? I think this could make your work more accessible to other people.
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Re: Hatch pattern tool

Post by Mathew »

Thanks Roman. I may do in future, but I kind of like it as a gift for people who have discovered my favorite PDF editor 😍
Very few software companies are as helpful and diligent as you are.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Hatch pattern tool

Post by Tracker Supp-Stefan »

:)
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Re: Hatch pattern tool

Post by Mathew »

Hopefully this is it for a while.. I ran into another bug where if multiple shapes were duplicated on top of one another, it may not draw a hatch. Fixed in this version.
hatch tool v1.4.zip
Extract .zip file and save the .js file in the Javascripts folder
(19.55 KiB) Downloaded 163 times
Changes:
  • check for duplicated shapes on top of one another,
  • misc code revisions: var to let or const most cases, moved hatch line drawing to method of line
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8371
Joined: Wed Jan 03, 2018 6:52 pm

Re: Hatch pattern tool

Post by TrackerSupp-Daniel »

Hello, Mathew

Thank you once again for all your effort here! This is great stuff!

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
jcaiken
User
Posts: 25
Joined: Sun Jun 27, 2010 11:43 pm

Re: Hatch pattern tool

Post by jcaiken »

Hi,

I've been looking for a tool like this for a while and to finally come across this one is great. All I have to do now is dunderstand how to install and use it.

My requirements are specific to the hatch patterns specified in international standards to designate Hazardous Area zones for equipment mainly on plan-view drawings (e.g. in IEC 60079-10-1 & 2 - where 3 zones are identified with different severity of the risk of an explosion or fire). Although the hatch patterns specified are based on use on monochrome drawings, the use of primary colours would enhance the clarity of the drawings.
Would it be possible to create a subset of the tool, specifically for this application?
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Re: Hatch pattern tool

Post by Mathew »

I'm not sure what those hatches look like: I could maybe come up with the patterns if you can show them.

If it's just a diagonal hatch use the pattern "Diagonal". For a double diagonal, you could use "NET" at an angle of 45 degrees.
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6813
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Hatch pattern tool

Post by Paul - Tracker Supp »

Mathew wrote: Mon Sep 11, 2023 6:15 pm I'm not sure what those hatches look like: I could maybe come up with the patterns if you can show them.
I'm keen to see these also.
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Re: Hatch pattern tool

Post by Mathew »

jcaiken wrote: Sun Sep 10, 2023 11:11 pm My requirements are specific to the hatch patterns specified in international standards to designate Hazardous Area zones for equipment mainly on plan-view drawings (e.g. in IEC 60079-10-1 & 2 - where 3 zones are identified with different severity of the risk of an explosion or fire). Although the hatch patterns specified are based on use on monochrome drawings, the use of primary colours would enhance the clarity of the drawings.
If you paste the following at line 63 (ie at the beginning of the hatch patterns), it will give you three menu options for spaced hexagons (zone 0), cross hatch (zone 1) and diagonal hatch (zone 2):

Code: Select all

	{ name:"IEC 60079-2", description:"Zone 2: Solid line diagonal hatch", hatch:[[45,0,0,0,.5]] },
	{ name:"IEC 60079-1", description:"Zone 1: Solid line diagonal crosshatch", hatch:[[45,0,0,0,.5],[-45,0,0,0,.5]]},
	{ name:"IEC 60079-0", description:"Zone 0: Hexagons", hatch:[[0,0,0,0,0.4330127018922193,0.25,-.5],[120,0,0,0,0.4330127018922193,0.25,-.5],[60,0.25,0,0,0.4330127018922193,0.25,-.5]]},
image.png
The above used 0.5 linewidth and scale 12. This was just what I found from some searching on the web. If you have a hatch pattern already defined in AutoCAD it's quite easy to convert for this tool - it uses essentially the same format.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Hatch pattern tool

Post by Tracker Supp-Stefan »

Hello Mathew,

Many thanks for the continuing help with this topic! :)

Kind regards,
Stefan
jcaiken
User
Posts: 25
Joined: Sun Jun 27, 2010 11:43 pm

Re: Hatch pattern tool

Post by jcaiken »

Thanks for the updates Matt.

The hatch symbols shown are based on examples in IEC 60079-10-1 (Fluid HAC)
As the hatches will be added as comments to the PDFs of the typically monochrome original drawing, the use of colour will enhance their visibility.

For IEC 60079-10-2 (Dust HAC) the symbols are similar to the Fluid HAC, with :
Zone 20 - using squares instead of the circles (octangles)
Zone 21 - using horizontal and vertical lines
Zone 22 - using vertical lines

Could you add these to the coding with the same colouring?
image_2023-10-12_144942918.png
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Hatch pattern tool

Post by Tracker Supp-Stefan »

Hello jcaiken,

Your Zone 20 is effectively the Square hatch, Zone 21 is the "NET" hatch and for the vertical lines - you likely just need to add this entry in the script from line 63 in the code onwards:

Code: Select all

	{ name:"IEC 60079-14", description:"Zone 22: Solid vertical lines", hatch:[[90,0,0,0,0.5]] },
Kind regards,
Stefan
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Re: Hatch pattern tool

Post by Mathew »

:D
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Hatch pattern tool

Post by Tracker Supp-Stefan »

:)
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Re: Hatch pattern tool

Post by Mathew »

I've revised the tool to load hatch patterns directly from AutoCAD .pat text files. The previous patterns are included as HatchPatterns.pat and need to be copied to the Javascripts folder along with the javascript. Unless you change the setting, it will load the .pat file(s) the first time the tool is used after an application restart.
hatch tool v2.0.zip
Extract and save both files into the Javascripts folder
(21.9 KiB) Downloaded 135 times

It's a bit of a change, so I'll leave the previous version above for a while in case there are problems. The benefit is that any of the literally thousands of hatch patterns available for AutoCAD can be used directly. The caveat is that one needs to be careful because the scales can vary widely: If it's too small, the script may appear to hang while it tries to draw millions of lines; or if it's too large, the pattern may not even draw inside the selected object.

There are some settings that can be changed by editing lines 47-50 of the script.

Code: Select all

const HATCH_FILE_NAMES = ["HatchPatterns.pat"]; // names of hatch pattern files to load - will be loaded to menu in order
const ALWAYS_LOAD_PATTERNS = false;	// if false the hatch patterns only load the first time the tool is used after application restart
const SHOW_CORNER_POINTS = true; // set to false to not add an annotation while picking corner points for origin
const MAX_SAVED_COLORS = 8; // maximum number of custom colors to save in the color dropdown
Most important is HATCH_FILE_NAMES which has file names for hatch patterns to load. For example, if you wanted to also load the IEC hatch patterns as a separate file:

Code: Select all

const HATCH_FILE_NAMES = ["IECpatterns.pat","HatchPatterns.pat"];
I made a separate IECPatterns.pat file with the additional patterns discussed above (it's zipped because of the suffix, but it's just a text file). You can load them as a separate file as described above, or paste them into the beginning or end of HatchPatterns.pat.
IECpatterns.zip
These are the IEC patterns discussed in the posts above. Unzip and either paste into HatchPatterns.pat or add the file name to HATCH_FILE_NAMES
(545 Bytes) Downloaded 124 times
These are the patterns in the IECPatterns.pat file:

Code: Select all

;;
;;  IEC 60079 patterns 
;;	based on post https://forum.pdf-xchange.com/viewtopic.php?t=40329
;;

*Zone 0, IEC 60079-10-1 Hexagons
0, 0, 0, 0, 0.4330127018922193, 0.25, -0.5
120, 0, 0, 0, 0.4330127018922193, 0.25, -0.5
60, 0.25, 0, 0, 0.4330127018922193, 0.25, -0.5

*Zone 1, IEC 60079-10-1 Solid line diagonal crosshatch
45, 0, 0, 0, 0.5
-45, 0, 0, 0, 0.5

*Zone 2, IEC 60079-10-1 Solid line diagonal hatch
45, 0, 0, 0, 0.5

*Zone 20, IEC 60079-10-2 Squares small aligned
0, 0, 0, 0, 0.7, 0.4, -0.3
0, 0, 0.4, 0, 0.7, 0.4, -0.3
90, 0, 0, 0, 0.7, 0.4, -0.3
90, 0.4, 0, 0, 0.7, 0.4, -0.3

*Zone 21, IEC 60079-10-2 Horizontal / vertical grid
0, 0, 0, 0, 0.5
90, 0, 0, 0, 0.5

*Zone 22, IEC 60079-10-2 Solid vertical lines
90,0,0,0,0.5
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Hatch pattern tool

Post by Tracker Supp-Stefan »

Hello Mathew,

Many thanks for the update! That separation and update of the patters format is certainly nice addition! :)

Kind regards,
Stefan
User avatar
David.P
User
Posts: 1501
Joined: Thu Feb 28, 2008 8:16 pm

Re: Hatch pattern tool

Post by David.P »

I continue to have no suitable words for the fantastic work Mathew is doing here on this feature. I hope to be able to contribute something meaningful to this soon, but still need some preparation to do so.

Kind regards
David
David.P
PDF-XChange Pro
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Scaling hatch patterns

Post by Mathew »

By the way, here's the tool I made to scale hatch patterns.
It's pretty basic: Paste the pattern into the large text field, press the "Scale Patterns" button to get a dialog for the scale. The pattern is multiplied by this number and replaces the contents of the text field.

The scale can be a decimal number, or can have fractions in the form nn/dd.

I use it to scale hatches so they look good at a scale of 12. My process is to use the hatch and figure out what scale I like it at, then use this tool to scale the pattern. For example, if it looked best at a scale of 48, then I'd scale it by 48/12.
Hatch Pattern Scale Tool.pdf
(8.49 KiB) Downloaded 145 times
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Hatch pattern tool

Post by Tracker Supp-Stefan »

Hello Mathew,

Just as David - I am very grateful for the work you do on that tool and am thankful for you sharing it with all!

Kind regards,
Stefan
jcaiken
User
Posts: 25
Joined: Sun Jun 27, 2010 11:43 pm

Re: Hatch pattern tool

Post by jcaiken »

Quick Tip

If you only require hatching to show the Hazardous Area Classification zones as per the IEC Standards, then renaming the 'IECpatterns.pat' file to overwrite the 'HatchPatterns.pat' file can be easier for those of us who are less computer-savvy to use. Only the IEC Zone patterns are displayed in the list of hatches.

A brilliant tool - many thanks.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Hatch pattern tool

Post by Tracker Supp-Stefan »

Hello jcaiken,

Thanks for sharing your approach with everyone!
And indeed Mathew has done a great job with that tool!

Kind regards,
Stefan
joshual
User
Posts: 5
Joined: Wed Jan 17, 2024 5:15 pm

Re: Hatch pattern tool

Post by joshual »

Hi Matthew,

This tool looks like it will be great, unfortunately I am having issues getting it installed to use. I have created a JavaScripts folder in the appropriate location however I'm unable switch my Ribbon UI to Classic UI. It seems trying to make that switch on the current build crashes the program.

Is there a way to use this with the RIbbon UI?
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8371
Joined: Wed Jan 03, 2018 6:52 pm

Re: Hatch pattern tool

Post by TrackerSupp-Daniel »

Hello, joshual

Any Javascripts added to the Javascripts folder should appear in an "addon tools" toolbar in the ribbon UI, no need to switch to classic to use this tool. To be sure, have you properly placed the "hatch tool.js" and the Matthews included "HatchOPatters.pat" files in a "JavaScripts" folder into the "PDF Editor" installation folder? (like so:)
image.png
If not, that would be why they are not appearing.

As for the Crash, could I ask you to please email us, as that is certainly a serious issue, but not one directly related to this thread (we don't want to mix the threads, as that causes confusion). It would help if you could follow the steps here to perform a crash dump and send that to us in said email. Our email address is Support@pdf-xchange.com

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
joshual
User
Posts: 5
Joined: Wed Jan 17, 2024 5:15 pm

Re: Hatch pattern tool

Post by joshual »

Thanks for the support. After restarting my computer the tool is showing up and Matthew - this is fantastic!

For the crashing issue - separate thread created and won't discuss here. Thanks!
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8371
Joined: Wed Jan 03, 2018 6:52 pm

Hatch pattern tool

Post by TrackerSupp-Daniel »

:)
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Mathew
User
Posts: 188
Joined: Thu Jun 19, 2014 7:30 pm

Re: Hatch pattern tool

Post by Mathew »

Very minor update to deal with a bug that's making the dialog box extremely wide. Manually wrapped the text lines in the dialog. If the wide dialog box doesn't bother you, no need to download this.
hatch tool v2.0.1.zip
Unzip and put both files in the Javascripts folder
(22.6 KiB) Downloaded 27 times
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8371
Joined: Wed Jan 03, 2018 6:52 pm

Re: Hatch pattern tool

Post by TrackerSupp-Daniel »

Hello, Mathew

Thank you for the update, and the attention to detail, hopefully this version isn't needed for too long!

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Post Reply