Debugging Patterns

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

Debugging Patterns

Postby kstingel » Sun Feb 14, 2016 6:41 pm

I wasn't sure where this would belong, so I'm posting it here

I'm in the process of building "planner" map for Elvenar ... more for my own use at present, but possibly as a base for a city-planning guide down the track

the problem I have is the display of my first building ... the square in the foreground (on top of the green grid) - it should display a bordered square, but as you can see, it is displaying cross-hairs instead of an outer border

SVG Image
this is the broken map, and I have made the source file downloadable http://kstingel.com/svg/elven_map-0.svg
the two snippets in question are:

Code: Select all

<pattern id="MainHall" width="60px" height="60px" patternUnits="userSpaceOnUse" viewBox="0 0 60 60">
    <rect class="shape" x="0" y="0" width="60" height="60" style="fill:cadetblue;stroke:steelblue;stroke-width:0.51;stroke-alignment:inner;" />
  </pattern>
and

Code: Select all

<rect id="eMH" x="140" y="50" width="60" height="60" fill="url(#MainHall)" />

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Debugging Patterns

Postby brynn » Sun Feb 14, 2016 6:50 pm

Ok, that grayish blue square in question is a rectangle with a Pattern fill. And the pattern is not perfectly aligned to the rectangle.

If you want it to be a pattern, we can tell you how to align it. Or if you don't need it to be a pattern, you can do Object menu > Patterns > Pattern to Object (I'll save the longer explanation, just in case it might not be needed. But very glad to explain, if you want to keep it a pattern. Just let us know ;))

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

Re: Debugging Patterns

Postby kstingel » Sun Feb 14, 2016 8:03 pm

I want to keep it a pattern :D ... If I can sort what I did wrong, then I can proceed and make patterns for all the buildings

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

Re: Debugging Patterns

Postby kstingel » Sun Feb 14, 2016 8:08 pm

I thought by making my Pattern the same size as it's rectangle container, it would auto-magically draw itself aligned :(

does that mean for each change of co-ords of the bounding rect object I will need to re-calibrate the pattern?

some of my buildings (read patterns) can appear more than once in the map, and others will relocate as the map expands and they can be placed into their optimal position

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Debugging Patterns

Postby brynn » Sun Feb 14, 2016 8:25 pm

Oh ok. Sorry, I somehow didn't connect the title with the message. So you do need to adjust the pattern.

