PDA

View Full Version : Gimp Script: Hex Grid



RobA
04-28-2009, 11:26 AM
This post (http://forum.cartographersguild.com/showthread.php?t=5094) asked about drawing hex grids in Gimp.

I posted a quick and dirty hex script there, but have cleaned it up and added more features.

I shows up as Filters->Render->Pattern->Hex Grid... (which is the same sub-menu as the existing grid script).

This script works on the current layer/drawable to be consistent with the way the normal grid plugin works.

Here is the dialog:
12813

The options are:

Element to Specify - is either the length of one side, the distance from point to point (equals the horizontal center to center in a horizontal oriented hex grid) or side to side (equals the vertical center to center in a horizontal oriented hex grid).
Length of Element - the length in pixels of the above item.
Hex Orientation - Horizontal or Vertical
Line width - the width of the stroke
Horizontal and Vertical offsets - when zero the first grid is tight in the upper left hand corner, with the stroke half off the edge. So for example, if you set it to a 1 pixel line width, you might want to change the corresponding offset to 0.5 so the lines are drawn lined up with the pixels and don't get aliased.
Color - colour of the hex grid, spelling the American way ;)

Just a note that the grid dimensions and offsets are always to the center of the lines, so if you run the script again with a different colour and a thinner line width you can get some neat effects:
12814

Hope this is useful. Suggestions on improvements or general comments and criticisms welcome.

-Rob A>

derio
04-28-2009, 11:14 PM
Thanks again for making this, it works great.

Stormcrow
05-11-2009, 08:51 AM
I cannot get the script to work, could someone please explain how to add this script to Gimp. when i refresh scripts i get an error message

it says: Error: not a number (errorbj SF-SPINNER)

RobA
05-11-2009, 09:25 AM
I cannot get the script to work, could someone please explain how to add this script to Gimp. when i refresh scripts i get an error message

it says: Error: not a number (errorbj SF-SPINNER)

What version of gimp are you using?

-Rob A>

Stormcrow
05-11-2009, 11:59 AM
I am using Gimp 2.2.17

RobA
05-11-2009, 12:48 PM
Sorry - I have no way of testing it on that old a version of Gimp. It works on 2.4 and later, as far as I know. (There were big changes in the script interpreter somewhere in there...)

In any case, I would suggest upgrading your version of gimp, probably to 2.6.5, as I hear there are some problems with 2.6.6

-Rob A>

Stormcrow
05-11-2009, 02:36 PM
This might sound ignorant of me but how do i upgrade to 2.6.5

RobA
05-11-2009, 02:56 PM
Depends on the OS. What are you using?

If windows, download the latest built installer and install it overtop.

If linux, if it is supported my your package manager, get it that way.

If you download it and build from source, you probably wouldn't be asking the question ;)


Mac - no idea.

-Rob A>

PhotoComix
05-19-2009, 09:31 PM
Hy updating from a so old version may be better FOR WINDOWS unistall first
and delete the "personal" gimp directory, before reinstall

If you use Windows easier way may be use REVOunistaller.
(or use after unistall SEARCH to find and delete your personal gimp folder ...i suggest Revo just because it may be handy to unistall also other SW, that if not would left some crap or even problematic dll behind)

This because is possible that you had installed extra plugin or script that now will be incompatible with 2.6,

For minor update (i.e from 2.6.x to 2.6.y) you may just overwrite

Feralspirit
06-16-2009, 09:39 PM
Aargh. Up until a day ago or so, I've been using the Mosaic filter for hexes. Well, I've dicovered they were not what I wanted when I tried to alter their hue (not perfect hexes due to the applied light and depth). So, I downloaded your script but I can't get it to run with my desired values (element; side to side, length 30, line width 1). Instead it gave me these error messages;


Calling error for 'Hex Grid':
Procedure 'script-fu-hex-grid' returned no return values

gimp_plug_in_handle_proc_run: ERROR

and vanished from my filter dialogue. It reappears after restart. I am using version 2.6.4 Any ideas?

Edit- Ok, I got it to run. It could be that my nearly antique machine just couldn't handle the load. I restarted my computer (to clear the cache), went straight to GIMP and used a new clean white file (still preserving as much virtual memory as possible). Ta-da, hexes. Copy to the file with my map and all is right with the world. If you have any additional thoughts for future use though, I'd be happy to hear them.

RobA
06-16-2009, 10:28 PM
Glad you go it working - I say your initial post and didn't get a chance to reply before you solved it!

-Rob A>

MadMikeD
08-15-2010, 04:31 PM
Hey Derio, this is a big help. Thanks!
As I am new to GIMP it took me a while to figure this out, so I thought it would be helpful for others to know how to load the script. After some research I found this link:

http://docs.gimp.org/2.6/en/install-script-fu.html

Next, I had to figure out where the script folder is located and then simply copy the script into the folder. I did that by going edit/preferences and then scroll down to "folders" and select "script". From there it displays the folder directory. In my case it was the following:

C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts

PS: using XP and Gimp 2.6

Thanks again,
Newbie Mike

RobA
08-16-2010, 12:08 PM
Hi Mike!

I'd suggest you not put use scripts in the installation directory, as they will get overwritten if you ever have to reinstall gimp.

There should be a second script directory (along with directories for patters, gradients, etc.) under XP located at:

C:\Documents and Settings\<username>\.gimp-2.6\scripts

(where <username> is your login/account name without the angled brackets.)

This is designed so multiple users can have different resources available, as well as when upgrading (say to gimp 2.8) they will get copied to a .gimp-2.8 directory structure without erasing the stuff in .gimp-2.6

-Rob A>

someguy
08-24-2010, 02:09 AM
Much needed and a huge thanks from me for it!

Sharpe
11-14-2010, 01:09 AM
Thanks, Rob! Huge help, as usual!


But, I've got an issue. Say I have a canvas at 8.5"x11" at 300 dpi. That's 2550x3300 px. If I made my hexes 300 px side-to-side, it doesn't come out to 8.5x11 hexes.

I'm trying to figure out how best to get a perfect fit of hexes on a sheet of paper...