Creating a Hex Tile

Post questions on how to use or achieve an effect in Inkscape.
User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Creating a Hex Tile

Postby kstingel » Mon Mar 28, 2016 2:09 am

I'm trying to create a hex-tile for use in multiple future maps - each side is supposed to measure 24px

Thus far, I have drawn the singleton tile but I don't understand the output I'm getting in Inkscape
src file for reference: http://kstingel.com/svg/debugging/hex-single.svg

this is the result I see in Inkscape:
Image
(image can be viewed full-size @ http://kstingel.com/svg/debugging/inkscape_hex-single_original-size.jpg)

if you check the src file, you will see I have stroke-alignment="inner" in the path attributes,
but Inkscape seems to be ignoring that and still drawing the stroke along the path center

since this will impact the "tiles" I create, I would prefer to get this sorted before I progress with creating my maps
Last edited by kstingel on Mon Mar 28, 2016 2:15 am, edited 1 time in total.

User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Re: Creating a Hex Tile

Postby kstingel » Mon Mar 28, 2016 2:12 am

The display lines from the src file:

Code: Select all

<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1">
    <path id="hex-24px" stroke-alignment="inner" d="M 18,0 L 24,10.395 L 18,20.79 L 6,20.79 L 0,10.395 L 6,0 Z" style="opacity:1;fill:none;stroke:#2f4f4f;stroke-width:0.3;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:0.75" inkscape:connector-curvature="0" />
  </g>

User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Re: Creating a Hex Tile

Postby kstingel » Mon Mar 28, 2016 3:30 am

the Hex above will be the base tile for my map, with additional tiles depicting the variants

would I be best served to use individual SVG images for my tiles, or create all the tiles in a single file?

Person tile example: (only the central tile will display the face ... displayed tile is the Owner of the displayed Map, neighbors would just show the person)
Image ... src: http://kstingel.com/svg/debugging/hex-person.svg

dimumurray
Posts: 28
Joined: Sat Feb 27, 2016 2:55 am

Re: Creating a Hex Tile

Postby dimumurray » Mon Mar 28, 2016 3:40 am

I don't think the stroke-alignment attribute is supported yet.

Its not too hard to work around though. You can double the stroke width for one. For example, if you want to have a border with an inset of 5px set the stroke to 10px. Enable cusp snapping to arrange your hex-grids and you're good to go.
Last edited by dimumurray on Mon Mar 28, 2016 1:49 pm, edited 4 times in total.

dimumurray
Posts: 28
Joined: Sat Feb 27, 2016 2:55 am

Re: Creating a Hex Tile

Postby dimumurray » Mon Mar 28, 2016 3:45 am

kstingel wrote:would I be best served to use individual SVG images for my tiles, or create all the tiles in a single file?


You can create your tiles and convert them to symbols and keep them in one svg file and use that svg as a symbol library.

User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Re: Creating a Hex Tile

Postby kstingel » Mon Mar 28, 2016 5:24 am

@dimumurray: within my Symbols file, would I place each Symbol (template) in the same position?

so, for example, if my final tile is going to be 20.79px deep by 24px wide (the measurement of my hex)
draw each symbol into the same space then to create my examples, just "use" the symbol to the desired x/y co-ords?

As you can probably guess, I'm still learning the concepts of symbols, patterns and tiles and working out when to use which type

Image
an example of the symbols I've created so far - I wasn't sure if they should be symbols / patterns or tiles

hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: Creating a Hex Tile

Postby hulf2012 » Mon Mar 28, 2016 5:32 am

Hello

Code: Select all

 stroke-alignment="inner"

I agree with dimumurray.That propriety is still not supported. If I remember well, it's just a proposal for next upgrade of the SVG standard... or something like that ;) .
But If some one can show a link or document that probes I'm wrong... I will be grateful.
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Re: Creating a Hex Tile

Postby kstingel » Mon Mar 28, 2016 5:32 am

the example above had a whole heap of transforms applied to each use instance, with the use co-ords set as x="0" and y="0"
- I ended up hacking it in Notepad++ and moving the transforms over to the co-ords values then deleting the (empty) transform

User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Re: Creating a Hex Tile

Postby kstingel » Mon Mar 28, 2016 5:34 am

thanks hulf2012 and dimumurray for clearing up the stroke-alignment thing - I was convinced I was using it wrong and that was why it wasn't working

:lol: as an Inkscape noobie, is nice to know my comprehension of SVG is more advanced than the software (in some respects)

hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: Creating a Hex Tile

Postby hulf2012 » Mon Mar 28, 2016 5:57 am

Sometimes, the posts in the forum helps in both ways.
About the use of a symbol object... I think it will depend of your needs. Here I have to say that I'm not clear about its utility for your proposal. Perhaps It will reduce the amount of code...
A source that I always consult:
http://tutorials.jenkov.com/svg/symbol-element.html
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Creating a Hex Tile

Postby tylerdurden » Mon Mar 28, 2016 6:52 am

If you double the stroke, but don't want the stroke to extend beyond the path, you can clip the shape with a duplicate of itself.

    SVG Image
2px stroke before and after clipping.
Attachments
NotAndClipped-2pxStroke.svg
(3.83 KiB) Downloaded 170 times
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Re: Creating a Hex Tile

Postby kstingel » Mon Mar 28, 2016 7:25 am

Image
example use of the tile-set - src file: http://kstingel.com/svg/debugging/hex-world.svg

I suppose I should stop referring to it as a tile-set, since it's now a symbol set :D

eventually, I'd like to script it so that I can set the status of neighbors and change the "person" overlay accordingly,
but for now I'm just happy to have to building blocks in place

the world view expands in rings depending on the direction explored - I can probably achieve that with masks or clips,
but at this stage my knowledge doesn't extend that far ... that's next week's chapter :lol:


Return to “Help with using Inkscape”