Select it with Selection tool.
Ungroup (for some reason, it's a Group of 1)
Switch to the Node tool. This will cause the pattern handles to be revealed. The pattern handles are a tiny circle, tiny square and tiny X. Sometimes they can be really hard to find. I''ll check your file and see if I can tell you where they are.

Anyway, you can grab the X with the mouse and drag the controls closer to the rectangle, so you can see what you're doing. (Yeah, those handles really can be anywhere!) The tiny square adjusts the proportions of the pattern. Hold control to keep the proportions the same. The tiny circle rotates the pattern.

Probably, all you'll need is the X handle, although I'm not positive. Ok, lucky you! The pattern X handle is sitting precisely on the top-left corner of the page. And note -- don't get confused between the pattern handles and handles on the rectangle. They look just the same. You could convert the Rectangle to a path, to avoid that problem.

It looks like you could snap the X handle right to a corner of the rectangle, for a perfect fit.

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

Re: Debugging Patterns

Postby kstingel » Mon Feb 15, 2016 9:11 am

@brynn: Thank-you very much for your advice, I have been able to fix the initial display now
SVG Image
Src: http://kstingel.com/svg/elven_map-0_v2.svg

I'm still uncertain how to align reusable patterns - the patternTransform fix would seem incorrect as it would differ for each container object,
but I assume if I use a Path (instead of a shape) as my container, I can avoid the issue

Off topic:
when I open the (PlainSVG) src file in Inkscape, my Layers are gone ...

I'm using Layers to group like elements and apply uniform styling but when I open the PlainSVG file, the layers don't show up in the Layers Pane
they are there in the XML, but Inkscape isn't recognising them as layers for some reason

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

Re: Debugging Patterns

Postby kstingel » Mon Feb 15, 2016 9:46 am

Looking at my src code:
Inkscape has created a new Pattern for the #mainHall Pattern ...

Code: Select all

<pattern patternTransform="translate(140,50)" id="pattern5575" xlink:href="#mainHall" />

the transform is effectively the origin point for my containing path ...
is there a way to connect that transform to the containing object so that when the container is relocated (as opposed to moving via another transform) the pattern shifts to the new origin point

I'm thinking something along the lines of:

Code: Select all

patternTransform="translate(ux,uy)"
but I'm not sure if that would be legal syntax

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Debugging Patterns

Postby Moini » Mon Feb 15, 2016 10:33 am

Do you mean something like this:

Bildschirmfoto_2016-02-15_01-32-09.png
Bildschirmfoto_2016-02-15_01-32-09.png (7.53 KiB) Viewed 2827 times


(find it in the selection tool's tool bar)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

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

Re: Debugging Patterns

Postby kstingel » Tue Feb 16, 2016 9:56 am

@Moini:
Sort of .... My maps are incremental redraws - as the city dimensions change, the entire map is redrawn and building placement is optimised to the available build area

objects don't "move" (or transform) as such, they are commented out of the image and re-added into a new origin point before deleting the original

I'm looking for an effective means to include previous svg:defs without having to manually adjust my translates for each file - I have 77 incremental map sizes to draw and optimise

Off topic:
I finally got my copy of Tav's eBook Manual (this morning), but I haven't waded through it completely yet

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Debugging Patterns

Postby Moini » Tue Feb 16, 2016 11:09 am

@kstingel: Sorry, I didn't look close enough. Maybe there's an option to script this?
(It would probably take me longer to script it than to adapt 77 files manually, though...)

Off topic:
I finally got my copy of Tav's eBook Manual (this morning), but I haven't waded through it completely yet


:) I wouldn't have expected you to - I still discover new things everytime I look something up (discovery of the week: mouse gesture for stroke width 8-) ).
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

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

Re: Debugging Patterns

Postby kstingel » Tue Feb 16, 2016 11:59 am

@Moini:
my max City bounds are 450x450 (pixels) - the city displays on a 45deg angle, so after I add the rotation transform it measures 639x639
- that makes up my root image, using a 50x50 px Pattern to draw the positioning guides

the initial City size is 150x100 (as a 15x10 buildable grid)
each expansion block is only 50x50 px - hence my choice of dimensions on the guides Pattern
- my first map therefore has a size of 200x200, the "editable" area sits @ translate(50,50) to reset my "city" co-ords

SVG Image

as you can see from the image, I can't expand to the right (I shrank the size for forum display, but all the measures are still evident)
- the original is @ http://kstingel.com/svg/imgs/define_layout.svg master.svg if that's easier to work with

depending where the expansion is placed, the active area increases by 50x50, maintaining the expandable region until it meets the maximum bounds

The actual city maps are a little more complicated because buildings get shifted around, but for the purposes of this thread, the layout maps have sufficient detail
Last edited by kstingel on Wed Feb 17, 2016 3:27 pm, edited 1 time in total.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Debugging Patterns

Postby Moini » Tue Feb 16, 2016 1:08 pm

@kstingel:

So you're creating your svg files programatically? How? (I see there's a polygon, and AFAIK, Inkscape does not create those)
Can you explain how exactly they are going to be used?
And one more clarification: why do you need the contents to be patterns? (probably relates to the previous question)

(Sorry if this sounds like I haven't paid attention... )

Btw. the svg file doesn't show up correctly in my browser. Could it be that the reason is that the imported file has kept its 'svg:svg' tags? (http://kstingel.com/svg/imgs/align_layout.svg) I don't think that's valid SVG markup (90% sure...).
If it is supposed to be interpreted as a layer in Inkscape, and visible in browsers, better use a group instead.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

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

Re: Debugging Patterns

Postby kstingel » Wed Feb 17, 2016 3:24 pm

have redrawn the master (without the polygons) and re-uploaded

steps taken:
draw image in Inkscape - keeping Layer 1 as empty layer during editing
once drawing was completed, open in notepad++
change width and height to 300 to resize output
move Layers 2,3,4 into Layer 1 to apply the transform

new master is @ http://kstingel.com/svg/imgs/master.svg

original transform was rotate(-45 320 320), Inkscape has translated this into a matrix upon save which makes reading the code a little counter intuitive IMO but I guess I could always replace the matrix with the raw transform again when manually tweaking

at present I don't know how to write a transform pattern that I could just apply to all as the final step - but I'm getting there :)

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

Re: Debugging Patterns

Postby kstingel » Wed Feb 17, 2016 3:59 pm

Moini wrote:And one more clarification: why do you need the contents to be patterns? (probably relates to the previous question)


I'm using Patterns to create my fills because the containing Objects won't always be regular shapes
for example: (layout-1, first expansion applied)
SVG Image

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Debugging Patterns

Postby Lazur » Wed Feb 17, 2016 4:22 pm

You can draw a tile on a layer, then clone it, and convert the clone to a pattern if you will -so that you can edit the parent manually after. Even better, if the parent tile is a group you can enter it to add other elements to the pattern.
Might not be the best solution if you want to copy/paste it from one document to another, but if you save it as a template file -sort of- it might be handy.

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

Re: Debugging Patterns

Postby kstingel » Wed Feb 17, 2016 5:22 pm

Lazur URH wrote:You can draw a tile on a layer, then clone it, and convert the clone to a pattern if you will -so that you can edit the parent manually after. Even better, if the parent tile is a group you can enter it to add other elements to the pattern.
Might not be the best solution if you want to copy/paste it from one document to another, but if you save it as a template file -sort of- it might be handy.


:oops: I'm not that far along yet ... I only just learned I can combine 2 squares to build my container shapes :P
saves me HEAPS of time from working out the co-ords to write the path manually

... Not sure, but I think tiles is somewhere in the next chapter

for my layout maps, I'm pretty much adding the next expansion then saving with a sequential name

city maps I edit the paths in the previous map to redraw the background grids, then drag the buildings around to optimize the layout and include any new buildings

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Debugging Patterns

Postby Lazur » Wed Feb 17, 2016 5:29 pm

Well not sure I can get the original idea. You cannot snap to pattern fills.
Why not creating a custom grid or grids? It's under the document's settings, Shift+Ctrl+D.
Then you could snap every node to grid intersections.

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

Re: Debugging Patterns

Postby kstingel » Wed Feb 17, 2016 5:31 pm

@Lazur URH: Originally I was actually drawing each layout map and it's related city map(s) (there are 2 species to map for) individually, then I worked out I could save heaps of work by just tweaking the current map and renaming (doh)

I was going to have each rotational map as well, but then I decided the viewers should be able to get the gist from the aligned example map

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

Re: Debugging Patterns

Postby kstingel » Wed Feb 17, 2016 5:33 pm

I have a custom Grid (at 10px minors and 50px majors) but I think I must have botched my settings because the snapping isn't happening

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Debugging Patterns

Postby Moini » Thu Feb 18, 2016 2:33 am

Can you make a screenshot of your snap settings?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

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

Re: Debugging Patterns

Postby kstingel » Thu Feb 18, 2016 9:19 pm

Moini wrote:Can you make a screenshot of your snap settings?

sure can .... the images are quite large, so I uploaded them
http://kstingel.com/svg/debugging/base_page_sceenshot.jpg
^^ my default "map" page
http://kstingel.com/svg/debugging/grid_setup.jpg
^^ the grid setup
http://kstingel.com/svg/debugging/snap_settings.jpg
^^ my snap settings
http://kstingel.com/svg/debugging/revised_snap_settings.jpg
^^ edited snap settings

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Debugging Patterns

Postby brynn » Thu Feb 18, 2016 11:59 pm

What we need more are how the options are set on the Snap Control bar, which is usually along the right side of the window (far right -- even right of the dialog docking area). But it can be along the top, or it can be hidden. Maybe that's the problem, because this bar contains the "global off and on" for snapping.

If you don't find it, try View menu > Show/Hide

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

Re: Debugging Patterns

Postby kstingel » Fri Feb 19, 2016 12:17 am


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

Re: Debugging Patterns

Postby kstingel » Fri Feb 19, 2016 12:20 am

While we're debugging ....
I have my setting set to use color names and I'm using SVG color names, why does Inkscape keep morphing them back to hex codes?

http://kstingel.com/svg/debugging/SVG_colors.svg <- my reference sheet
- it's actually copied from the web with a slight edit so that the second column names didn't overlap the third column swatches

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Debugging Patterns

Postby Lazur » Fri Feb 19, 2016 12:27 am



You need to toggle the cusp and smooth node's icons too(10th and 11th), as well as other targets if you like -like bounding box corners, though I prefer not having both the bounding box and node snapping on at the same time.


Return to “Help with using Inkscape”